Code covered by the BSD License  

Highlights from
BlockShrink denoising

from BlockShrink denoising by Dengwen Zhou
BlockShrink code package

test
function test
%
% Copyright (c) Oct. 25, 2007.  Zhou Dengwen.  All rights reserved.
% Department of Computer Science & Technology
% North China Electric Power University(Beijing)(NCEPU)
%
% Last time modified: Jun. 10, 2009
%

% Read the original image
Xclean = imread('lena.png');
Xclean = double(Xclean);  % convert it to double
[nRow, nCol] = size(Xclean);
if nRow ~= nCol   
    error('The inputted digital image must be a square matrix!')
end

% Add Gaussian white noise with variance sigma^2 and mean 0
sigma = 10;
seed = 0;  % random seed
randn('state', seed);
noise = randn(nRow, nCol);
noise = noise/std2(noise);
Xnoisy = Xclean + sigma*noise;

% Apply the denoising algorithm
tic;
Xdenoised = DenoiseFun(Xnoisy, sigma);
toc

% Estimate the denoising effcet (i.e. computing MSE and PSNR)
[MSE, PSNR] = Calc_MSE_PSNR(Xclean,Xdenoised)

Contact us at files@mathworks.com