《数 字 图 像 处 理.ppt》由会员分享,可在线阅读,更多相关《数 字 图 像 处 理.ppt(13页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、数数 字字 图图 像像 处处 理理实实 验验 指指 导导 书书实验一实验一 常用的图像文件格式与格式转换和图像矩阵的显示方法常用的图像文件格式与格式转换和图像矩阵的显示方法 一、实验目的一、实验目的1、熟悉Matlab语言的初步使用;2、熟悉常用的图像文件格式与格式转换;3、熟悉图像矩阵的显示方法(灰度、索引、黑白、彩色);4、熟悉图像矩阵的格式转换二、实验内容:练习图像读写命令imread和imwrite并进行图像文件格式间的转换。特别是索引图像与1,4,8,16比特图像的存储与转换。熟悉下列模块函数Image file I/O.imread -Read image file.imwrite
2、 -Write image file.Image display.colorbar -Display colorbar.getimage -Get image data from axes.image -Create and display image object.imagesc -Scale data and display as image.immovie -Make movie from multiframe indexed image.imshow -Display image.subimage -Display multiple images in single figure.tr
3、uesize -Adjust display size of image.warp -Display image as texture-mapped surface.zoom -Zoom in and out of image or 2-D plot.三、实验步骤三、实验步骤 Load cameraman.tif image from your hard disk(using function imread).imread(cameraman.tif)b.Show the image in a figure window(using function image or imshow).imsh
4、ow(cameraman.tif)c.Draw a brightness bar on the right side of the image(using function colorbar).Colorbard.Get image data from the current figure(axes)(using function getimage).a=getimagee.Show the gray level of the image between 64 to 128(using function imagesc).clims=64,128 imagesc(a,clims)f.Make
5、a movie from a 4-D image(load mri,make the movie by immovie,then show movie by function movie).load mrimov=immovie(D,map)movie(mov,4)g.Draw the cameraman image on a cylinder(using function warp).x,y,z=cylinderwarp(x,y,z,a)warp(x,y,-z,a)实验三实验三 图像增强及编程处理图像增强及编程处理一、实验目的一、实验目的 观察数字图像增强的效果;熟悉数字图像增强的一般方法;
6、掌握数字图像增强的一般方法的Matlab编程实现。二、实验内容:使用Photoshop观察数字图像增强的效果;练习和掌握图像增强的Matlab编程。熟悉下列模块函数Image enhancement.histeq -Read image file.imadust -Adust imae intensity values or colormap.Image noising.imnoise -Add noise to an image.Image filtering medfilt2 -Perform 2-D median filtering.ordfilt2 -Perform 2-D order
7、-statistic filtering.wiener2 -Perform 2-D adaptive noise-removal filtering.实验步骤 使用Photoshop观察数字图像增强的效果a.对比度增强1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整子菜单中选亮度/对比度项,调节对比度滑块,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。b.灰度变换1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整
8、子菜单中选反相项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。5)画出灰度变换曲线。6)在编辑菜单中选返回项,恢复原始图像。7)在图像菜单调整子菜单中阈值项,调节阈值色阶滑块,观察图像变化。8)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。9)画出灰度变换曲线。c.直方图均衡化1)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在图像菜单调整子菜单中选色调均化项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。d.图像平滑1
9、)在Photoshop中打开一黑白灰度图像文件。2)在图像菜单中选直方图项,观察原始图像的直方图。3)在滤镜菜单模糊子菜单中选进一步模糊项,观察图像变化。4)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。5)在编辑菜单中选返回项,恢复原始图像。6)在滤镜菜单模糊子菜单中选高斯模糊项,观察图像变化。7)在图像菜单中选直方图项,观察处理后图像的直方图,并同(2)中的直方图比较。8)在Matlab Help菜单中,选Demos项。9)打开ToolboxesImage Processing项,选Noise Reduction Filtering,并运行。10)选图像Bloo
10、d、噪声类型Salt&Pepper、滤波器类型Median、邻域3x3,比较原始图像、受噪声污染图像、滤波后图像。11)改变参数,重做(10)。12)选其他图像,重做(10)-(11)。13)思考何种滤波器对抑制何种类型噪声更有效,邻域大小对抑制噪声效果及图像模糊程度的影响。图像增强的Matlab编程a.Load cameraman.tif image from your hard disk(using function imread).b.Show the image in a figure window.c.Show the histogram of the image(using fun
11、ction imhist).d.Enhance the contrast of the image using histogram equalization.e.Show the histogram of the image after processing.f.Compare the qualities of two images and makes a discussion about them.g.Add noises,such as gaussian,salt&pepper,speckle noise into the image respectively.Compare with t
12、he influence of the different Means and Variance.h.Remove the added noise from the image by function medfilt2,ordfilt2 and wiener2 respectively.Compare the qualities of the original images with the processed images and discuss the effect of the methods.I=imread(cameraman.tif)J=histeq(I)imshow(I)imsh
13、ow(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)
限制150内