怎么用matlab读图片的坐标的程序!!谢谢

2024-12-17 12:53:12
推荐回答(1个)
回答1:

%%%%%%%plot里面的不就是坐标吗?
clear;clc
BW1=imread('1.gif');
BW1=~im2bw(BW1);
imshow(BW1);
BW1=bwareaopen(BW1,100);
[L,M]=bwlabel(BW1);
status=regionprops(L,'ALL');
area=zeros(1,M);
for i=1:M
area(i)=status(i).Area;
end
[B,IX]=sort(area,'ascend');
Cc1=status(IX(1)).Centroid;
Cc2=status(IX(2)).Centroid;
hold on
plot(Cc1(1),Cc1(2),'R+');plot(Cc2(1),Cc2(2),'R+');
Ccx=(Cc1(1)+Cc2(1))/2;
Ccy=(Cc1(2)+Cc2(2))/2;
plot(Ccx,Ccy,'R+');