TA的每日心情 | 怒 2019-11-20 15:22 |
|---|
签到天数: 2 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
9 ]- k0 m1 h; J( Y2 S. O3 V/ a- A
一、简介
# |/ k' Y# {% u; t5 a7 }. o数字图像在进行数学形态滤波去噪时,根据噪声特点可以尝试采用维数由小到大的结构元素来进行处理,进而达到滤除不同噪声的目的。采用数学形态学的多结构元素,可以更多地保持数字图像的几何特征. s9 H8 g# ]% F" A- ]9 }
( c2 Z; j* n/ c2 @+ T
! a% c5 A" m) N' w& {
二、源代码
" _. q f& s- x/ P) Q5 H7 C9 j- c7 n$ B
- %% 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');
* v8 N# Z9 t& i0 v! t, z, q
4 O7 y9 U/ m2 W% v a/ I1 Z9 l: Z0 J" x R* B' \
0 l* ]5 Y: }, o0 p8 R1 g) v
三、运行结果6 X( `- y- r3 I: s5 }8 p
1 U" T0 T- H9 j2 @* q# Y1 o
9 z9 h& l% b, B0 x& r# O9 ?, o
5 B1 M5 `& x& I) ] |
|