[x,y,button] = ginput(…)
x,y 坐标
button 1左2中3右
ginput(…)次数
clear;
clc;
w0(1000,1000,3)=255;
w0(:,:,:)=255;
imshow(w0);
[x1,y1,button] = ginput(1);
x1 = ceil(x1);
y1 = ceil(y1);
text(x1,y1,'*');
while(1)
[x2,y2,button] = ginput(1);
if button==3
break;
end
x2 = ceil(x2);
y2 = ceil(y2);
text(x2,y2,'*');
line([x1,x2],[y1,y2],'Color','red');
x1 = x2;
y1 = y2;
end
右键或删除窗可停止运行