Ask Your Question

Get skeleton from distance transform

asked 2016-05-31 11:39:30 -0600

manatttta gravatar image

updated 2020-09-17 02:13:28 -0600


I know it is possible to get the skeleton of a shape in an image from either successive morphological operations or distanceTransform. I can do this via morphological operations. But How do I do this via distanceTransform?

Right now I have:

cv::Mat input = (...);
cv::Mat output;

cv::distanceTransform(input, output, ...);

Now, how do I get the skeleton from the image transform in output?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-05-31 17:46:54 -0600

updated 2016-11-25 01:50:34 -0600

i suggest you to use Zhang-Suen thinning algorithm or Guo-Hall thinning algorithm

added by @StevenPuttemans

and if you want an example for that exact thinning at work, take a look here where it is used for fingerprint skeletization.


now cv::ximgproc::thinning (Zhang-Suen algorithm) is in the contrib library.

also take a look at this github repository

edit flag offensive delete link more


@sturkmen Thank you very much, very good algorithm!

manatttta gravatar imagemanatttta ( 2016-06-01 04:06:21 -0600 )edit

ah this reminds me that I should update thinning to contain both systems :D

StevenPuttemans gravatar imageStevenPuttemans ( 2016-11-25 03:58:44 -0600 )edit

Question Tools



Asked: 2016-05-31 11:39:30 -0600

Seen: 2,459 times

Last updated: Nov 25 '16