what is the right method to calculate branch length
8 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
1st of all i know that there are some post on the related subject, but i looked them up and i didn't find any explanation about the right and true method which relevant to my case.
let me describe to you my conflict,
i am having this image:
this is a skeleton branch. i would like to calculate the length of the branch and i tried several methods. but i get different results for each method and i would like to know why and what is the correct method to calculate the length. On the 1st method i use the function bwconncomp which return structure and the length located under the .PixelIdxList field, by applying this method i'm getting the result of 74 (pixel's i assuming) On the 2nd method i use the function regionprops in that way:
if my image called vessel_3 :
perim = regionprops(vessel_3,'Perimeter');
perim = perim.Perimeter/2
and this is the result: 88.3259
i got the 2nd method from this post: http://blogs.mathworks.com/pick/2012/04/27/calculating-arclengths-made-easy/#respond
now i didn't able to understand how the perimeter option of regionprops func works on branch object with 1's pixel thickness. i looked up in the help of the func and the author gave example of large object. does the function add more pixels of 1's values around the object and that could explain the difference between my results?
Thanks again!
could someone explain me what is the right method and how
0 个评论
回答(1 个)
Image Analyst
2014-4-7
It depends on what you define as length. If you have two pixels in this configuration
0 1
1 0
What's the length? Square root of 2 pixels long? Or 2 pixels long?
2 个评论
Image Analyst
2014-4-7
Neither is right or wrong. It's just two different ways of considering it. You can go by pixel counting if you want, or use the "pixel center - to - pixel center" method. If you want to do pixel counting you can do
theArea = sum(binaryImage(:));
if there is just one object in the binary image, or if there are more than one:
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Area');
allAreas = [measurements.Area];
The areas of skeletons will be their length via pixel counting.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!