图像评价基于无参考NIQE图像质量评价matlab源码

Posted Matlab咨询QQ1575304183

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了图像评价基于无参考NIQE图像质量评价matlab源码相关的知识,希望对你有一定的参考价值。

一、简介

新的模型称之为NIQE(Natural Image Quality Evaluator),这个模型的设计思路是基于构建一系列的用于衡量图像质量的特征,并且将这些特征用于拟合一个多元的高斯模型,这些特征是从一些简单并且高度规则的自然景观中提取;这个模型实际上是衡量一张待测图像在多元分布上的差异,这个分布是有一系列的正常的自然图像中提取的这些特征所构建的。

1 构建模型
空间域上的特征,称之为Spatial Domain NSS
按照如下的方式进行计算,首先是提取图像中的一个个patch,然后做下面这样的一个归一化
在这里插入图片描述
这里的μ \\muμ就是高斯权重,在最初的设计中这里的高斯权重是一个3x3的模板;看到上面的公式,这里就很明确了,上述实际上一个基于高斯平均值以及高斯标准差的一个归一化计算,相对于其他的一些指标,NIQE仅仅是计算正常的自然图像中的这个指标,毫无疑问的是不正常的图像多多少少会在这个指标上同正常图像的计算值会有一个歧离,从这个意义上讲,理论上NSS 可以适用于各种图像退化种类,基于这种思想设计的IQA可以权衡各种图像退化,而不是像某些指标那样仅仅是在某些退化种类上有很好的的表现。

patch的选择
如果需要计算上述的NSS指标,毫无疑问的是会造成图像被分裂为一个一个的patch,在NIQE的算法设计中,只有一部分patch是有用的,这就涉及到一个patch的选择问题;这里实际上有一个启发,比如我们关注一个分辨率退化图像时,我们会挑选那些原本应该是sharp的局部边缘进行观察,判断其分辨率是否受损,而不会整个图像的所有patch都观察一遍;这里定义了一种局部形变系数
在这里插入图片描述
这里的形变系数设置了一个阈值,在作者的实验中,这个阈值设置的是0.75,大于0.75的patch 可以选入进行下一步计算;这一步的操作是很好理解的,因为毕竟往往是形变系数越大的patch说明里面的内容越复杂,换而言之说明这里的内容所包含的信息更多。这里的σ \\sigmaσ就是上面步骤所述的σ \\sigmaσ计算

描述patch
之前的内容已经说明了patch的空间域特征以及如何选择patch,现在的问题在于如何设计指标来刻画我们选择的patch,这种刻画按照设计是一种借鉴高斯分布思想的指标,首先定义高斯分布类型的指标GGD
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、源代码

function [mu_prisparam cov_prisparam] = estimatemodelparam(folderpath,...

blocksizerow,blocksizecol,blockrowoverlap,blockcoloverlap,sh_th)


% Input

% folderpath - Folder containing the pristine images

% blocksizerow - Height of the blocks in to which image is divided

% blocksizecol - Width of the blocks in to which image is divided

% blockrowoverlap - Amount of vertical overlap between blocks

% blockcoloverlap - Amount of horizontal overlap between blocks

% sh_th - The sharpness threshold level

%Output

%mu_prisparam - mean of multivariate Gaussian model

%cov_prisparam - covariance of multivariate Gaussian model


% Example call


%[mu_prisparam cov_prisparam] = estimatemodelparam('pristine',96,96,0,0,0.75);



%----------------------------------------------------------------

% Find the names of images in the folder

current = pwd;

cd(sprintf('%s',folderpath))

names = ls;

names = names(3:end,:);%

cd(current)

% ---------------------------------------------------------------

%Number of features

% 18 features at each scale

featnum = 18;

% ---------------------------------------------------------------

% Make the directory for storing the features

mkdir(sprintf('local_risquee_prisfeatures'))

% ---------------------------------------------------------------

% Compute pristine image features

for itr = 1:size(names,1)

itr

im = imread(sprintf('%s\\\\%s',folderpath,names(itr,:)));

if(size(im,3)==3)

im = rgb2gray(im);

end

im = double(im);

[row col] = size(im);

block_rownum = floor(row/blocksizerow);

block_colnum = floor(col/blocksizecol);

im = im(1:block_rownum*blocksizerow, ...

1:block_colnum*blocksizecol);

window = fspecial('gaussian',7,7/6);

window = window/sum(sum(window));

scalenum = 2;

warning('off')


feat = [];



for itr_scale = 1:scalenum



mu = imfilter(im,window,'replicate');

mu_sq = mu.*mu;

sigma = sqrt(abs(imfilter(im.*im,window,'replicate') - mu_sq));

structdis = (im-mu)./(sigma+1);




feat_scale = blkproc(structdis,[blocksizerow/itr_scale blocksizecol/itr_scale], ...

[blockrowoverlap/itr_scale blockcoloverlap/itr_scale], ...

@computefeature);

feat_scale = reshape(feat_scale,[featnum ....

size(feat_scale,1)*size(feat_scale,2)/featnum]);

feat_scale = feat_scale';



if(itr_scale == 1)

sharpness = blkproc(sigma,[blocksizerow blocksizecol], ...

[blockrowoverlap blockcoloverlap],@computemean);

sharpness = sharpness(:);

end



feat = [feat feat_scale];


im =imresize(im,0.5);


end

function quality = computequality(im,blocksizerow,blocksizecol,...

blockrowoverlap,blockcoloverlap,mu_prisparam,cov_prisparam)


% Input1

% im - Image whose quality needs to be computed

% blocksizerow - Height of the blocks in to which image is divided

% blocksizecol - Width of the blocks in to which image is divided

% blockrowoverlap - Amount of vertical overlap between blocks

% blockcoloverlap - Amount of horizontal overlap between blocks

% mu_prisparam - mean of multivariate Gaussian model

% cov_prisparam - covariance of multivariate Gaussian model


% For good performance, it is advisable to use make the multivariate Gaussian model

% using same size patches as the distorted image is divided in to


% Output

%quality - Quality of the input distorted image


% Example call

%quality = computequality(im,96,96,0,0,mu_prisparam,cov_prisparam)


% ---------------------------------------------------------------

%Number of features

% 18 features at each scale

featnum = 18;

%----------------------------------------------------------------

%Compute features

if(size(im,3)==3)

im = rgb2gray(im);

end

im = double(im);

[row col] = size(im);

block_rownum = floor(row/blocksizerow);

block_colnum = floor(col/blocksizecol);


im = im(1:block_rownum*blocksizerow,1:block_colnum*blocksizecol);

[row col] = size(im);

block_rownum = floor(row/blocksizerow);

block_colnum = floor(col/blocksizecol);

im = im(1:block_rownum*blocksizerow, ...

1:block_colnum*blocksizecol);

window = fspecial('gaussian',7,7/6);

window = window/sum(sum(window));

scalenum = 2;

warning('off')


feat = [];


三、运行结果

在这里插入图片描述

完整代码或仿真咨询QQ1575304183

以上是关于图像评价基于无参考NIQE图像质量评价matlab源码的主要内容,如果未能解决你的问题,请参考以下文章

图像评价基于无参考NIQE图像质量评价matlab源码

基于nsct变换特征提取和模糊神经网络的无参考图像质量评价算法matlab仿真

图像评价基于matlab GUI图像质量评价含Matlab源码 1373期

图像评价基于matlab GUI图像质量评价含Matlab源码 1373期

图像评价基于matlab GUI图像评价系统含Matlab源码 2185期

NSCT+GRNN网络基于NSCT变换和GRNN神经网络的无参考图像质量检测算法的MATLAB仿真