How can I store x y coordinates of centroids that are found using region props within a loop?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Christiaan
2015 年 3 月 11 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!