ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract Solid Line Center

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. Example.png

 

Thank you. 

0 Kudos
Message 1 of 2
(2,470 Views)

(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. 

0 Kudos
Message 2 of 2
(2,452 Views)