1.前言:
刚性变换:平移+旋转发生改变,而形状不变。
非刚性变换(non-rigid deformation):斜切、扭曲、透视
2.图像(2D)到图像(2D)的四种变换:等距变换,相似变换,仿射变换,投影变换,对比图表如下:
基于不同变换的结果示意图如下:
程序(Matlab):
%%图像变换
clear;close all;clc
I=imread('cameraman.tif');
figure,
imshow(I),title('原始图像');
d=imdistline;
[w,h]=size(I);
theta=pi/4;%旋转角
t=[200,80];%平移tx,ty
s=0.3;%缩放尺度
% 等距变换=平移变换+旋转变换
H_e=projective2d([cos(theta) sin(theta) t(1);
-sin(theta) cos(theta) t(2);
0 0 1]');
I_e=imwarp(I,H_e);
subplot(221),imshow(I_e),title('等距变换');
d=imdistline;
%相似变换=等距变换+均匀缩放
H_s=projective2d([s*cos(theta) s*sin(theta) t(1);
-s*sin(theta) s*cos(theta) t(2);
0 0 1]');
I_s=imwarp(I,H_s);
subplot(222),imshow(I_s),title('相似变换');
d=imdistline;
%仿射变换=平移变换+非均匀变换
H_a=projective2d([1 0.5 t(1);
0 0.5 t(2);
0 0 1]');
I_a=imwarp(I,H_a);
subplot(223),imshow(I_a),title('仿射变换');
%投影变换=
H_P=projective2d([0.765,-0.122,-0.0002;
-0.174,0.916,9.050e-05;
105.018,123.780,1]);
I_P=imwarp(I,H_P);
subplot(224),,imshow(I_P),title('投影变换');
参考链接:
https://blog.youkuaiyun.com/KinboSong/article/details/64923831
https://blog.youkuaiyun.com/u014096352/article/details/53526747
http://blog.sina.com.cn/s/blog_7ceb2d560102w5se.html
https://blog.youkuaiyun.com/u012590570/article/details/51355600