skeleton extension to object border

5 views (last 30 days)
Hello, I have the edge representation of binary image and it´s skeleton. Skeleton is given by thinning algorithm and so it doesn´t touch the object border, as you can see in the picture attached. What I want to do is also demonstrated in the picture. I need the skeleton (it is supposed to be medial axis) to be from one tip of object border to the opposite. In other words, the end-point of skeleton (object a), marked with green line) is supposed to be connected with tip points of object (object a), marked with orange line). Output should approximately look like object b) (created manually)
In articles, there they do it via extrapolation so I tried polyfit, but I don´t know how to extrapolate it. I tried spline interpolation also. Still I think this is not a good way due to very different orientation of objects. I was thinking about finding the tip point on the border and then connecting skeleton end- point with this tip but I have absolutely no idea how to find the tip coordinates (marked with orange line) :( Does anyone more image processing skilled have an idea?

Accepted Answer

Image Analyst
Image Analyst on 6 Apr 2014
You could get the endpoints with bwmorph() and then find out which of the boundary locations is closest to each endpoint, then use imline() to draw a line and create a mask and then burn it into the image. Or you could extrapolate both x and y and see which boundary point comes closest to a point on the extrapolated line. I attach demos for each method, though they're not exactly that. One is a imline burn-in demo, and one is a general purpose polyfit demo. You'll have to adapt them of course. I'm not doing it for you because I don't have your images, and it would take more than a few minutes, which is about all the free time I have to spend on someone's project. Good luck.

More Answers (1)

Mariana
Mariana on 6 Apr 2014
Image Analyst, thank you very much for your answer! I tried your second suggestion and I think it might work! I didn´t know about linspace for extension of line given by polyval. M.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by