www.pudn.com > xiaobo.rar > xiaobo.m, change:2010-06-30,size:1692b


clc; 
X = imread('Lena.bmp'); 
[nrow ncol] = size(X); 
figure(1); imshow(uint8(X)); 
title('??????'); 
sigma =30; 
X_noise = double(X)+ sigma *randn([nrow ncol]);  
figure(2); imshow(X_noise,[]); 
title('?????ù?ó??????'); 
N = 10; % decomposing levels 
[C,S] = wavedec2(X_noise,N,'db4'); % Perform N-level  
New_C = C; 
position1 = prod(S(1,:));  
for n=1:N 
    len = 3*prod(S(n,:)); % Total number of details of nth level. 
    position2 = position1+len; 
    coef = C([position1+1:position2]);       % fitch nth level details 
Est_sigma = median(abs(coef))/0.6745;    % Robust Estimation of the noise power in the level 
       
New_coef = wthresh(coef,'s', Est_sigma);  % Shrinking the details by solf-thresholding 
New_C([position1+1:position2]) = New_coef; % Put the shrinked details into space 
    position1 = position2;   % Get the position for next level 
end 
Out_Image = waverec2(New_C,S,'db4'); % Reconstruct Image & Display 
figure(3); imshow(uint8(Out_Image)); 
title('???¨?????ó????'); 
 % Compare the Mean Squared Errors of X_noise and Out_Image 
MSE0 = sqrt((sum(sum(double(X)-X_noise).^2))/(nrow*ncol)); 
MSE1 = sqrt((sum(sum(double(X)-Out_Image).^2))/(nrow*ncol)); 
 
(2)实验结果: 
  
随机噪声权值sigma=30 
软限幅                    硬限幅 
 
  
MSE_noise Image=31.2393         MSE_noise Image=28.1584 
MSE_out Image=43.9706              MSE_out Image= 27.915 
 
 
随机噪声权值sigma=10 
软限幅                    硬限幅 
 
  
MSE_noise Image=10.381     MSE_noise Image= 9.9677 
MSE_out Image= 22.515         MSE_out Image= 10.809 
 
增加分解级数N=10 
随机噪声权值sigma=30 
软限幅                          硬限幅 
   
MSE_noise Image= 31.662    MSE_out Image= 87.333