数字图像处理 matlab代码,数字图像处理matlab代码

数字图像处理matlab代码

一、1

a=imread('C:\Users\SUN\Desktop\A\a.tif'); %读图像

b=imnoise(a,'gaussian',0,0.012); %加入0均值,方差800的噪声。

c=imnoise(b,'salt & pepper',0.1); % 在(a)的基础上,进一步加入椒盐噪声进一步污染图像( Pa=Pb=0.1的椒盐噪声)

subplot(2,4,1),imshow(a) ,title('原始图像') %显示图片

subplot(2,4,2),imshow(b) ,title('高斯噪声污染')

subplot(2,4,3),imshow(c) ,title('椒盐噪声污染')

g1= imfilter(c,fspecial('average',5));

subplot(2,4,4),imshow(g1) ,title('算数均值滤波')

h=ones(5,5)/25; %几何均值滤波

g2=imfilter(c,h);

subplot(2,4,5),imshow(g2) ,title('几何均值滤波')

g3= medfilt2(c,[5,5]); %中值滤波

subplot(2,4,6),imshow(g3) ,title('中值滤波')

i=ones(5,5)/20;

g4=imfilter(c,i);

subplot(2,4,7),imshow(g4) ,title('修正后的α均值滤波')

2

a=imread('C:\Users\SUN\Desktop\A\a.tif'); %读图像

b=imnoise(a,'gaussian',0,0.015); %加入0均值,方差1000的噪声

subplot(2,3,1),imshow(a) ,title('原始图像') %显示图片

subplot(2,3,2),imshow(b) ,title('高斯噪声污染')

g1= imfilter(b,fspecial('average',7));

subplot(2,3,4),imshow(g1) ,title('算数均值滤波') %算数均值滤波

h=ones(7,7)/49; %几何均值滤波

g2=imfilter(b,h);

subplot(2,3,5),imshow(g2) ,title('几何均值滤波')

g3=wiener2(b,[7,7]);

subplot(2,3,6),imshow(g3) ,title('自适应噪声消减滤波') %自适应噪声消减滤波

3

a=imread('C:\Users\SUN\Desktop\A\a.tif'); %读图像

b=imnoise(a,'salt & pepper',0.25); %加入概率Pa=Pb=0.25的椒盐噪声污染了的图像

subplot(2,2,1),imshow(a) ,title('原始图像') %显示图片

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值