Image processing for determining endpoints on a line
Show older comments
Hello,
I am looking to calculate the distance between endpoints of several skeletonized images. However, at the moment, the bwmorph function identifies endpoints in the skeletonized image that I am not interested in. My code for identifying the endpoints is below, and three examples of BW files are attached in .mat format.
imshow(BW)
BW2 = bwpropfilt(BW, 'perimeter', 1);
skel = bwskel(BW2);
imshow(skel)
[I,J]=find(bwmorph(skel,'endpoints'));
hold on
scatter(J, I)
I want to refine this code so that only the endpoints that I am interested in are identified. The endpoints that I am interested in are the ones at the true ends of the line. An image of the endpoints that are identified for BW_3 with my current code is shown below. As can be seen, far too many endpoints are found.

I have attempted to pass a minimum branch length into the bwskel function but this does not work for all of my images.
Any help with this would be appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Morphological Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!