denoise2.m
上传用户:sla11nk8
上传日期:2013-03-09
资源大小:21k
文件大小:4k
- % denoise2.m
- %---本程序是基于LeventCode平台作的。
- %---包括以下方法:
- % BivaShrink方法、模型1、模型2、模型3(TrivaShrink方法)、BayesShrink方法、LAWMLShrink方法的DWT实现和DT_CWT实现。
- %---运行方法:
- % 将某方法对应行的代码前的“%”去掉,而其他方法前一律都加“%”屏蔽掉。
- % 噪声方差大小可以自行设定
- I=imread('lena.bmp');%读取图像数据
- figure;
- imshow(I,256);%显示原图像
- %产生噪声图像
- theta_noise=20;%噪声方差(可设为其他值)------------------------------------------
- noise=GWN2(length(I),theta_noise);
- Inoise=double(I)+noise;
- figure;
- imshow(Inoise,[]);%显示带噪图像
- %%%%%%%%%%%%%%%%%%%%%%--------BivaShrink方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %----------Levent原创Bivariate Shrinkage方法:denoising_dwt-----------------------
- Idenoise=denoising_dwt(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=denoising_dtdwt(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%--------Cai:模型1方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %----------Cai:这里用当前系数y1和领域系数y3:BivaShrink13(模型1)-------------------
- %Idenoise=BivaShrink13(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=dt_BivaShrink13(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%--------Cai:模型2方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %----------Cai:这里用父层系数y2和邻域系数y3:BivaShrink23--------------------------
- %Idenoise=BivaShrink23(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=dt_BivaShrink23(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%--------Cai:模型3(TrivaShrink方法)---------%%%%%%%%%%%%%%%%%%%%%%%
- %----------Cai:这里用当前系数y1、父层系数y2和邻域系数y3---------------------------
- %----------是一种三维的萎缩函数:BivaShrink123-------------------------------------
- %Idenoise=BivaShrink123(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=dt_BivaShrink123(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%--------BayesShrink---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %-------------BayesShrink的方差局部自适应版本------------------------------------
- %Idenoise=denoising_BayesShrink(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=dt_BayesShrink(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %%%%%%%%%%%%%%%%%%%%%%%%--------LAWMLShrink---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %--------------LAWMLShrink--------------------------------------------------------
- %Idenoise=denoising_LAWMLShrink(Inoise);
- %---------------------------------------------------------------------------------
- %----------复数小波改进-----------------------------------------------------------
- %Idenoise=dt_LAWMLShrink(Inoise);
- %---------------------------------------------------------------------------------
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %输出去噪后的MSE和PSNR值
- MSE2_=MSE2(double(I),Idenoise)
- PSNR2=PSNR(MSE2_)
- figure;
- imshow(Idenoise,[]);%显示恢复图像