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

3 visualizzazioni (ultimi 30 giorni)
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);

Risposta accettata

Image Analyst
Image Analyst il 9 Dic 2013
  1 Commento
Anandakumar Selvaraj
Anandakumar Selvaraj il 8 Gen 2014
Modificato: Anandakumar Selvaraj il 8 Gen 2014
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

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by