img = imread(‘samplepics/6.jpg’);
imshow(img)
[X,Y]=ginput(4);
X2=[X(1:2);X(1:2)];
Y2=[Y(1);Y(1);Y(3)+40;Y(3)+40];
tform=maketform(‘projective’,[X,Y],[X2,Y2]);
img_out=imtransform(img,tform,‘bicubic’);
imshow(img_out)
依次取点4个
结果如下
img = imread(‘samplepics/6.jpg’);
imshow(img)
[X,Y]=ginput(4);
X2=[X(1:2);X(1:2)];
Y2=[Y(1);Y(1);Y(3)+40;Y(3)+40];
tform=maketform(‘projective’,[X,Y],[X2,Y2]);
img_out=imtransform(img,tform,‘bicubic’);
imshow(img_out)
依次取点4个
结果如下