%对图像进行测试,映射变换
%设置图像便笺板
f = checkerboard(10);
figure,imshow(pixeldup(f,8),[]);
s = 0.75;
theta = pi/4;
T = [s*cos(theta) s*sin(theta) 0
-s*sin(theta) s*cos(theta) 0
0 0 1];
tform = maketform('affine',T);
%用反射变换(反射变换比正射变换容易)
g = imtransform(f,tform);
figure,imshow(pixeldup(g,8),[]);
%采用最近邻法(速度加快,但是图像相对会变得模糊一点)
g1 = imtransform(f,tform,'nearest');
figure,imshow(pixeldup(g1,8),[]);
%控制输入区域外的像素颜色(灰色)
g2 = imtransform(f,tform,'FillValue',0.4);
figure,imshow(pixeldup(g2,8),[]);
图像的映射变换(比较邻近法与默认法、改变边界外部颜色)
最新推荐文章于 2023-05-06 18:50:25 发布