您的位置:首页 > 其它

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

2015-10-20 15:13 281 查看


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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: