Need guidance for boundary distance determination in a image.
3 views (last 30 days)
Show older comments
Hey guys,
Hoping to get some guidance on determination of boundaries distances from a known center of the image. I've attached the image below. This is a binary image of angiogenesis from a bead and I need to calculate the length of the various arms sprouting out and label them. Any suggestions on how to go about doing this? Thank you!
0 Comments
Answers (2)
Jyotish Robin
on 2 Aug 2016
My understanding is that you are trying to find the distance of boundary points from a known center in an image.
I assume that you do not want to take into account the outlying white pixels (those disconnected from the main white body) in the image. So after you get rid of these outliers (by performing some kind of low pass filtering), you can try to calculate the length of various arms sprouting.
For this , you can make use of the MATLAB function "bwboundaries". The following link will be useful to know more about this function. http://in.mathworks.com/help/images/ref/bwboundaries.html.
Hope this helps.
0 Comments
Image Analyst
on 2 Aug 2016
Edited: Image Analyst
on 2 Aug 2016
Try this:
labeledImage = bwlabel(binaryImage);
props = regionprops(binaryImage, 'Centroid');
allCentroids = [props.Centroid];
xCentroids = allCentroid(1:2:end);
yCentroids = allCentroids(2:2:end);
% Note, I'm not 100% sure the indexes from regionprops and bwboundaries match up and always both refer to the same blob, so check up on that.
boundaries = bwboundaries(binaryImage);
numberOfBoundaries = size(boundaries, 1);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
x = thisBoundary(:,2);
y = thisBoundary(:,1);
plot(x, y, 'r-', 'LineWidth', 2);
theseDistances{k} = sqrt((x-xCentroids(k)).^2 + (y-yCentroid(k)).^2);
end
hold off;
You might also be interested in the attached demo to find the farthest points on a boundary, and to find extremities. If your shapes to not have any flat sides, you might also be able to find extremities by finding out where the convex hull is on the perimeter, though this is not foolproof or super robust.
0 Comments
See Also
Categories
Find more on Image Processing and Computer Vision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!