Extract y coordinates of centriod of an image

I have found the x and y co-ordinates of centroid of an image. I need to extract only the y-axis value and plot it against x=1:1:10. How can I extract the why axis value?
Code to find the centroid is in the comment below. Thanks

1 Kommentar

I1 = imread('images\imgc1.jpg');
Ibw = im2bw(I1);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat1 = regionprops(~Ilabel,'centroid');
imshow(I1); hold on;
for x = 1: numel(stat1)
plot(stat1(x).Centroid(1),stat1(x).Centroid(2),'ro');
end
The variable 'stat' contains the values of xy axis of centroid. I only need the y axis value.
Typing stat(2) does not help.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Image Analyst
Image Analyst am 15 Nov. 2014

0 Stimmen

The y value for index x is stat1(x).Centroid(2).

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by