-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdemo_ppn.m
50 lines (45 loc) · 1.88 KB
/
demo_ppn.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% demo for estimation of frequency-dependent (Processed) image noise
clc
clear
close all
rng('default');
%
im = imread('peppers.png');
disp('----- Isotropic spatially correlated noise -----')
for sigma_a = [10 15]
for sigma_GB = [0.45 0.5 0.55]
h = fspecial('gaussian', 3, sigma_GB);
noise = sigma_a*randn(size(im));
noise = imfilter(noise,h,'symmetric');
noise_std = std(noise(:));
im_n = double(im) + noise;
[est_sigma_p,est_sigma_o,nlf] = imnest_ivhc(im_n,0);
est_error = abs(noise_std-est_sigma_p);
est_gamma = est_sigma_o/est_sigma_p;
disp('------------------------')
disp(['sigma_GB = ' num2str(sigma_GB) ', sigma_a = ' num2str(sigma_a) ', sigma_n = ' num2str(noise_std)])
disp(['Noise std estimation error: ' num2str(est_error)])
disp(['Estimated processing degree: ' num2str(est_gamma)])
disp('------------------------')
end
end
disp('************************************************')
disp('----- Anisotropic spatially correlated noise -----')
disp('************************************************')
for sigma_a = [10 15]
for scale = [0.5 1 2]
h = fspecial('gaussian', 3, sigma_GB);
noise = sigma_a*randn(size(im));
noise = bilateralflt(noise,sigma_a*sigma_a*scale,1,1);
noise_std = std(noise(:));
im_n = double(im) + noise;
[est_sigma_p,est_sigma_o] = imnest_ivhc(im_n,0);
est_error = abs(noise_std-est_sigma_p);
est_gamma = est_sigma_o/est_sigma_p;
disp('------------------------')
disp(['sigma_BL = ' num2str(sigma_a*scale) ', sigma_a = ' num2str(sigma_a) ', sigma_n = ' num2str(noise_std)])
disp(['Noise std estimation error: ' num2str(est_error)])
disp(['Estimated processing degree: ' num2str(est_gamma)])
disp('------------------------')
end
end