% author: zhangduokun
% 2012-12-18
clc;
clear;
clear all;
close all;
I = imread('house.png');
y = im2double(I);
randn('seed', 0);
sigma = 10;
z = y + (sigma/255)*randn(size(I));
% Denoise 'z'. The denoised image is 'y_est', and 'NA = 1' because
% the true image was not provided
tic;
[NA, y_est] = BM3D(1, z, sigma);
elapsed_time = toc
% Compute the putput PSNR
PSNR = 10*log10(1/mean((y(:)-y_est(:)).^2))
% show the noisy image 'z' and the denoised 'y_est'
figure; imshow(z);
figure; imshow(y_est);
% [PSNR,I2] = BM3D(1,im2double(I),10);
% imshow(I2);
imwrite(y_est,'housedenosed.png');