📄 text_denoising.m
字号:
% test for denoising using the bandlet transform%% Copyright (c) 2007 Gabriel Peyrepath(path, 'toolbox/');n = 256;M = imread('D:\personal\matlab\work\aa\earth_013.GIF');m=0;v=0.1;M0=imnoise(M,'gaussian',m,v);M=M0;sigma=0.3;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TI Waveletsclear options;options.wavelet_type = 'biorthogonal';options.wavelet_vm = 3;Jmin = 4;options.decomp_type = 'quad';MW = perform_atrou_transform(M,Jmin,options);disp('--> Computing best threshold (wavelets).');Twav = compute_best_threshold(M,M0,sigma, options);MWT = perform_thresholding(MW, T);MW1 = perform_atrou_transform(MWT,Jmin,options);nbr_scales = 3; % number of scale on witch geometry is computedbandlet_type = 'atrou-quad';switch bandlet_type case 'atrou-quad' callback = @callback_atrou; options.decomp_type = 'quad'; Jband = 3*nbr_scales; case 'atrou-tri' callback = @callback_atrou; options.decomp_type = 'tri'; Jband = 2*nbr_scales; case 'steerable' options.nb_orientations = 1; callback = @callback_atrou; Jband = options.nb_orientations*nbr_scales+1; case 'laplacian' callback = @callback_laplacian; Jband = nbr_scales; otherwise error('Unknown type.');end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TI Bandletsoptions.w = 8;options.q = 8; % for overlap set q=w/2, otherwise q=woptions.T = T; % 10/256;options.Jband = Jband; % number of scales for bandletsoptions.Jhaar = 2; % number of scales for the 1D haar transformoptions.callback = callback;options.geometry_weight = 1; % price to pay for the geometryoptions.n = n;% use or not TI haaroptions.ti = 1;% compute the geometry for the bandlet transformdisp('--> Computing geometry.');G = compute_geometry( M, options );% forward transformMB = perform_bandlet_transform( M, G, options );% perform thresholdingdisp('--> Computing best threshold (bandlets).');Tband = compute_best_threshold(M,M0,sigma,options, G);MBT = perform_thresholding(MB, Tband);% reconstructMB1 = perform_bandlet_transform( MBT, G, options );%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%pnoisy = psnr(M,M0);pwav = psnr(M0,MW1);pband = psnr(M0,MB1);display_image_layout({M0 M MW1 MB1 }, ... {'Original' sprintf('Noisy,psnr=%.2f', pnoisy) sprintf('Wav,psnr=%.2f', pwav) ... sprintf('Band,psnr=%.2f(+%.2f)', pband, pband-pwav) });
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -