How can I store x y coordinates of centroids that are found using region props within a loop?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
s = regionprops(L, 'Area', 'Centroid', 'BoundingBox'); % code
I have found these properties using region props.
I need to find a way of storing the x and y coordinates from a loop for use later on and if they can be numbered with the iteration number too would be great.
0 Kommentare
Antworten (1)
Christiaan
am 11 Mär. 2015
Dear Mauricio,
As you stated finds the line (stat = regionprops(I,'centroid');) all the centroids in the image. (here 'I' is the image) Now the values of the centroids are stored in this variable. An example to extract those codes can be:
for i=1:length(stat)
x_centroid(i) = stat(i).Centroid(1);
y_centroid(i) = stat(i).Centroid(2);
end
For more information about plotting the centroids, you coud have a look at a previous post of mine here.
Kind regards, Christiaan
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!