计算机图像处理实验七:图像几何变换技术(MATLAB)
【实验名称】
图像几何变换技术
【实验目的】
1、通过本次实验掌握图像几何变换技术;
2、熟悉使用MATLAB库函数imresize、imrotate;
【实验内容】
*图1
【实验代码】
题1
clc;clear all;
figure;
img=imread('实验7图片.png');
imshow(img);
title('原图');
% 尺寸缩放
%缩小到原来的0.5倍
img1=imresize(img,0.5);
figure;
imshow(img1);
title('缩小0.5倍之后的图像');
% 图片旋转
img2=imrotate(img,-30,'bilinear','crop');
figure;
imshow(img2);
title('旋转后的图像');
题2
clc;clear all;close all;
I=imread('实验7图片.png');
[m,n,k]=size(I);
tx=120;
ty=250;
ax=10;
ay=15;
for i=1:m
for j=1:n
x1=i+ax*sin(2*pi*j/tx);
y1=j+ay*sin(2*pi*i/ty);
i2=round(x1);
j2=round(y1);
if(j2<=n)&&(j2>=1)&&(i2<=m)&&(i2>=1);
I4(i,j,:)=I(i2,j2,:);
else
I4(i,j,:)=I(1,1,:);
end
end
end
figure
imshow(I);
title('原图');
figure
imshow(I4);
title('波动变换后图像');
【运行结果】
题1
题2
还没有评论,来说两句吧...