资源简介
用于计算iwssim的源程序,基于信息加权的结构相似度计算
代码片段和文件信息
function [iwssim iwmse iwpsnr]= iwssim(oimg img iw_flag Nsc K L weight win blk_size parent sigma_nsq)
MAX_PSNR = 1000;
if (nargin < 2 | nargin > 11)
iwssim = -Inf;
iwmse = -Inf;
iwpsnr = -Inf;
disp([‘Input argument error‘]);
return;
end
if (size(oimg) ~= size(img))
iwssim = -Inf;
iwmse = -Inf;
iwpsnr = -Inf;
disp([‘Input argument error: images should have the same size‘]);
return;
end
if (~exist(‘iw_flag‘))
iw_flag = 1;
end
if (~exist(‘Nsc‘))
Nsc = 5;
end
if (~exist(‘K‘))
K = [0.01 0.03]; % default from [Wang et al IEEE-TIP 2004]
end
if (~exist(‘L‘))
L = 255;
end
if (~exist(‘weight‘))
weight = [0.0448 0.2856 0.3001 0.2363 0.1333]; % default from [Wang et al IEEE-Asilomar 2003]
end
if (exist(‘win‘))
winSz = size(win);
if (winSz(1) ~= winSz(2))
iwssim = -Inf;
iwmse = -Inf;
iwpsnr = -Inf;
disp([‘Window size error‘]);
return;
end
win_size = winSz(1);
else
win_size = 11; % default from [Wang et al IEEE-TIP 2004]
gwin_std = 1.5; % default from [Wang et al IEEE-TIP 2004]
win = fspecial(‘gaussian‘ win_size gwin_std); % default from [Wang et al IEEE-TIP 2004]
win = win/sum(win(:));
end
if (~exist(‘blk_size‘))
blk_size = 3; % spatial neighborhood size
end
if (~exist(‘parent‘))
parent = 1; % include parent neighbor
en
评论
共有 条评论