1 cl; 2 w=0.6; %放大或缩小的宽度 3 h=1.4; %放大或缩小的高度 4 img=imread('Corner.png'); 5 imshow(img); 6 [m n]=size(img); 7 imgn=zeros(h*m,w*n); 8 9 rot=[h 0 0;0 w 0;0 0 1]; %变换矩阵x=h*u,y=w*v 10 inv_rot=inv(rot); 11 12 for x=1:h*m 13 for y=1:w*n 14 pix=[x y 1]*inv_rot; 15 imgn(x,y)=img(round(pix(1)),round(pix(2))); 16 end 17 end 18 19 figure,imshow(uint8(imgn))