background
One day, I searched a wave of image quality evaluation on Zhihu and found the following paragraph: “Researchers in the field of image quality evaluation have said that ‘quality evaluation is irrigation’; Graduate students are also terrified of being forced to do this by their tutors: ‘How can I guarantee myself a good job in the future by evaluating the image quality of new students, opening the first year of study and graduate school, and the tutors not allowing me to do projects? “In your case, the best option is to stop going to graduate school and go straight to work. “I don’t think [image quality reviews] make any sense,” said the IQA guy whose boss was driving him crazy. The public question the practical meaning of quality evaluation: ‘Why do we evaluate the quality of images? In other words, what are the practical applications of our evaluation of image quality? First of all, at the present stage, academic evaluation is all about a variety of databases and distorted images. Hundreds of methods have been proposed. However, even in the face of natural image Challenge database, we still feel powerless. Secondly, human evaluation standards are very complex, and the evaluation system hidden in the database only represents the evaluation of those surveyed, which does not necessarily conform to the visual consistency of the whole human. So what is the meaning of thousands of core journals evaluating image quality each year without a completely correct reference standard and a wide range of practical applications? ‘” (The above content is from Zhihu)
In fact, image quality evaluation is far from being a flood beast or “just pouring water”. From my perspective, I think the field is more of a research service for a part of the image field, with more academic applications than engineering applications. In essence, what Image Quality Assessment (IQA) is doing is to explore the underlying laws behind human visual evaluation, such as what kind of Image people think is “poor visual experience”, and how to quantify the visual evaluation of human eyes, which is actually quite interesting. The only drawback is that it is difficult to apply to engineering applications. Machine learning, deep learning, reinforcement learning and other current popular direction, is also known as “in the exploration of human thinking mode and way of scientific research”, but really rely on computer science to uncover the potential law of human brain thinking, this day is not our generation can witness. Current “learning” is still limited to training a non-linear model through data sets to minimize loss function errors.
Back to the main theme of this article, images, quality, and evaluation, it’s easy to explain why you should evaluate the quality of an image: If there is no set of authoritative and unified quantitative indicators, people will say “the method proposed in this paper is better than the state-of-art method” when they do experiments and publish papers. Because there is no measurement standard, people will be free to fly at will. In order to avoid this situation, and to ensure the rigor of scientific research, image quality evaluation is also born. So, in the previous section, I would describe this field as “more like research in the service of a part of the image field, more academic than engineering.” After all, engineering applications do not care about image quality evaluation, users feel good that is good, and academic research is more focused on quantitative evaluation, good indicators is good, there is no reason that my accuracy rate is higher than you, image quality evaluation results are better than you, is not recognized? So, image quality assessment IQA is all about that. Sometimes IQA, of course, also has the effect of engineering application, such as making industry standards, national standards (such as a blogger, dean of the college, made a very authoritative standard in printing industry, so there are times when IQA also provide help for non-academic related applications), IQA can come in handy at this time, but the end, There is little need for IQA in industrial applications.
Full reference and blind assessment
IQA is divided into two cases to discuss. The first case is that we have Reference Image, which is called Full Reference Image quality assessment; The other is Blind image quality assessment. Actually there is a call half reference images, but because there is no limit information conditions, this type of research on all kind of water, what is called a reference, a reference and reference, these are not unified standards, even some of the so-called half reference quality evaluation with more information than the reference also exaggerated, that’s what half a reference, reference is reference, no reference is no reference, Can this fall in the middle? Plagiarism is plagiarism, no plagiarism is not plagiarism, half plagiarism is what ghost, is such a truth. So semi-references are usually areas that are not recognized or are classified as fully referenced.
For full reference evaluation, it is well understood that I have a standard undistorted image to evaluate the image quality, while blind image evaluation is the image quality evaluation without reference image. Below are some of the most common image quality assessment methods.
Full Reference: Image similarity — Color Difference (CD)
Purely from the perspective of vector values, it is easy to think of Euclidean Distance or Angle difference if the similarity between two vectors is to be measured. Chromatic aberration is the Euclidean distance in the image, of which the most typical representative is Mean Square Error (MSE), which is to solve the sum of the distance measures of the distorted image and the reference image at each pixel and then calculate the average, which is well understood, as shown in the following formula:
Among them,Represents the number of pixels in length and width of the image,Represents distortion image and reference image respectively.
MSE essentially calculates the chromatic aberration in sRGB color space. The significant problems are inconsistent color perception of human eyes and neglect of spatial information of images.
CIELAB Color Space is closer to human eye Color perception than sRGB Color Space, and L* U * V * Color Space further improves this point. It is a relatively authoritative Uniform Color Space, that is, the quantitative changes of Color in any direction are consistent with human eye Color perception.
Transform sRGB color space to L* U * V * as follows:
Since sRGB is device-related color space and L* U * V * is device-independent color space, a transformation to XYZ color space (device-independent) is needed as a transition, as follows:
Among them
Among them,.R, G, and B are the values of sRGB channels. It should be noted that the XYZ color space requires a pre-selected reference white to determine the transformation matrix, and here we default to the reference white under the D65 light source.
The calculation of L*u*v* is based on Lu’v’ color space. It should be noted that the two are not the same thing, and the calculation of Lu’v’ color space is transformed as follows:
The calculation of u*v* is as follows:
Among themWhite for standard referenceIn general, we use the reference white under the D65 light source, and the result is. (The XYZ tristimulus value of reference white under D65 light source is, can be checked by the formula)
And L* U * V * chromatic aberration is the Euclidean distance in L* U * V * color space.
Full Reference: Image similarity Peak Signal to Noise Ratio (PSNR)
Peak Signal to Noise Ratio (PSNR), an objective standard for evaluating images, stands for “Peak Signal to Noise Ratio”. Peak means the highest point. And ratio means ratio. The whole meaning is to reach the peak of the noise ratio signal, PSNR is generally used for an engineering project between the maximum signal and background noise. Usually after image compression, the output image is usually different from the original image to some extent. In order to measure the quality of the processed image, we usually refer to the PSNR value to measure whether a certain process is satisfactory. It is the log of the mean square error between the original image and the image being processed (2^n-1)^2 (the square of the maximum value of the signal, where n is the number of bits per sample value) in dB.
Since images and images are multidimensional signals in nature, the degree of distortion can be calculated by PSNR. Its function is similar to MSE (because it is based on MSE solution, it feels a little rogue), as follows:
Where, MAX is the maximum dynamic range of the image, if the default range [0,255] substituted into the solution, there will be a negative value, and after normalization ([0,1] dynamic range of the image) results are relatively normal, so in the calculation of the need to do a./255 image processing in matlab.
Full reference: Image SIMilarity — Image Structural SIMilarity Index (SSIM)
The following figure reveals the superiority of SSIM in considering image structure and image local spatial information performance, and also exposes the problems of chromatic aberration and PSNR. As shown in the figure below, the picture on the ring of MSE and PSNR values are the same, but from the perspective of subjective visual assessment, we believe that the quality of the above picture is obviously higher than below a few pieces of, but from the perspective of the quantitative value of MSE and PSNR, circle some distortion in the image on the image quality is the same, it is not in visual perception. This is because the human eye is more sensitive to changes in the adjacent area, while MSE and PSNR do not consider the information on the spatial information.
The calculation method of SSIM is as follows:
Among them,Represent the image separatelyWith imageIs the mean pixel value of, whilewithRespectively represent the variance of the image. while., T represents the dynamic range of image pixel value.
However, it should be pointed out that SSIM is not superior to chromatic aberration and PSNR in all cases. It is more appropriate to say that SSIM varies in certain cases.
We can see the difference between SSIM and MSE from several sets of test images.
It can be found that SSIM index Map can capture the human perception error more accurately, and the description of the edge of the distorted image is obviously more accurate than MSE. The following figure illustrates the same problem.
Let’s look at the quantization results of distortion of a group of images under MSE and SSIM. Figure 1 is taken as the reference image in the following figure. The image in Figure 2 and Figure 3 is obviously of higher visual quality than that in Figure 456, but from the perspective of MSE, the MSE of 23456 is basically the same.
Blind Reference: Color Colorfulness Index (CCI)
Image similarity is typical in full reference images because we can only assess the distortion of an image if we have a reference image. However, blind reference image quality evaluation depends on the specific application. In terms of the image color field that bloggers are familiar with, color richness CCI is a commonly used image evaluation method, which is used to describe the richness of image color information, as follows:
Among them,Represents the mean value of image saturation, whileRepresents the standard deviation of saturation.
It is easy to understand, with image color saturation and to express the degree of colorful color saturation of the perturbation on the one hand, the color can use hue, saturation and brightness described in three dimensions, then by saturation mean and deviation of rights, such as addition can well describe the colorful, but also has some shortcomings, lack of the consideration for the two weights.
Actual code
MSE
% Matlab 2017a
function MSE=MSE_compute(img1,img2)
[m,n,k]=size(img1);
[m2,n2,k2]=size(img2);
if m==m2 && n==n2 && k==k2
MSE=sqrt(sum(sum(sum((img1-img2).^2)))./(m*n));
end
end
Copy the code
Lu*v* CD
functionLuvcd = luvcolordifference (img1, img2) WHITEPOINT = [0.950456, 1,1.088754]; WHITEPOINTU=(4*WHITEPOINT(1))./(WHITEPOINT(1)+15*WHITEPOINT(2)+3*WHITEPOINT(3)); WHITEPOINTV=(9*WHITEPOINT(1))./(WHITEPOINT(1)+15*WHITEPOINT(2)+3*WHITEPOINT(3)); [m,n,k]=size(img1); Img1 = img1 + 0.0000001 * ones (m, n, k); L=zeros(m,n); xyz=rgb2xyz(img1./255,'WhitePoint'.'d65');
u=4*xyz(:,:,1)./(xyz(:,:,1)+15.*xyz(:,:,2)+3.*xyz(:,:,3));
v=9*xyz(:,:,2)./(xyz(:,:,1)+15.*xyz(:,:,2)+3.*xyz(:,:,3));
for i=1:m
for j=1:n
ifXyz (I, j, 2) < = 0.008856 L (I, j) = 903.3 * xyz (I, j, 2);elseL(i,j)=116*(xyz(i,j,2)).^(1/3)-16; end end end uu=13.*L.*(u-WHITEPOINTU.*ones(m,n)); vv=13.*L.*(v-WHITEPOINTV.*ones(m,n)); Img2 = img2 + 0.0000001 * ones (m, n, k); L2=zeros(m,n); xyz2=rgb2xyz(img2./255,'WhitePoint'.'d65');
u2=4*xyz2(:,:,1)./(xyz2(:,:,1)+15.*xyz2(:,:,2)+3.*xyz2(:,:,3));
v2=9*xyz2(:,:,2)./(xyz2(:,:,1)+15.*xyz2(:,:,2)+3.*xyz2(:,:,3));
for i1=1:m
for j1=1:n
ifXyz2 (i1, j1, 2) < = 0.008856 L2 (i1, j1) = 903.3 * xyz2 (i1, j1, 2);elseL2 (i1, j1) = 116 * (xyz2 (i1, j1, 2)). ^ (1/3) - 16; end end end uu2=13.*L2.*(u2-WHITEPOINTU.*ones(m,n)); vv2=13.*L2.*(v2-WHITEPOINTV.*ones(m,n)); luvcd = mean(mean(sqrt((L-L2).^2+(uu-uu2).^2 +(vv-vv2).^2))); endCopy the code
PSNR
function [peaksnr, snr] = psnr(A, ref, peakval)
checkImages(A,ref);
if nargin < 3
peakval = diff(getrangefromclass(A));
else
checkPeakval(peakval, A);
peakval = double(peakval);
end
if isempty(A) % If A is empty, ref must also be empty
peaksnr = zeros(0, 'like', A);
snr = zeros(0, 'like', A);
return;
end
err = immse(A,ref);
peaksnr = 10*log10(peakval.^2/err);
if nargout > 1
if isinteger(ref)
ref = double(ref);
end
snr = 10*log10(mean(ref(:).^2)/err);
end
end
function checkImages(A, ref)
validImageTypes = {'uint8'.'uint16'.'int16'.'single'.'double'};
validateattributes(A,validImageTypes,{'nonsparse'},mfilename,'A', 1); validateattributes(ref,validImageTypes,{'nonsparse'},mfilename,'REF', 2);if ~isa(A,class(ref))
error(message('images:validate:differentClassMatrices'.'A'.'REF'));
end
if ~isequal(size(A),size(ref))
error(message('images:validate:unequalSizeMatrices'.'A'.'REF'));
end
end
function checkPeakval(peakval, A)
validateattributes(peakval,{'numeric'}, {'nonnan'.'real'.'nonnegative'.'nonsparse'.'nonempty'.'scalar'}, mfilename, ...
'PEAKVAL', 3);if isinteger(A) && (peakval > diff(getrangefromclass(A)))
warning(message('images:psnr:peakvalTooLarge'.'A'.'REF'));
end
end
Copy the code
SSIM
function [ssimval, ssimmap] = ssim(varargin)
narginchk(2,10);
[A, ref, C, exponents, radius] = parse_inputs(varargin{:});
if isempty(A)
ssimval = zeros(0, 'like', A);
ssimmap = A;
return;
end
if isa(A,'int16') % int16 is the only allowed signed-integer type for A and ref.
% Add offset for signed-integer types to bring values in the
% non-negative range.
A = double(A) - double(intmin('int16'));
ref = double(ref) - double(intmin('int16'));
elseif isinteger(A)
A = double(A);
ref = double(ref);
end
% Gaussian weighting function
gaussFilt = getGaussianWeightingFilter(radius,ndims(A));
% Weighted-mean and weighted-variance computations
mux2 = imfilter(A, gaussFilt,'conv'.'replicate');
muy2 = imfilter(ref, gaussFilt,'conv'.'replicate');
muxy = mux2.*muy2;
mux2 = mux2.^2;
muy2 = muy2.^2;
sigmax2 = imfilter(A.^2,gaussFilt,'conv'.'replicate') - mux2;
sigmay2 = imfilter(ref.^2,gaussFilt,'conv'.'replicate') - muy2;
sigmaxy = imfilter(A.*ref,gaussFilt,'conv'.'replicate') - muxy;
% Compute SSIM index
if(3) = (C = C (2) / 2) && isequal (exponents (:), 'ones (3, 1)) % Specialcase: Equation 13 from [1]
num = (2*muxy + C(1)).*(2*sigmaxy + C(2));
den = (mux2 + muy2 + C(1)).*(sigmax2 + sigmay2 + C(2));
if (C(1) > 0) && (C(2) > 0)
ssimmap = num./den;
else
% Need to guard against divide-by-zero if either C(1) or C(2) is 0.
isDenNonZero = (den ~= 0);
ssimmap = ones(size(A));
ssimmap(isDenNonZero) = num(isDenNonZero)./den(isDenNonZero);
end
else
% General case: Equation 12 from [1]
% Luminance term
if (exponents(1) > 0)
num = 2*muxy + C(1);
den = mux2 + muy2 + C(1);
ssimmap = guardedDivideAndExponent(num,den,C(1),exponents(1));
else
ssimmap = ones(size(A), 'like', A);
end
% Contrast term
sigmaxsigmay = [];
if (exponents(2) > 0)
sigmaxsigmay = sqrt(sigmax2.*sigmay2);
num = 2*sigmaxsigmay + C(2);
den = sigmax2 + sigmay2 + C(2);
ssimmap = ssimmap.*guardedDivideAndExponent(num,den,C(2),exponents(2));
end
% Structure term
if (exponents(3) > 0)
num = sigmaxy + C(3);
if isempty(sigmaxsigmay)
sigmaxsigmay = sqrt(sigmax2.*sigmay2);
end
den = sigmaxsigmay + C(3);
ssimmap = ssimmap.*guardedDivideAndExponent(num,den,C(3),exponents(3));
end
end
ssimval = mean(ssimmap(:));
end
% -------------------------------------------------------------------------
function component = guardedDivideAndExponent(num, den, C, exponent)
if C > 0
component = num./den;
else
component = ones(size(num),'like',num);
isDenNonZero = (den ~= 0);
component(isDenNonZero) = num(isDenNonZero)./den(isDenNonZero);
end
if (exponent ~= 1)
component = component.^exponent;
end
end
function gaussFilt = getGaussianWeightingFilter(radius,N)
% Get 2D or 3D Gaussian weighting filter
filtRadius = ceil(radius*3); % 3 Standard deviations include >99% of the area.
filtSize = 2*filtRadius + 1;
if (N < 3)
% 2D Gaussian mask can be used for filtering even one-dimensional
% signals using imfilter.
gaussFilt = fspecial('gaussian',[filtSize filtSize],radius);
else
% 3D Gaussian mask
[x,y,z] = ndgrid(-filtRadius:filtRadius,-filtRadius:filtRadius, ...
-filtRadius:filtRadius);
arg = -(x.*x + y.*y + z.*z)/(2*radius*radius);
gaussFilt = exp(arg);
gaussFilt(gaussFilt<eps*max(gaussFilt(:))) = 0;
sumFilt = sum(gaussFilt(:));
if (sumFilt ~= 0)
gaussFilt = gaussFilt/sumFilt;
end
end
end
function [A, ref, C, exponents, radius] = parse_inputs(varargin)
validImageTypes = {'uint8'.'uint16'.'int16'.'single'.'double'};
A = varargin{1};
validateattributes(A,validImageTypes,{'nonsparse'.'real'},mfilename,'A', 1); ref = varargin{2}; validateattributes(ref,validImageTypes,{'nonsparse'.'real'},mfilename,'REF', 2);if ~isa(A,class(ref))
error(message('images:validate:differentClassMatrices'.'A'.'REF'));
end
if ~isequal(size(A),size(ref))
error(message('images:validate:unequalSizeMatrices'.'A'.'REF'));
end
if (ndims(A) > 3)
error(message('images:validate:tooManyDimensions'.'A and REF', 3)); end % Default valuesforparameters dynmRange = diff(getrangefromclass(A)); C = []; exponents = [1 1 1]; The radius = 1.5; args_names = {'dynamicrange'.'regularizationconstants'.'exponents'.'radius'};
for i = 3:2:nargin
arg = varargin{i};
if ischar(arg)
idx = find(strncmpi(arg, args_names, numel(arg)));
if isempty(idx)
error(message('images:validate:unknownInputString', arg))
elseif numel(idx) > 1
error(message('images:validate:ambiguousInputString', arg))
elseif numel(idx) == 1
if (i+1 > nargin)
error(message('images:validate:missingParameterValue'));
end
if idx == 1
dynmRange = varargin{i+1};
validateattributes(dynmRange,{'numeric'}, {'positive'.'finite'.'real'.'nonempty'.'scalar'}, mfilename, ...
'DynamicRange',i);
dynmRange = double(dynmRange);
elseif idx == 2
C = varargin{i+1};
validateattributes(C,{'numeric'}, {'nonnegative'.'finite'.'real'.'nonempty'.'vector'.'numel', 3}, mfilename, ...
'RegularizationConstants',i);
C = double(C);
elseif idx == 3
exponents = varargin{i+1};
validateattributes(exponents,{'numeric'}, {'nonnegative'.'finite'.'real'.'nonempty'.'vector'.'numel', 3},... mfilename,'Exponents',i);
exponents = double(exponents);
elseif idx == 4
radius = varargin{i+1};
validateattributes(radius,{'numeric'}, {'positive'.'finite'.'real'.'nonempty'.'scalar'}, mfilename,'Radius',i);
radius = double(radius);
end
end
else
error(message('images:validate:mustBeString'));
end
end
% If 'RegularizationConstants' is not specified, choose default C.
ifIsempty (C) C = [(0.01 * dynmRange). ^ 2 (0.03 * dynmRange). ^ 2 ((0.03 * dynmRange). ^ 2) / 2]; end endCopy the code
CCI
img=double(imread('testimage.png'));
[m,n,k]=size(img);
img_hsv=rgb2hsv(img);
S_average=mean(mean(img_hsv(:,:,2)));
S_standarddeviation=sqrt(sum(sum(1/(m*n).*(img_hsv(:,:,2)-S_average.*ones(m,n)).^2)));
CCI=S_average+S_standarddeviation
function [h, s, v] = rgb2hsv(varargin)
[r, g, b, isColorMap, isEmptyInput, isThreeChannel] = parseInputs(varargin{:});
if(~isEmptyInput)
if(isThreeChannel)
imageIn(:,:,1) = r;
imageIn(:,:,2) = g;
imageIn(:,:,3) = b;
elseif(isColorMap)
imageIn = reshape(varargin{1},size(varargin{1},1),1,size(varargin{1},2));
else
imageIn = r;
end
h = images.internal.rgb2hsvmex(imageIn);
if(nargout == 3)
s = h(:,:,2);
v = h(:,:,3);
h = h(:,:,1);
elseif(isColorMap)
h = reshape(h,size(h,1), size(h,3));
end
else
if(isThreeChannel)
h = r;
s = g;
v = b;
else
h = r;
end
end
end
function [r, g, b, isColorMap, isEmptyInput, isThreeChannel] = parseInputs(varargin)
isColorMap = 0;
isEmptyInput = 0;
isThreeChannel = 0;
if (nargin == 1)
r = varargin{1};
g = [];
b = [];
if (ndims(r)==3)
if isempty(r)
isEmptyInput = 1;
return
end
if(size(r,3) ~= 3)
error(message('MATLAB:rgb2hsv:invalidInputSizeRGB'));
end
validateattributes(r, {'uint8'.'uint16'.'double'.'single'}, {'real'}, mfilename, 'RGB', 1);
elseif ismatrix(r) %M x 3 matrix for M colors.
isColorMap = 1;
if(size(r,2) ~=3)
error(message('MATLAB:rgb2hsv:invalidSizeForColormap'));
end
validateattributes(r, {'double'}, {'real'.'nonempty'.'nonsparse'}, mfilename, 'M');
if((any(r(:) < 0) || any(r(:) > 1)))
error(message('MATLAB:rgb2hsv:badMapValues'));
end
else
error(message('MATLAB:rgb2hsv:invalidInputSize'));
end
elseif (nargin == 3)
isThreeChannel = 1;
r = varargin{1};
g = varargin{2};
b = varargin{3};
if isempty(r) || isempty(g) || isempty(b)
isEmptyInput = 1;
return
end
validateattributes(r, {'uint8'.'uint16'.'double'.'single'}, {'real'.'2d'}, mfilename, 'R', 1);
validateattributes(g, {'uint8'.'uint16'.'double'.'single'}, {'real'.'2d'}, mfilename, 'G', 2);
validateattributes(b, {'uint8'.'uint16'.'double'.'single'}, {'real'.'2d'}, mfilename, 'B', 3);
if ~isa(r, class(g)) || ~isa(g, class(b)) || ~isa(r, class(b)) % mixed type inputs.
r = im2double(r);
g = im2double(g);
b = im2double(b);
end
if ~isequal(size(r),size(g),size(b))
error(message('MATLAB:rgb2hsv:InputSizeMismatch'));
end
else
error(message('MATLAB:rgb2hsv:WrongInputNum'));
end
end
Copy the code
Implementation of the case
clc,clear,close all
img1=double(imread('img_original.png'));
img2=double(imread('img_2.png'));
img3=double(imread('img_3.png'));
img4=double(imread('img_4.png'));
figure
subplot(221)
imshow(uint8(img1))
title('Reference Image 1')
subplot(222)
imshow(uint8(img2))
title('Distorted image 2')
subplot(223)
imshow(uint8(img3))
title('Distorted image 3')
subplot(224)
imshow(uint8(img4))
title('Distorted image 4')
Copy the code
Load the image and display it
%% MSE
MSEofimg2=MSE_compute(img1,img2)
MSEofimg3=MSE_compute(img1,img3)
MSEofimg4=MSE_compute(img1,img3)
Copy the code
MSE calculation results
MSEofimg2 =
12.0006
MSEofimg3 =
11.0482
MSEofimg4 =
11.0482
Copy the code
It can be found that the MSE measures of the three images have little difference.
PSNR is calculated as follows,
%% PSNR
PSNRofimg2=psnr(img1./255,img2./255)
PSNRofimg3=psnr(img1./255,img3./255)
PSNRofimg4=psnr(img1./255,img4./255)
Copy the code
The results are as follows:
PSNRofimg2 =
26.5468
PSNRofimg3 =
27.2650
PSNRofimg4 =
27.6282
Copy the code
Again, PSNR doesn’t differ much.
SSIM:
%% SSIM
SSIMofimg2=ssim(img1./255,img2./255)
SSIMofimg3=ssim(img1./255,img3./255)
SSIMofimg4=ssim(img1./255,img4./255)
Copy the code
SSIMofimg2 =
0.9871
SSIMofimg3 =
0.7427
SSIMofimg4 =
0.7162
Copy the code
Under the measurement of SSIM, the differences in visual quality of the three images can finally be significantly reflected. It should be noted that the solution of SSIM also requires the dynamic range of pixels of the image to be between [0,1].
Since chromatic aberration is mainly used in color image calculation, we do not use Einstein’s gray scale image to calculate chromatic aberration, and reload a pair of color images with changed color.
clc,clear,close all
img1=double(imread('testcolorimg1.png'));
img2=double(imread('testcolorimg2.png'));
figure,subplot(121),imshow(uint8(img1)),title('Original image')
subplot(122),imshow(uint8(img2)),title('Distorted image')
Copy the code
Load the image
%% image similarity index calculation LuvCDofimg= Luvcolordifference (IMg1, IMG2) SSIMofimg= SSIM (IMg1./255, IMG2./255) MSE=MSE_compute(IMg1, IMG2)Copy the code
LuvCDofimg =
10.6537
SSIMofimg =
0.6408
MSE =
25.6127
Copy the code
Finally, the calculation of color richness
img=img1;
[m,n,k]=size(img);
img_hsv=rgb2hsv(img);
S_average=mean(mean(img_hsv(:,:,2)));
S_standarddeviation=sqrt(sum(sum(1/(m*n).*(img_hsv(:,:,2)-S_average.*ones(m,n)).^2)));
CCI=S_average+S_standarddeviation
img=img2;
[m,n,k]=size(img);
img_hsv=rgb2hsv(img);
S_average=mean(mean(img_hsv(:,:,2)));
S_standarddeviation=sqrt(sum(sum(1/(m*n).*(img_hsv(:,:,2)-S_average.*ones(m,n)).^2)));
CCI2=S_average+S_standarddeviation
Copy the code
The calculated results of the color richness of the two images are as follows:
CCI =
0.9007
CCI2 =
0.9491
Copy the code
Quantitative evaluation shows that test color image 2 (maple leaf image with blue background) is more colorful than test color image 1.
Write in the last
Image quality evaluation is used to testify the superiority of the proposed method in the image field, and there should be corresponding evaluation indexes for most of the research fields. So if you find that there is a lack of research in an area, you might as well spend some time on it. If you can come up with quantifiable indicators that are sufficiently interpretable, you will not only be able to publish a paper demonstrating your research ability, but you will be able to make it easier for future researchers.
In addition, although some evaluation indicators based on data sets are not directly related to images, they are sometimes very important in the field of images. Energetic friends can learn about them, such as precision, recall and K-fold cross validation.
Among them, K-fold cross validation is an evaluation method adopted when the size of data set is small, which is very practical, as shown in the figure below
Image quality evaluation research rookie: based on probability model, based on neural network, based on low-level features and other image quality evaluation methods
- Methods based on probability model:
In this kind of method, the statistical probability model between image features and image quality is firstly established, and the multivariate Gaussian distribution is mostly used to describe the probability distribution. For the evaluation image, the image quality of maximum posteriori probability is calculated according to probability model after feature extraction, or the image quality is estimated according to the degree of matching with probability model (such as the distance between features). Complex models will require more data, and such approaches are likely to perform well only when data volumes are large.
- Methods based on neural network:
This method firstly extracts certain image transformation domain or spatial features, then trains a neural network regression analysis model based on known quality data, and predicts image quality by image features. But want me to evaluate image quality assessment of the probability model and neural network, I want to say, based on the training (based on probability model and the method of neural network) method is essentially to play rascal = = on the one hand, can’t reveal potential rule of the human eye vision features, on the other hand you take out what’s the use of a black box model… So the following method is my favorite!
- Methods based on low-level features:
These methods evaluate the quality of an image by the degree of distortion of some low-level features of the image, such as texture, gradient, and color. Some of these low-level feature-based methods are still state-of-the-art (the drawback is slow computation, but slow computation is not a fatal flaw in image quality assessment).
Image quality assessment public data set
There are many databases for image quality evaluation, with various distortion types for various images, but the most recognized are LIVE, CSIQ,TID2008 and TID2013 data sets. These libraries all provide the subjective score value of each distorted image, which is the quantified reference value of image quality. The first two data sets are mainly aimed at common distortion types, namely additive Gaussian white noise, Gaussian blur, JPEG compression and JPEG2000 compression, while TID2013 contains 3000 distortion images. The number of subjective experiment scores is 917, which is of course the highest authority, but as the number of distortion types is as high as 25, It’s also the hardest. The following two tables are the database overview and the types of distortion included respectively.