实验四-常用图像增强方法

1、采用二维中值滤波函数medfilt2 对受椒盐噪声干扰的图像滤波,窗口分别采用3*3,5*5,7*7

i = imread('D:\study\third_down\ImageProcessing\work\work_one\flower.jpg');
I = rgb2gray(i);
J = imnoise(I,'salt & pepper',0.04);
K1 = medfilt2(J,[3 3]);%对矩阵I进行二维中值滤波,领域为3*3
K2 = medfilt2(J,[5 5]);
K3 = medfilt2(J,[7 7]);
subplot(2,2,1);imshow(J);title('盐椒噪声干扰图像');
subplot(2,2,2);imshow(K1);title('领域为3*3二维中值滤波');
subplot(2,2,3);imshow(K2);title('领域为5*5二维中值滤波');
subplot(2,2,4);imshow(K3);title('领域为7*7二维中值滤波');

2 、采用 MATLAB 中的函数 filter2 对受噪声干扰的图像进行均值滤波

i = imread('D:\study\third_down\ImageProcessing\work\work_fourth\flower.jpg');
j = imnoise(i,'gaussian',0,0.02);%模拟均值为0方差为0.02的高斯噪声
M = filter2(fspecial('average',9),j)/255;%模板尺寸为9
subplot(2,1,1);imshow(j);title('噪声干扰图像');
subplot(2,1,2);imshow(M);title('均值滤波后的图像');

3.采用三种不同算子对图像进行锐化处理

i = imread('D:\study\third_down\ImageProcessing\work\work_fourth\flower.jpg');
I = rgb2gray(i);
H = fspecial('sobel');%应用sobel算子锐化图像
I1 = filter2(H,I);%算子滤波锐化
H = fspecial('prewitt');%应用prewitt算子锐化图像
I2 = filter2(H,I);%算子滤波锐化
H = fspecial('log');%应用log算子锐化图像
I3 = filter2(H,I);%算子滤波锐化
subplot(2,2,1);imshow(i);title('原图像');
subplot(2,2,2);imshow(I1);title('应用sobel算子锐化图像');
subplot(2,2,3);imshow(I2);title('应用prewitt算子锐化图像');
subplot(2,2,4);imshow(I3);title('应用log算子锐化图像');

  • 2
    点赞
  • 45
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值