has anyone an idea how to do something like a topological skeleton (Topological skeleton - Wikipedia) with vvvv? The idea is to basically get a vector skeleton for any binary image. This could be very useful for character recognition, hand detection, optical finger tracking, … actually, I can think of a lot of nice things with this - just imagine using $P recognizer with the cleaned topological skeleton and you immediately have a very powerful shape recognition and tracking engine.
I thought that maybe the way to go is using OpenCV, but I really have no experience using that. So, Elliot, vux, anybody, any idea how to do that, or is it already somewhere and I just didn’t find it?
Part 1 : Convert your image into a signed distance field (opencv has distance transform, but i dont remember if it’s signed or unsigned). It’s pretty easy to do anyway. Roughly you do threshold (white = inside, black = outside), edge detection, then do a neighbour scan to propagate distance (keep the first image to have the sign).
Part 2 : To find ridges, you do a neighbour scan again, and can extract pixels where you have “lowest value”. for example, if a line is like:
-4, -5, -4, -3, -2, -3, -2 you need to extract element 2 (-5) and element 6 (-3) .
Convert that ridge again into a binary image (which can actually done while building the ridge.
Part 3 : extract the ridge elements and build segments from it (not sure if cvContour would work, worth a try. Use few simplifications to filter data a bit more.
Hope than makes bit of sense, I’ll do a few pictures if needed ))
Thanks, vux. I’m not directly needing the functionality right now, otherwise I would surely try to build something myself - but I thought it would be a great functionality to have for a lot of custom detection stuff, so I decided to throw it at you dev gods to see what happens :). Maybe if you find the time at some point to do a help patch with it, that would be great.