cl;
w=0.7; %放大或缩小的宽度
h=1.5; %放大或缩小的高度
img=imread('Corner.png');
imshow(img);
[m n]=size(img);
imgn=zeros(h*m,w*n);

rot=[h 0 0;0 w 0;0 0 1]; %变换矩阵x=h*u,y=w*v
for u=1:m
for v=1:n
pix=[u v 1]*rot;
if (pix(1)>=0.5 && pix(2)>=0.5) %matlab没有(0,0)这样的元素
%操作要取得的是整数,没听说过小数坐标吧.
imgn(round(pix(1)),round(pix(2)))=img(u,v); %放大还没有进行插值,缩小不用插值
end
end
end

figure,imshow(uint8(imgn))

相关文章:

  • 2022-03-08
  • 2022-01-02
  • 2022-12-23
  • 2021-11-14
  • 2022-12-23
  • 2021-06-17
  • 2021-06-17
猜你喜欢
  • 2021-06-16
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2021-04-05
相关资源
相似解决方案