资源描述:
《实验二图像的几何变换》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、实验二图像的几何变换一・实验目的及要求掌握图像几何变换的基本原理,熟练掌握数字图像的缩放、旋转、平移、镜像和转置的基本原理及其MATLAB编程实现方法。二、实验内容(一)分析下面程序功能;输入执行各命令行,认真观察命令执行的结果。熟悉程序屮所使用函数的调用方法,改变有关参数,观察试验结果。1.图像缩放clearall,closeallI=imread(fmoon.tif);Scale=1.35;JI=imresize(I,Scale,Nearest1);J2=imresize(I,Scale,'bilinear');imshow(I),titleC'OriginalImage1);figur
2、e,imshow(Jl),title(fResizedImage—usingthenearestneighborinterpolationfigure,imshow(J2),title「ResizedImage—usingthebilinearinterpolation');helpimresizeFileVimlaisTmI*X<1>□ja⑪•.y・ao□nOn9va<*ni9»UurtT«3、ze(I,Scale,'nearest');J2=imresize(I,Scale,bilinear*);imshow(I),title(,OriginalImage1);figure,imshow(Jl),title('ResizedImage—usingthenearestneighborinterpolation');figure,imshow(J2),title('ResizedImage—usingthebilinearinterpolationJ;helpimresize1.图像旋转clearall,closeallI=imreadC^cameraman.tif);Theta=4
4、5;J1=imrotate(I,Theta,'nearest1);Theta=-45;J2=imrotate(I,Theta,'bilinear;'crop');imshow(I),title('OriginalImage1);figure,imshow(Jl),ti(le('RotatedImage-・usingthenearestneighborinterpolationr);figure,imshow(J2),titledRotatedImage—usingthebilinearinteipolation');helpimrotater»cw«9qjg»Fil*MitVtw!bmtiT
5、mHV»MmH«:>F*UfiatVl»»lateetTmU,•*«>N«l»File!416、1);figure,imshow(Jl),title(fRotatedImage—usingthenearestneighborinterpolation);figure,imshow(J2),titledRotatedImage—usingthebilinearinterpolation');helpimrotatel•iare»d(caa«:l..tiDTWett・4t.fia2.图像水平镜象clearall,closeallI=imreadC'cameraman.tif);II=flipdim(I,2);12=flipdim(I,l);figure(l),subplot(121),im
7、show(I);subplot(1,2,2),imshow(ll);figure(2),subplot(2丄1),imshow(I);subplot(2丄2),imshow(12);(二)自主动手模块用MATLAB编程实现以下图像几何变换:1.图像平移程序如下:(三)自主动手模块用MATLAB编程实现以下图像儿何变换:1.图像平移程序如下:clearall,closeallimori=imread(1C:U