denoise2.m
上传用户:sla11nk8
上传日期:2013-03-09
资源大小:21k
文件大小:4k
源码类别:

其他

开发平台:

Matlab

  1. % denoise2.m
  2. %---本程序是基于LeventCode平台作的。
  3. %---包括以下方法:
  4. % BivaShrink方法、模型1、模型2、模型3(TrivaShrink方法)、BayesShrink方法、LAWMLShrink方法的DWT实现和DT_CWT实现。
  5. %---运行方法:
  6. % 将某方法对应行的代码前的“%”去掉,而其他方法前一律都加“%”屏蔽掉。
  7. % 噪声方差大小可以自行设定
  8. I=imread('lena.bmp');%读取图像数据
  9. figure;
  10. imshow(I,256);%显示原图像
  11. %产生噪声图像
  12. theta_noise=20;%噪声方差(可设为其他值)------------------------------------------
  13. noise=GWN2(length(I),theta_noise);
  14. Inoise=double(I)+noise;
  15. figure;
  16. imshow(Inoise,[]);%显示带噪图像
  17. %%%%%%%%%%%%%%%%%%%%%%--------BivaShrink方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  18. %----------Levent原创Bivariate Shrinkage方法:denoising_dwt-----------------------
  19. Idenoise=denoising_dwt(Inoise);
  20. %---------------------------------------------------------------------------------
  21. %----------复数小波改进-----------------------------------------------------------
  22. %Idenoise=denoising_dtdwt(Inoise);
  23. %---------------------------------------------------------------------------------
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  25. %%%%%%%%%%%%%%%%%%%%%%%--------Cai:模型1方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  26. %----------Cai:这里用当前系数y1和领域系数y3:BivaShrink13(模型1)-------------------
  27. %Idenoise=BivaShrink13(Inoise);
  28. %---------------------------------------------------------------------------------
  29. %----------复数小波改进-----------------------------------------------------------
  30. %Idenoise=dt_BivaShrink13(Inoise);
  31. %---------------------------------------------------------------------------------
  32. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  33. %%%%%%%%%%%%%%%%%%%%%%%--------Cai:模型2方法---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. %----------Cai:这里用父层系数y2和邻域系数y3:BivaShrink23--------------------------
  35. %Idenoise=BivaShrink23(Inoise);
  36. %---------------------------------------------------------------------------------
  37. %----------复数小波改进-----------------------------------------------------------
  38. %Idenoise=dt_BivaShrink23(Inoise);
  39. %---------------------------------------------------------------------------------
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. %%%%%%%%%%%%%%%%--------Cai:模型3(TrivaShrink方法)---------%%%%%%%%%%%%%%%%%%%%%%%
  42. %----------Cai:这里用当前系数y1、父层系数y2和邻域系数y3---------------------------
  43. %----------是一种三维的萎缩函数:BivaShrink123-------------------------------------
  44. %Idenoise=BivaShrink123(Inoise);
  45. %---------------------------------------------------------------------------------
  46. %----------复数小波改进-----------------------------------------------------------
  47. %Idenoise=dt_BivaShrink123(Inoise);
  48. %---------------------------------------------------------------------------------
  49. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  50. %%%%%%%%%%%%%%%%%%%%%%%%--------BayesShrink---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  51. %-------------BayesShrink的方差局部自适应版本------------------------------------
  52. %Idenoise=denoising_BayesShrink(Inoise);
  53. %---------------------------------------------------------------------------------
  54. %----------复数小波改进-----------------------------------------------------------
  55. %Idenoise=dt_BayesShrink(Inoise);
  56. %---------------------------------------------------------------------------------
  57. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  58. %%%%%%%%%%%%%%%%%%%%%%%%--------LAWMLShrink---------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  59. %--------------LAWMLShrink--------------------------------------------------------
  60. %Idenoise=denoising_LAWMLShrink(Inoise);
  61. %---------------------------------------------------------------------------------
  62. %----------复数小波改进-----------------------------------------------------------
  63. %Idenoise=dt_LAWMLShrink(Inoise);
  64. %---------------------------------------------------------------------------------
  65. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  66. %输出去噪后的MSE和PSNR值
  67. MSE2_=MSE2(double(I),Idenoise)
  68. PSNR2=PSNR(MSE2_)
  69. figure;
  70. imshow(Idenoise,[]);%显示恢复图像