# Need guidance for boundary distance determination in a image.

5 ビュー (過去 30 日間)
Rahim 2016 年 6 月 14 日

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!

サインインしてコメントする。

### 回答 (2 件)

Jyotish Robin 2016 年 8 月 2 日
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 件のコメント表示非表示 -1 件の古いコメント

サインインしてコメントする。

Image Analyst 2016 年 8 月 2 日

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.

サインインしてコメントする。

### カテゴリ

Find more on Object Analysis 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!

Translated by