how to locate blobs upper middle and lower middle points and plot it

1 次查看(过去 30 天)
i am trying to locate points like it shows in the figure 4 below were the centroid i have marked as shown in figure 2 from the binary image now i have to mark upper lower and left and right boundry point as in fig 4 ..any one help me
I have marked the centroid of the blob using
s = regionprops(binaryImage, 'centroid');
centroids = cat(1, s.Centroid);
imshow(binaryImage);
hold(imgca,'on');
plot(imgca,centroids(:,1), centroids(:,2), ...
'r*','MarkerSize', 10, 'LineWidth', 3);

采纳的回答

Image Analyst
Image Analyst 2013-12-9
  1 个评论
Anandakumar Selvaraj
编辑:Anandakumar Selvaraj 2014-1-8
The answer to my question is already answered by Image Analyst in Ths Post
centroidColumn = int32(centroid(1)); % "X" value
centroidRow = int32(centroid(2)); "Y" value.
Then extract a row or column and use find to find the first and last element that's set:
middleColumn = binaryImage(:, centroidColumn);
topRowY = find(middleColumn, 1, 'first'); % Find top.
bottomRowY = find(middleColumn, 1, 'last'); % Find bottom.
middleRow = binaryImage(centroidRow, :);
leftColumnX = find(middleRow, 1, 'first'); % Find left.
rightColumnX= find(middleRow, 1, 'last'); % Find right.
so i am accepting his above answer

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by