Image-Py / sknw

build net work from skeleton image (2D-3D)
BSD 3-Clause "New" or "Revised" License
224 stars 48 forks source link

Missing small edges #7

Closed drStacky closed 4 years ago

drStacky commented 4 years ago

Small edges in the skeleton (2px) are being omitted from the graph. I understand that you have a way to mark pixels with 0, 1, 2 to determine nodes in the graph so that you're not just connecting every pixel to its neighbor (or you'd get loops/triangles at intersections in the skeleton), but I think as a result of that, the short segments are getting lost.

Here's an example where the skeleton is in white, and the edges are red. Screen Shot 2020-05-20 at 8 06 31 AM

yxdragon commented 4 years ago

not missing, just did not draw. for I just draw the path, (did not contain the node point) so the one pixel path could not be drawn by plt.plot

I will add the node point in the path later.

yxdragon commented 4 years ago

now it is ok, and I add a demo in the sknw.py 's main: image

I split the mark_node method, you can use sknw.mark_mode(ske_img) to got the result.

drStacky commented 4 years ago

It wasn't just an issue with how it was being displayed. The edges were not showing up in my graph. It looks like you changed something in the trace function that fixed it, though, so thank you.

Here are results from an application I'm working on with sknw pre-commit (red) and post-commit (green). There is some smoothing of edges, which is why they don't line up perfectly. Nothing else was changed. Screen Shot 2020-05-22 at 8 16 12 AM

drStacky commented 4 years ago

P.S. Thank you for writing this library and responding quickly to this issue. It has been very helpful.