Contour Tracing: Suzuki-Abe style with non-binary images #220
Replies: 4 comments 15 replies
-
|
@Ryan-Millard
This is all in python but can be converted to C++. contours still have a few weird issues but are looking better. let me know your thoughts |
Beta Was this translation helpful? Give feedback.
-
|
Put in PR #222 but i still see similar contour problems - so probably the issue is with the contour tracing method... will have to review that |
Beta Was this translation helpful? Give feedback.
-
|
So now that the contour finding pr is merged, we should move away from using the imageTracer SVG library, because we don't actually use our computed contours for anything... |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @Krasner. Your work on this was great! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently working on #189 (see #219 and the branch). The algorithm is almost complete - I just need to record relationships between contours (hierarchy) and fix the subtle bug below.
For context, I’ve been following the Suzuki and Abe paper on contour tracing. Their algorithm is designed for binary images (pixels are either 0 or 1), but I’ve adapted it to improve performance for Img2Num's use case, which involves non-binary images.
Here’s the current state of the work:
Original input (after K-Means preprocessing):
Contour tracing output (each contour in a distinct color):
As you can see, the contours are roughly correct, but there are small inconsistencies. For example, there are tiny isolated pixels along some borders that shouldn’t be there. Here’s a closer look at one of these regions:
I’ve tried adjusting neighborhood checks and border-following logic, but the issue persists. I suspect it may be related to how I’m handling transitions between regions in non-binary images, but I haven’t been able to pinpoint the exact cause.
I don't think that the preprocessing is the problem, though. The image below shows that there are no strange artifacts in the same region as the above image has.
Other images for context
Original → K-Means → Contour Traced K-Means
Original → K-Means → Contour Traced K-Means
Original → K-Means → Contour Traced K-Means
@Krasner or @hjmillard, do you have any ideas or suggestions related to the contour tracing algorithm choice?
Is the bug likely an artifact of the preprocessing (K-Means clustering) or something inherent in my adaptation of Suzuki and Abe’s border-following approach for multi-valued images?
Beta Was this translation helpful? Give feedback.
All reactions