找回密码
 注册
关于网站域名变更的通知
查看: 620|回复: 1
打印 上一主题 下一主题

基于matlab自适应形态学之图像去噪

[复制链接]
  • TA的每日心情

    2019-11-20 15:22
  • 签到天数: 2 天

    [LV.1]初来乍到

    跳转到指定楼层
    1#
    发表于 2021-4-29 17:53 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

    EDA365欢迎您登录!

    您需要 登录 才可以下载或查看,没有帐号?注册

    x
    $ a6 G1 A3 P4 F- ]2 d
    一、简介" i' c& f5 _0 e# ^( u5 f! L3 F
    数字图像在进行数学形态滤波去噪时,根据噪声特点可以尝试采用维数由小到大的结构元素来进行处理,进而达到滤除不同噪声的目的。采用数学形态学的多结构元素,可以更多地保持数字图像的几何特征.$ r* L$ p+ D% y. \1 f1 ?  g. u

    - G& ]' s* t; [9 E7 w7 m1 p, E5 s1 w2 u
    0 N; I/ P3 }4 V7 V- w二、源代码  b9 I0 ^/ m  b1 Z1 z

    ! {! }* H, Q; r3 o; b$ Q
    • %% Figure 1
    • A = double(imread('retina.png'));
    • A = A(:,:,2);
    • x1=361;y1=493;
    • x2=289;y2=207;
    • Z1 = GAN(A,18,y1,x1,'CLIP');
    • Z2 = GAN(A,18,y2,x2,'CLIP');
    • Z = Z1+Z2;
    • figure
    • subplot(121);
    • hold on;
    • imshow(A,[]);
    • plot(x1,y1,'w*');title('points (x_1,y_1) and (x_2,y_2)')
    • plot(x2,y2,'w*');
    • subplot(122);
    • imshow(max(A,255*Z),[]);title('GANs of (x_1,y_1) and (x_2,y_2)')
    • %% Figure 2
    • A = double(imread('lena256.jpg'));
    • se = strel('disk',2);
    • A_dilation = imdilate(A,se);
    • A_erosion = imerode(A,se);
    • mtol = 20;
    • A_GANdilation = GANdilation(A,A,mtol,'CLIP');
    • A_GANerosion = GANerosion(A,A,mtol,'CLIP');
    • figure
    • subplot(231);imshow(A,[]);title('original');
    • subplot(232);imshow(A_dilation,[]);title('classical dilation');
    • subplot(233);imshow(A_erosion,[]);title('classical erosion');
    • subplot(235);imshow(A_GANdilation,[]);title('GAN dilation');
    • subplot(236);imshow(A_GANerosion,[]);title('GAN erosion');
    • %% Figure 3
    • A = double(imread('vaisseaux3.png'));
    • C = floor(imContrasteLIP(A));
    • B_CLIP = toggleContrastCLIP(A,5);
    • B_LIP = GANtoggleContrastLIP(A,255-C,30);
    • figure
    • subplot(221);imshow(A,[]);title('original');
    • subplot(222);imshow(C,[]);title('LIP contrast');
    • subplot(223);imshow(B_CLIP,[]);title('classical toggle contrast');
    • subplot(224);imshow(B_LIP,[]);title('GAN toggle contrast');
    • %% Figure 4
    • A = double(imread('lena256.jpg'));
    • Anoisy = double(uint8(255*imnoise(A/255,'salt & pepper',0.02)));
    • fun = @(x) median(x(:));
    • B = nlfilter(Anoisy,[3 3],fun);
    • C = GANmedian(Anoisy,Anoisy,20,'CLIP');
    • D = ZGANmedian(Anoisy,Anoisy,20,'CLIP',4);
    • figure
    • subplot(231);imshow(A,[]);title('noise free'); title('original');
    • subplot(232);imshow(Anoisy,[]);title('noisy');title('noisy');
    • subplot(234);imshow(B,[]);title('classical median');title('classical median');
    • subplot(235);imshow(C,[]);title('GAN median');title('GAN median');
    • subplot(236);imshow(D,[]);title('Z-GAN median');title('Z-GAN median');

    • & ~  q; i# k, o, u2 Z
       
    6 T! ]5 C1 M7 x1 T) M& O9 x! i% ^* j: w& J: X
    - r, d) @4 m. d6 n/ T# x
    三、运行结果
    ) j) \; X: M1 ~' d! w0 L
      ?  ?* C; P6 Z, Q% w3 p. p
    + L+ T1 f  s5 d- k% {: j& z1 S$ {2 o$ f# B& |! u+ U
  • TA的每日心情
    慵懒
    2020-8-28 15:16
  • 签到天数: 1 天

    [LV.1]初来乍到

    2#
    发表于 2021-4-30 09:49 | 只看该作者
    采用数学形态学的多结构元素
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    关闭

    推荐内容上一条 /1 下一条

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-7-20 04:51 , Processed in 0.109375 second(s), 26 queries , Gzip On.

    深圳市墨知创新科技有限公司

    地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

    快速回复 返回顶部 返回列表