资源简介
针对结构相似度(Structural SIMilarity, SSIM)和其他一些方法的局限性, 考虑到梯度可以反映图像的边缘纹理等结构信息, 提出了一种快速的全参考型IQA算法,即提升的梯度加权结构相似度(Gradient Weighted Lifting Structural SIMilarity, GWL-SSIM)方法.
代码片段和文件信息
function GWL_SSIM = GWL_SSIM(imageRef imageDis)
%Input : (1) imageRef: the first image being compared
% (2) imageDis: the second image being compared
%
%Output: (1) GWL_SSIM: is the similarty score calculated using GWL_SSIM algorithm. GWL_SSIM
% only considers the luminance component of images.
%-----------------------------------------------------------------------
%
%Usage:
%Given 2 test images img1 and img2. For gray-scale images their dynamic range should be 0-255.
%For colorful images the dynamic range of each color channel should be 0-255.
% GWL_SSIM = GWL_SSIM(img1 img2);
%-----------------------------------------------------------------------
[rows cols junk] = size(imageRef);
if junk == 3 %images are colorful
Y1 = 0.299 * double(imageRef(::1)) + 0.587 * double(imageRef(::2)) + 0.114 * double(imageRef(::3));
Y2 = 0.299 * double(imageDis(::1)) + 0.587 * double(imageDis(::2)) + 0.114 * double(imageDis(::3));
else %images are grayscale
Y1 = double(imageRef);
Y2 = double(imageDis);
end
Y1 = double(Y1);
Y2 = double(Y2);
%%%%%%%%%%%%%%%%%%%%%%%%%% Download the image %%%%%%%%%%%%%%%%%%%%%%%%%
minDimension = min(rowscols);
F = max(1round(minDimension / 256));
aveKernel = fspecial(‘average‘F);
aveY1 = conv2(Y1 aveKernel‘same‘);
aveY2 = conv2(Y2 aveKernel‘same‘);
Y1 = aveY1(1:F:rows1:F:cols);
Y2 = aveY2(1:F:rows1:F:cols);
%%%%%%%%%%%%%%%%%%%%%%%%%% Calculate the gradient map%%%%%%%%%%%%%%%%%%%%%%%%%
dx = [1 0 -1; 1 0 -1; 1 0 -1]/3;
dy = [1 1 1; 0 0 0; -1 -1 -1]/3;%Prewitt operators
p=0.5;
IxY1 = conv2(Y1 dx ‘same‘);
评论
共有 条评论