收藏 分销(赏)

数字图像处理实验报告——图像复原实验.doc

上传人:仙人****88 文档编号:11858686 上传时间:2025-08-15 格式:DOC 页数:17 大小:920.54KB 下载积分:10 金币
下载 相关 举报
数字图像处理实验报告——图像复原实验.doc_第1页
第1页 / 共17页
数字图像处理实验报告——图像复原实验.doc_第2页
第2页 / 共17页


点击查看更多>>
资源描述
实 验 报 告 课程名称 数字图像处理导论 专业班级 _______________ 姓 名 _______________ 学 号 _______________ 电气与信息学院 和谐 勤奋 求是 创新 实验题目 图像复原实验-空域滤波复原 实验室 DSP室&信号室 实验时间 2015 年 10月 13 日 实验类别 设计 同组人数 2 成 绩 指导教师签字: 一.实验目的 1. 掌握图像滤波的基本定义及目的。 2. 理解空间域滤波的基本原理及方法。 3. 掌握进行图像的空域滤波的方法。 二.实验内容 1. 读出eight.tif这幅图像,给这幅图像分别加入椒盐噪声和高斯噪声后并与前一张图显示在同一图像窗口中。 2. 对加入噪声图像选用不同的平滑(低通)模板做运算,对比不同模板所形成的效果,要求在同一窗口中显示。 3. 使用函数imfilter时,分别采用不同的填充方法(或边界选项,如零填充、’replicate’、’symmetric’、’circular’)进行低通滤波,显示处理后的图像。 4. 运用for循环,将加有椒盐噪声的图像进行10次,20次均值滤波,查看其特点,显示均值处理后的图像(提示:利用fspecial函数的’average’类型生成均值滤波器)。 5. 对加入椒盐噪声的图像分别采用均值滤波法,和中值滤波法对有噪声的图像做处理,要求在同一窗口中显示结果。 6. 自己设计平滑空间滤波器,并将其对噪声图像进行处理,显示处理后的图像。 三.实验具体实现 1. 读出(自己选定.tif)这幅图像,给这幅图像分别加入椒盐噪声和高斯噪声后并与前一张图显示在同一图像窗口中。 I=imread('trees.tif'); subplot(1,3,1) imshow(I); title(' Original Image '); J = imnoise(I,'salt & pepper',0.05); %noise density=0.05 subplot(1,3,2) imshow(J); title(' salt & pepper '); K= imnoise(I,'gaussian',0.01,0.01); subplot(1,3,3) imshow(K); title(' gaussian ') 2. 对加入噪声图像选用不同的平滑(低通)模板做运算,对比不同模板所形成的效果,要求在同一窗口中显示。 I=imread('moon.tif'); H = fspecial('sobel'); subplot(2,2,1) imshow(I); title(' Qriginal Image '); Sobel = imfilter(I,H,'replicate'); subplot(2,2,2) imshow(Sobel); title(' Sobel Image ') H = fspecial('laplacian',0.4); lap = imfilter(I,H,'replicate'); subplot(2,2,3) imshow(lap); title(' Laplacian Image ') H = fspecial('gaussian',[3 3],0.5); gaussian = imfilter(I,H,'replicate'); subplot(2,2,4) imshow(gaussian); title(' Gaussian Image ') 3. 使用函数imfilter时,分别采用不同的填充方法(或边界选项,如零填充、’replicate’、’symmetric’、’circular’)进行低通滤波,显示处理后的图像。 originalRGB = imread('trees.tif'); subplot(3,2,1) imshow(originalRGB); title(' Qriginal Image '); h = fspecial('motion', 50, 45); %motion blurred filteredRGB = imfilter(originalRGB, h); subplot(3,2,2) imshow(filteredRGB); title(' Motion Blurred Image '); boundaryReplicateRGB = imfilter(originalRGB, h, 'replicate'); subplot(3,2,3) imshow(boundaryReplicateRGB); title(' 0-Padding'); boundary0RGB = imfilter(originalRGB, h, 0); subplot(3,2,4) imshow(boundary0RGB); title('Replicate'); boundarysymmetricRGB = imfilter(originalRGB, h, 'symmetric'); subplot(3,2,5) imshow(boundarysymmetricRGB); title(' Symmetric '); boundarycircularRGB = imfilter(originalRGB, h, 'circular'); subplot(3,2,6) imshow(boundarycircularRGB); title(' Circular'); 4. 运用for循环,将加有椒盐噪声的图像进行10次,20次均值滤波,查看其特点,显示均值处理后的图像(提示:利用fspecial函数的’average’类型生成均值滤波器)。 I=imread('kids.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,3,1) imshow(J); title(' salt & pepper Noise'); h=fspecial('average'); %Averaging Filtering J1=imfilter(J,h); for i=1:10 J1=imfilter(J,h); subplot(1,3,2) imshow(J1); title(' 10 Averaging Filtering'); end J2=imfilter(J,h); for i=1:20 J2=imfilter(J,h); subplot(1,3,3) imshow(J2); title(' 20 Averaging Filtering'); end 5. 对加入椒盐噪声的图像分别采用均值滤波法,和中值滤波法对有噪声的图像做处理,要求在同一窗口中显示结果。 I=imread('trees.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,3,1) imshow(J); title(' Original Image '); h=fspecial('average'); %Averaging Filtering J1=imfilter(J,h); subplot(1,3,2) imshow(J1); title(' Averaging Filtering '); J2=medfilt2(J); %Median Filtering subplot(1,3,3) imshow(J2); title(' Median Filtering '); 6. 自己设计平滑空间滤波器,并将其对噪声图像进行处理,显示处理后的图像。 domain=[0 0 8 0 0; 0 0 8 0 0; 8 8 8 8 8; 0 0 8 0 0; 0 0 8 0 0]; I=imread('trees.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,2,1) imshow(J); title(' Original Image '); K1= ordfilt2(J,5,domain); subplot(1,2,2) imshow(K1); title(' 5*5 Smoothing Fitered Image'); 附录:可能用到的函数和参考结果**************报告里不能用参考结果中的图像 1) 读出eight.tif这幅图像,给这幅图像分别加入椒盐噪声和高斯噪声后并与前一张图显示在同一图像窗口中。 I=imread('cameraman.tif'); subplot(1,3,1) imshow(I); title(' Qriginal Image '); J = imnoise(I,'salt & pepper',0.05); %noise density=0.05 subplot(1,3,2) imshow(J); title(' salt & pepper '); K= imnoise(I,'gaussian',0.01,0.01); subplot(1,3,3) imshow(K); title(' gaussian '); 图2.1 初始图像及椒盐噪声图像、高斯噪声污染图 2) 对加入噪声图像选用不同的平滑(低通)模板做运算,对比不同模板所形成的效果,要求在同一窗口中显示。 I=imread('trees.tif'); H = fspecial('sobel'); subplot(2,2,1) imshow(I); title(' Qriginal Image '); Sobel = imfilter(I,H,'replicate'); subplot(2,2,2) imshow(Sobel); title(' Sobel Image ') H = fspecial('laplacian',0.4); lap = imfilter(I,H,'replicate'); subplot(2,2,3) imshow(lap); title(' Laplacian Image ') H = fspecial('gaussian',[3 3],0.5); gaussian = imfilter(I,H,'replicate'); subplot(2,2,4) imshow(gaussian); title(' Gaussian Image ') 图2.2 原图像及各类低通滤波处理图像 3) 使用函数imfilter时,分别采用不同的填充方法(或边界选项,如零填充、’replicate’、’symmetric’、’circular’)进行低通滤波,显示处理后的图像。 originalRGB = imread('sedemo_onion.png'); subplot(3,2,1) imshow(originalRGB); title(' Original Image '); h = fspecial('motion', 50, 45); %motion blurred filteredRGB = imfilter(originalRGB, h); subplot(3,2,2) imshow(filteredRGB); title(' Motion Blurred Image '); boundaryReplicateRGB = imfilter(originalRGB, h, 'replicate'); subplot(3,2,3) imshow(boundaryReplicateRGB); title(' 0-Padding'); boundary0RGB = imfilter(originalRGB, h, 0); subplot(3,2,4) imshow(boundary0RGB); title('Replicate'); boundarysymmetricRGB = imfilter(originalRGB, h, 'symmetric'); subplot(3,2,5) imshow(boundarysymmetricRGB); title(' Symmetric '); boundarycircularRGB = imfilter(originalRGB, h, 'circular'); subplot(3,2,6) imshow(boundarycircularRGB); title(' Circular'); 图2.3 原图像及运动模糊图像 图2.4 函数imfilter各填充方式处理图像 4) 运用for循环,将加有椒盐噪声的图像进行10次,20次均值滤波,查看其特点,显示均值处理后的图像。 I=imread('kids.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,3,1) imshow(J); title(' salt & pepper Noise'); h=fspecial('average'); %Averaging Filtering J1=imfilter(J,h); for i=1:10 J1=imfilter(J,h); subplot(1,3,2) imshow(J1); title(' 10 Averaging Filtering'); end J2=imfilter(J,h); for i=1:20 J2=imfilter(J,h); subplot(1,3,3) imshow(J2); title(' 20 Averaging Filtering'); end 图2.5 椒盐噪声污染图像经10次、20次均值滤波图像 由图2.5可得,20次滤波后的效果明显好于10次滤波,但模糊程度也更强。 5) 对加入椒盐噪声的图像分别采用均值滤波法,和中值滤波法对有噪声的图像做处理,要求在同一窗口中显示结果 I=imread('kids.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,3,1) imshow(J); title(' Original Image '); h=fspecial('average'); %Averaging Filtering J1=imfilter(J,h); subplot(1,3,2) imshow(J1); title(' Averaging Filtering '); J2=medfilt2(J); %Median Filtering subplot(1,3,3) imshow(J2); title(' Median Filtering '); 图2.6 椒盐噪声污染图像及均值、中值滤波图像 从图2.6中可以看出,对于椒盐噪声污染的图像处理,中值滤波效果要明显好于均值滤波。经均值滤波器处理后的图像比均值滤波器中结果图像更加模糊。 6) 设计平滑空间滤波器,并将其对噪声图像进行处理,显示处理后的图像。 domain=[0 0 8 0 0; 0 0 8 0 0; 8 8 8 8 8; 0 0 8 0 0; 0 0 8 0 0]; I=imread('kids.tif'); J = imnoise(I,'salt & pepper',0.05); subplot(1,2,1) imshow(J); title(' Original Image '); K1= ordfilt2(J,5, domain); subplot(1,2,2) imshow(K1); title(' 5*5 Smoothing Fitered Image'); 图2.7 椒盐噪声污染图像及5*5平滑滤波器掩模 掩模值为w=1/25*[1 1 1 1 1;1 1 1 1 1;1 1 1 1 1;1 1 1 1 1;1 1 1 1 1] 图2.8 椒盐噪声污染图像及5*5平滑滤波器掩模 掩模值为w= [0 0 8 0 0;0 0 8 0 0;8 8 8 8 8; 0 0 8 0 0;0 0 8 0 0] 16
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服