第一范文网 - 专业文章范例文档资料分享平台

新编数字图像处理实验

来源:用户分享 时间:2025/5/19 16:13:21 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

2)对加入的噪声图像选用不同的平滑处理模板运算,对比不同的模板所形成的效果 close all

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); J=imnoise(I,'salt & pepper',0.5); subplot(1,4,1);imshow(J); H=fspecial('sobel');

sobel=imfilter(I,H,'replicate'); subplot(1,4,2);imshow(sobel); >> H=fspecial('laplacian',0.4); lap=imfilter(I,H,'replicate'); >> subplot(1,4,3);imshow(lap); >> H=fspecial('gaussian',[3 3],0.5); gaussian=imfilter(I,H,'replicate'); >> subplot(1,4,4);imshow(gaussian);

3)使用函数imfilter时,采用不同的填充方法进行的滤波,显示处理后的图像 originalRGB=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); subplot(2,3,1);imshow(originalRGB); h=fspecial('motion',50,45);

filteredRGB=imfilter(originalRGB,h); subplot(2,3,2); imshow(filteredRGB);

boundaryReplicateRGB=imfilter(originalRGB,h,'replicate'); subplot(2,3,3);imshow(boundaryReplicateRGB); boundary0RGB=imfilter(originalRGB,h,0); subplot(2,3,4); imshow(boundary0RGB);

boundarysymmetricRGB=imfilter(originalRGB,h,'symmetric'); subplot(2,3,5);imshow(boundarysymmetricRGB);

boundarycircularRGB=imfilter(originalRGB,h,'circular'); subplot(2,3,6);imshow(boundarycircularRGB)

4)应用for循环,将加有椒盐噪声的图像进行10次、20次均值滤波,查看其特点,显示处理后的图像

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); J=imnoise(I,'salt & pepper',0.5); subplot(1,3,1);imshow(J) h=fspecial('average'); for i=1:10

J1=imfilter(J,h); end

subplot(1,3,2);imshow(J1) for i=1:20

J2=imfilter(J,h); end

subplot(1,3,3);imshow(J2)

由图可见,20次滤波后的效果明显好于10次的滤波的,但是模糊程度增加。

5)对加入椒盐噪声的图像分别采取均值滤波和中值滤波法对有噪声的图像做处理,要求在同一窗口显示结果

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp');

J=imnoise(I,'salt & pepper',0.5); >> subplot(1,3,1);imshow(J) >> h=fspecial('average'); >> J2=imfilter(J,h);

>> subplot(1,3,2);imshow(J2) >> J3=medfilt2(J);

>> subplot(1,3,3);imshow(J3)

从上图可以看出,对于椒盐噪声污染的图像处理,中值滤波效果要明显好于均值滤波,经均值滤波器处理后的图像比均值滤波器中结果图像更加模糊。

6)设计平滑空间滤波器,并将对噪声进行处理,显示处理后的结果 close all

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); J=imnoise(I,'salt & pepper',0.5);

domain=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]; K1=ordfilt2(J,5,domain); subplot(1,2,1);imshow(J) subplot(1,2,2);imshow(K1)

掩模值为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]; close all

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); J=imnoise(I,'salt & pepper',0.5);

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];

K1=ordfilt2(J,5,domain); subplot(1,2,1);imshow(J) subplot(1,2,2);imshow(K1)

掩模值为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]; 2.锐化空间滤波器

1)3×3的拉普拉斯算子滤波

I=imread('C:\\Program Files\\MATLAB\\R2009a\\work\\lena','bmp'); >> T=double(I);

>> subplot(1,2,1),imshow(T,[]);title('original Image'); >> w=[1,1,1;1,-8,1;1,1,1]; >> K=conv2(T,w,'same');

>> subplot(1,2,2),imshow(K);

2)奇数尺寸拉普拉斯算子随机产生函数 close all n=5;

w=ones(n); x=ceil(n/2);

w(x,x)=-1*(n*n-1)

搜索更多关于: 新编数字图像处理实验 的文档
新编数字图像处理实验.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c51w432vxon207lq1bael_3.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top