姓名:张攀
学号:0917030140
一、实验目的:
1)熟练掌握空域滤波中常用的平滑和锐化滤波器;
2)熟练掌握掩模技术,并可以应用掩模技术对图像进行增强处理;
3)了解图像增强的目的和意义,加深对图像增强的感性认识,巩固所学的图像增强的理论知识和相关算法。
二、实验内容:
(1)选择一幅图像,叠加零均值高斯噪声,然后分别利用邻域平均法和中值滤波法对该图像进行滤波,显示滤波后的图像,比较各滤波器的滤波效果。
subplot(231);
imshow(f,[])
title('original image');
fn=imnoise(f,'salt & pepper',0.2);
subplot(232);
imshow(fn,[])
title('image whit noise');
g1=medfilt2(fn);
w=ones(3);
fn=im2double(fn);
mean=imfilter(fn,w)/(3*3);
subplot(233);
imshow(mean,[])
title('3*3 mean denoised image')
w=ones(9);
mean=imfilter(fn,w)/(9*9);
subplot(234);
imshow(mean,[])
title('9*9 mean denoised image')
mean=imfilter(fn,w)/(3*3);
subplot(235);
imshow(g1,[])
title('3*3中值滤波图');
(2)选择一幅图像,叠加椒盐噪声,选择合适的滤波器将噪声滤除。
subplot(221);
imshow(f,[])
title('original image');
fn=imnoise(f,'salt & pepper',0.2);
subplot(222);
imshow(fn,[])
title('image with noise');
w=ones(3);
fn=im2double(fn);
mean=imfilter(fn,w)/(3*3);
subplot(223);
imshow(mean,[])
title('3*3 mean denoised image')
w=ones(9);
mean=imfilter(fn,w)/(9*9);
subplot(224);
imshow(mean,[]);
title('9*9 mean denoised image')下载本文