Extract y coordinates of centriod of an image

조회 수: 3 (최근 30일)
Hamza Ahmed
Hamza Ahmed 2014년 11월 15일
댓글: Hamza Ahmed 2014년 11월 15일
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
Hamza Ahmed
Hamza Ahmed 2014년 11월 15일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2014년 11월 15일
The y value for index x is stat1(x).Centroid(2).

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by