skeletonize image until the end of their borders
14 views (last 30 days)
My question is about obtain an skeletonized image which borders would reach to the final of the image.
I am trying to measure the length of a binary image, but because the just-skeletonized image does not reach the borders of the binary image there is omited some part of line, it is incomplete.
I bring images of an example measurement with my program (left) and with ImageJ measure (right)
In the 2014 post of "Skeleton extension to object border", there was talked about that, and was bringed the functions used for obtain the distance, which was bwmorph() for obtain the endpoints of the skeletonized image, and then I think with find() or similar obtain the perimetral points of the binary image and draw a line to the shortest point.
I would like to ask about some fashion function or method for obtain that line and distance, because with the method described below we could obtain the line, but not the orientation of that so that if we want to we would have to draw it in a random way.
Thank you very much
Matt J on 6 Sep 2021
Edited: Matt J on 6 Sep 2021
I don't think it makes sense to measure line length by counting up individual pixels. What you should probably do is fit a continuous line segment to the pixelated line (non-skeletonized). Then, calculate the length of the continuous line segment. This is something you can do very easily by using linear2dFit() in this package:
See Fitting a 2D Line Segment in the Examples tab.
Image Analyst on 6 Sep 2021
As you know the skeleton for an arbitrary blob shaped region is not always what you might expect. For example, the skeleton for a long skinny rectangle is the shape of 2 Y's with their bottoms touching. That's because it's basically the locus of largest circles you can fit at any point inside. And you can see why the skeleton for a rectangle splits and heads towards the corners. That said, you can try bwmorph('skel') and bwskel(). I think they do it in different ways. I'm attaching all my skeleton demos in case they might help.
Beyond that we'd need to know WHY you think you need the length of the blob, and why you think you need it out to some ill-defined endpoint.
You might also want to check out bwferet().