图像运算平移,旋转,切变换

图像运算平移,旋转,切变换_第1张图片


p=imread('lv.jpg');

%水平移动
figure;
s=maketform('affine',[1 0 50;0 1 50;0 0 1]'); %构建maketform结构体
g=imtransform(p,s,'XData',[1 size(p,2)],'YData',[1 size(p,1)],'FillValue',255);
%xdata显示范围,使用255色填充
imshow(g);


%旋转
figure;
x=maketform('affine',[sind(30),-cosd(30),0;cosd(30),sind(30),0;0 0 1]);
%cosd(30)表示30度
g=imtransform(p,x,'FillValue',255);
imshow(g);


%切变换
figure;
x=maketform('affine',[1 .2 0;.2 1 0;0 0 1]);
g=imtransform(p,x,'FillValue',255);
imshow(g);

你可能感兴趣的:(图像运算平移,旋转,切变换)