Plot endpoints of skeleton inside each regionprops boundingbox

2 views (last 30 days)
I have a skeleton image of multiple detected boundingbox from regionprops. I want to measure the Euclidean distance from endpoint to endpoint of that particular skeleton inside the bbox. When I tried the bwmorph(skelimg, 'endpoint); I get different result. It measures endpoint from one skeleton to another which is not what I want.
Please help, thank you.
This is my current result: The endpoint:
What I want:
My code:
infor = regionprops(skelimg, 'Area', 'BoundingBox', 'Centroid');
% stats = regionprops(skelimg, 'area');
blobareas = [infor.Area];
fprintf('%3d: %5d\n', [1 : length(blobareas); blobareas]);
hold on;
for k = 1 : length(infor)
BB = infor(k).BoundingBox;
area = infor(k).Area;
rectangle('Position', [BB(1),BB(2),BB(3),BB(4)],'EdgeColor','r','LineWidth',2) ;
End_p = bwmorph(skelimg,'endpoints');
[row,column] = find(End_p);
End_pts = [row column];

Answers (0)

Community Treasure Hunt

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

Start Hunting!