Wednesday, October 17, 2007

MATLAB: save poistions with mouse-click (ginput)

pt_cam = [];
im1 = imread( 'B7_3.bmp' );
figure(1);imshow(im1);hold on;
im2 = imread( 'map_B7_1.bmp' );
figure(2);imshow(im2);hold on;

figure(1);
[xc,yc,Button] = ginput(1);
plot(xc,yc,'r.','Markersize',15)
figure(2);
[xm,ym,Button] = ginput(1);
plot(xm,ym,'.','Markersize',15)

while Button~=3
pt = [xc yc];
pt_cam = [pt_cam; pt];

figure(1);
[xc,yc,Button] = ginput(1);
plot(xc,yc,'r.','Markersize',15)

if Button==3;
break;
end

figure(2);
[xm,ym,Button] = ginput(1);
plot(xm,ym,'.','Markersize',15)
end



No comments:

Post a Comment