skeleton-tracing icon indicating copy to clipboard operation
skeleton-tracing copied to clipboard

Large image with thin lines, all black.

Open fgabel opened this issue 3 years ago • 2 comments

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.

fgabel avatar May 06 '21 10:05 fgabel

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>')

LingDong- avatar May 06 '21 19:05 LingDong-

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.

fgabel avatar May 07 '21 22:05 fgabel