📄 plot_feature.m
字号:
clear all;
close all;
clc;
id = 60;
std = 15;
w_size = 5;
%==============================
% image read
%==============================
%noisy image x+w
s1 = 'E:\KODAK_PNG\noise\';
s2 = sprintf('img%02d', id);
s3 = '\';
s4 = sprintf('noise_std%02d',std);
s5 = '.png';
originalfile = strcat(s1,s2,s3, s4,s5);
a = imread(originalfile,'png');
noise = (double(uint8(a)));
noise_img = noise;
s4 = sprintf('noise_std%02d',0);
originalfile = strcat(s1,s2,s3, s4,s5);
a = imread(originalfile,'png');
ori = (double(uint8(a)));
ori_img = ori;
%===========================================================================
% Masking operation for finding homogeneous blocks
%---------------------------------------------------------------------------
Cnt = 0;
img_width = size(noise,1);
img_height = size(noise,2);
center = median(1:w_size);
% r1 = 0.3;%0.98;
% r2 = 0.6;%0.01;
% r3 = 0.1;%0.01;
r1 = 0.2;%0.98;
r2 = 0.5;%0.01;
r3 = 0.3;%0.01;
ratio = 0.0001;
y_term = 125;
I_noise = uint8(r1 *noise_img(:,:,1) + r2*noise_img(:,:,2) + r3*noise_img(:,:,3));
I_ori = uint8(r1 *ori_img(:,:,1) + r2*ori_img(:,:,2) + r3*ori_img(:,:,3));
mI_noise = ratio.*double(I_noise) + y_term;
mI_ori = ratio.*double(I_ori) + y_term;
alpha = mI_noise - double(I_noise);
alpha0 = mI_ori - double(I_ori);
m_noise_R = noise_img(:,:,1) + alpha;
m_noise_G = noise_img(:,:,2) + alpha;
m_noise_B = noise_img(:,:,3) + alpha;
m_noise = noise;
m_ori_R = ori_img(:,:,1) + alpha0;
m_ori_G = ori_img(:,:,2) + alpha0;
m_ori_B = ori_img(:,:,3) + alpha0;
m_ori = noise;
m_noise(:,:,1) = m_noise_R;
m_noise(:,:,2) = m_noise_G;
m_noise(:,:,3) = m_noise_B;
m_ori(:,:,1) = m_ori_R;
m_ori(:,:,2) = m_ori_G;
m_ori(:,:,3) = m_ori_B;
m_noise_img = double(m_noise);
m_ori_img = double(m_ori);
%ori = m_ori;
%noise = m_noise;
for i=1:w_size:img_width-w_size %x
for j=1:w_size:img_height-w_size %y
Cnt = Cnt+1;
x_loc = i:i+w_size-1;
y_loc = j:j+w_size-1;
rw(Cnt) = std2(noise(x_loc,y_loc,1));
or(Cnt) = std2(ori(x_loc,y_loc,1));
wr(Cnt) = sqrt(rw(Cnt)^2-or(Cnt)^2);
mrw(Cnt) = std2(m_noise(x_loc,y_loc,1));
mor(Cnt) = std2(m_ori(x_loc,y_loc,1));
mwr(Cnt) = sqrt(mrw(Cnt)^2-mor(Cnt)^2);
end
end
figure;plot(or,wr,'x');grid
xlabel('standard deviation of original image');
ylabel('standard deviation of AWGN');
title(['image id=' ,num2str(id),', window size=' ,num2str(w_size), 'given std =', num2str(std)]);
figure;plot(mor,mwr,'x');grid
xlabel('standard deviation of original image');
ylabel('standard deviation of AWGN');
title(['image id=' ,num2str(id),', window size=' ,num2str(w_size), 'given std =', num2str(std)]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -