skeleton-tracing
skeleton-tracing copied to clipboard
Large image with thin lines, all black.
Hello LingDong-,
I'm amazed by the speed of this algorithm. Great work! One issue I encountered is that for large images with quite thin white lines, I end up with no vectors at all. I used csize=1 and many iterations, but to no avail.
Could you help me with that?
Thanks, Frank
UPDATE: The algorithm seems to be non-robust against "artifacts". For reference, this is the image: https://gyazo.com/c11c5dabd97d81b70283cec449a78177 If you remove the artifacts on the right, it works. If you don't, all black.
Hi @fgabel
Thanks for the issue. What language port are you using? I just tested your image in Java and Python(swig) ports, and it seems to be working just fine with the "artifacts":
This was the python two-liner I used to make the above svg:
im = cv2.imread("input.png")
open('output.svg','w').write(
f'<svg xmlns="http://www.w3.org/2000/svg" width="{im.shape[1]}" height="{im.shape[0]}"><path stroke="red" fill="none" d="'+" ".join(
["M"+" ".join([f'{x[0]},{x[1]}' for x in y]) for y in trace_skeleton.from_numpy(im)]
)+'"/></svg>')
Hello LingDong-,
Thanks for your answer. I was actually using the Python (swig) implementation as well, but apparently the issue is on my side if it works for you just fine. I'll investigate and report my findings soon.