07-27-2018 05:53 AM
Hi All,
What is the best way to extract the center line of a solid thick line?
The image is a binary one. And I'd like to get the dotted line as shown in the image.
Thank you.
07-27-2018 07:22 AM
(1) Smoothen the contours of the lines to make the following steps easier. You can use IMAQ Morphology (AutoMedian) for that, for more extreme cases I like using FFT and truncating the high frequencies (maybe a bit dampened to avoid ringing)
(2) Skeletonization. You could use IMAQ Skeleton (Skeleton L) for that if your particles are small enough , but to be frank, the algorithm sucks. It is based on thinning, super-slow, and has issues with overflows if the particles get large. I prefer using a watershed-based skeleton for that (Invert the image, use IMAQ Daniellson, apply IMAQ Watershed, IMAQ Modulo with the inverted image). That's muuch faster and bug-free.
(3) Prune the skeleton. Remove all but the super long leaves.
Done.