A list,

The new model, called NIQE(Natural Image Quality Evaluator), is based on building a series of features used to measure Image Quality and fitting them into a multivariate Gaussian model. These features are extracted from simple and highly regular landscapes; This model actually measures the difference in a multivariate distribution of an image under test, which is constructed by extracting these features from a series of normal natural images.

1. Model Building

The features in Spatial Domain are called Spatial Domain NSS

The calculation is carried out in the following way: firstly, patch by patch in the image is extracted, and then a normalization as follows is performed



μ \muμ is the Gaussian weight, which in the original design was a 3×3 template; See the formula above, here is very clear, this is actually a based on gaussian average value and standard deviation of the gaussian a normalized calculation, relative to other indicators, NIQE just calculate the index of the normal natural images, there is no doubt that it is not normal image more or less on the index with the calculated value of the normal image will have a deviation, In this sense, THEORETICALLY NSS can be applied to all kinds of image degradation, and IQA designed based on this idea can weigh all kinds of image degradation, instead of just having good performance on some degradation types like some indicators.

The choice of the patch

If the above NSS index needs to be calculated, there is no doubt that the image will be split into patches one by one. In the algorithm design of NIQE, only a part of patches are useful, which involves the selection of a patch. In fact, there is an inspiration here. For example, when we pay attention to an image with degraded resolution, we will select the local edges that should be sharp to observe and judge whether the resolution is damaged, rather than observe all patches of the whole image. A local deformation coefficient is defined here



Here, a threshold value is set for the deformation coefficient. In the author’s experiment, the threshold value is 0.75. Patches larger than 0.75 can be selected for the next calculation. This step is easy to understand, because after all, the larger the deformation coefficient is, the more complex the content is. In other words, the content contains more information. Sigma sigma here is the sigma sigma calculation described in the previous step

Describe the patch

The previous content has explained the spatial domain characteristics of patch and how to select patch. Now the problem lies in how to design indicators to depict the patch we choose. According to the design, such characterization is an indicator referring to the idea of Gaussian distribution





Ii. Source code

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             = [];
Copy the code

3. Operation results

Fourth, note

Version: 2014 a