Extract y coordinates of centriod of an image

1 view (last 30 days)
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 Comment
Hamza Ahmed
Hamza Ahmed on 15 Nov 2014
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.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 15 Nov 2014
The y value for index x is stat1(x).Centroid(2).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!