数字图像处理实验指导书实验一常用的图像文件格式与格式转换和图像矩阵的显示方法一、实验目的1、熟悉Matlab语言的初步使用;2、熟悉常用的图像文件格式与格式转换;3、熟悉图像矩阵的显示方法(灰度、索引、黑白、彩色);4、熟悉图像矩阵的格式转换二、实验内容:练习图像读写命令imread和imwrite并进行图像文件格式间的转换。特别是索引图像与1,4,8,16比特图像的存储与转换。熟悉下列模块函数ImagefileI/O.imread-Readimagefile.imwrite-Writeimagefile.Imagedisplay.colorbar-Displaycolorbar.getimage-Getimagedatafromaxes.image-Createanddisplayimageobject.imagesc-Scaledataanddisplayasimage.immovie-Makemoviefrommultiframeindexedimage.imshow-Displayimage.subimage-Displaymultipleimagesinsinglefigure.truesize-Adjustdisplaysizeofimage.warp-Displayimageastexture-mappedsurface.zoom-Zoominandoutofimageor2-Dplot.三、实验步骤Loadcameraman.tifimagefromyourharddisk(usingfunctionimread).imread('cameraman.tif')b.Showtheimageinafigurewindow(usingfunctionimageorimshow).imshow('cameraman.tif')c.Drawabrightnessbarontherightsideoftheimage(usingfunctioncolorbar).Colorbard.Getimagedatafromthecurrentfigure(axes)(usingfunctiongetimage).a=getimagee.Showthegrayleveloftheimagebetween64to128(usingfunctionimagesc).clims=[64,128]imagesc(a,clims)f.Makeamoviefroma4-Dimage(loadmri,makethemoviebyimmovie,thenshowmoviebyfunctionmovie).loadmrimov=immovie(D,map)movie(mov,4)g.Drawthecameramanimageonacylinder(usingfunctionwarp).[x,y,z]=cylinderwarp(x,y,z,a)warp(x,y,-z,a)实验三图像增强及编程处理一、实验目的观察数字图像增强的效果;熟悉数字图像增强的一般方法;掌握数字图像增强的一般方法的Matlab编程实现。二、实验内容:使用Photoshop观察数字图像增强的效果;练习和掌握图像增强的Matlab编程。。熟悉下列模块函数Imageenhancement.histeq-Readimagefile.imadust-Adustimaeintensityvaluesorcolormap.Imagenoising.imnoise-Addnoisetoanimage.Imagefilteringmedfilt2-Perform2-Dmedianfiltering.ordfilt2-Perform2-Dorder-statisticfiltering.wiener2-Perform2-Dadaptivenoise-removalfiltering.实验步骤1使用Photoshop观察数字图像增强的效果a.对比度增强1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整子菜单中选亮度/对比度项,调节对比度滑块,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。b.灰度变换1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整子菜单中选反相项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。5)画出灰度变换曲线。6)在编辑菜单中选返回项,恢复原始图像。7)在图像菜单调整子菜单中阈值项,调节阈值色阶滑块,观察图像变化。8)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。9)画出灰度变换曲线。c.直方图均衡化1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整子菜单中选色调均化项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。d.图像平滑1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在滤镜菜单模糊子菜单中选进一步模糊项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。5)在编辑菜单中选返回项,恢复原始图像。6)在滤镜菜单模糊子菜单中选高斯模糊项,观察图像变化。7)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。8)在MatlabHelp菜单中,选Demos项。9)打开Toolboxes\ImageProcessing项,选NoiseReductionFiltering,并运行。10)选图像Blood、噪声类型Salt&Pepper、滤波器类型Median、邻域3x3,比较原始图像、受噪声污染图像、滤波后图像。11)改变参数,重做(10)。12)选其他图像,重做(10)-(11)。13)思考何种滤波器对抑制何种类型噪声更有效,邻域大小对抑制噪声效果及图像模糊程度的影响。2图像增强的Matlab编程a.Loadcameraman.tifimagefromyourharddisk(usingfunctionimread).b.Showtheimageinafigurewindow.c.Showthehistogramoftheimage(usingfunctionimhist).d.Enhancethecontrastoftheimageusinghistogramequalization.e.Showthehistogramoftheimageafterprocessing.f.Comparethequalitiesoftwoimagesandmakesadiscussionaboutthem.g.Addnoises,suchasgaussian,salt&pepper,specklenoiseintotheimagerespectively.ComparewiththeinfluenceofthedifferentMeansandVariance.h.Removetheaddednoisefromtheimagebyfunctionmedfilt2,ordfilt2andwiener2respectively.Comparethequalitiesoftheoriginalimageswiththeprocessedimagesanddiscusstheeffectofthemethods.I=imread('cameraman.tif')J=histeq(I)imshow(I)imshow(J)subplot(2,2,1)imhist(I)subplot(2,2,2)imhist(J)K=imadjust(I,[.2.3],[.4.5],[])subplot(2,2,3)imshow(I)subplot(2,2,4)imshow(K)I=imread('cameraman.tif')J=imnoise(I,'salt&pepper',0.02)K=imnoise(I,'speckle',0.04)L=imnoise(I,'poisson')subplot(2,2,1)imshow(I)subplot(2,2,2)imshow(J)subplot(2,2,3)imshow(K)subplot(2,2,4)imshow(L)I=imread('cameraman.tif')J=imnoise(I,'salt&pepper',0.02)K=medfilt2(J)L=ordfilt2(J,1,ones(3,3))subplot(2,2,1)imshow(I)subplot(2,2,2)imshow(J)subplot(2,2,3)imshow(K)subplot(2,2,4)imshow(L)