Git Product home page Git Product logo

image-quality-tools's Introduction

Please add all the images in the "image" folder which is in the root/home directory and
follow the convention given below. 

To run these tests:
Go to the folder where sim_msssim.m, psnr.m and sim_ssim.m files are
(1) To run MSSIM test go do "[MSSSIM_VALUE] = sim_msssim" in Matlab. The value returned by the sim_msssim function is set 
to MSSSIM_VALUE 
(2) To run SSIM test do "[SSIM_VALUE] = sim_ssim" in Matlab. The value returned by the sim_ssim function is set 
to sSIM_VALUE 
(3) To run PSNR test do "[PSNR_VALUE] = psnr" in Matlab. The value returned by the psnr function is set 
to PSNR_VALUE
(4) To metrix_mux library (details of the library provided below) go to the metrix_mux folder do something like "[values] = sim_metrix_mux('SSIM')".
When simulating this you have to provide testName to run that test otherwise PSNR is the default test when run like "[values] = sim_metrix_mux"

For our usecase it would be following

1. [values] = sim_metrix_mux('SSIM');
2. [values] = sim_metrix_mux('PSNR');
3. [values] = sim_metrix_mux('MSSIM');

---------------------- Image Name Convention -----------------------
Important information regarding the image naming convention:
A file called "imageName.data" would contain an index of the all the images on you wish to run the quality tests on
so for each image its name would be of this form

"image1 - Orig.jpg"
"image1 - FbCopy.jpg"
"image1 - 2Copy.jpg"
"image1 - 3Copy.jpg"
"image1 - 4Copy.jpg"

"image2 - Orig.jpg"
"image2 - 1Copy.jpg"

The number or substring prefixed with substring "Copy" in image name should be added to threshold.data 

Notice: see how the number before the Copy substring in the name changes but there would be only one original image

<b>PSNR:</b>
A PSNR value of Inf means that the images are exactly equal

http://books.google.ca/books?id=ujnQogzx_2EC&pg=PA281&lpg=PA281&dq=acceptable+range+of+psnr+value&source=bl&ots=FoqtwG8xjP&sig=6_JkQEd2-BeGF4qHfy3RO0uBq4s&hl=en&sa=X&ei=H13oUu-2DaGCyQGfpoG4Dg&ved=0CCsQ6AEwAA#v=onepage&q&f=false

This book says that we cannot judge the quality of image using psnr value.


<b>SSIM:</b>

For running the ssim image quality test you have to do something like ssim(imread('Test1 - Orig.jpg'), imread('Test1 - 1Copy.jpg'))

Structural similarity between the two images will range from between -1 to  1.

where 1 being exactly identical images and as it decreases from 1 the difference between the two compared image increase


<b>MSSIM:</b>

For running the msssim image quality test you have to do the following

I = imread('Test1 - Orig.jpg');
I1 = rgb2gray(I);

J = imread('Test1 - 1Copy.jpg');
J1 = rb2gray(I);

msssim(I1, J1);

This function returns a value between -1 to 1 

where 1 being exactly identical images and as it decreases from 1 the difference between the two compared image increase

script code taken from http://sse.tongji.edu.cn/linzhang/IQA/Evalution_MS_SSIM/eva-MS-SSIM.htm


<b>metrix_mux library:</b>
To run this library in matlab you have to do the following steps
1. configure_metrix_mux
2. I = imread('Test1 - Orig.jpg');
3. J = imread('Test1- 1Copy.jpg');
4. metrix_mux(I, J, 'PSNR');

The algorithms by this external library are


algorithm	      			          indicator string

mean-squared-error	      		    'MSE'
peak signal-to-noise-ratio	      'PSNR'
structural similarity index	      'SSIM'
multi-scale SSIM index	      		'MSSIM'
visual signal-to-noise ratio	    'VSNR'
visual information fidelity	      'VIF'
pixel-based VIF	      			      'VIFP'
universal quality index	      		'UQI'
information fidelity criterion	  'IFC'
noise quality measure	      		  'NQM'
weighted signal-to-noise ratio	  'WSNR'
signal-to-noise ratio	      		  'SNR'

these indicator strings can be changed in the above metrix_mux statements

Library taken from
http://foulard.ece.cornell.edu/gaubatz/metrix_mux/



image-quality-tools's People

Contributors

sattarab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

image-quality-tools's Issues

Error(s) in testing metric algorithms

Hi, I was looking for some opensource material for computing image quality metrics such as VSIM, VIF etc. and came across your repo. As instructed in the readme, I ran the configure_metric_mux. The search path is appended successfully, however when test_metric_mux is called from within the configure_metic_mux file there are a few errors in testing the algorithms. As shown below the errors occur in MSSIM, VSNR, VIF, and lastly IFC:

>> configure_metrix_mux
Setting MeTriX MuX path...[Done!]
Compiling list of compilations routines...1 found...[Done!]
Executing compilation routines...
1 - compile_metrix_vsnr
    Building VSNR MEX interface for DWT...(Linux/Mac)...    [Not Supported!]
    Defaulting to Matlab-based DWT...[Success!]
[Done!]
Algorithm mse computed successfully!
Algorithm psnr computed successfully!
Algorithm ssim computed successfully!
Error [test_metrix_mux]:  algorithm mssim did not compute correctly!
Error [test_metrix_mux]:  algorithm vsnr did not compute correctly!
Error [test_metrix_mux]:  algorithm vif did not compute correctly!
Algorithm vifp computed successfully!
Algorithm uqi computed successfully!
Error [test_metrix_mux]:  algorithm ifc did not compute correctly!
Algorithm nqm computed successfully!
Algorithm wsnr computed successfully!
Algorithm snr computed successfully!
Total error count:  4
>> 

I debugged the code and found the issue to be less number of parameters than expected. The call to mssim_index in metrix_mssim.m provides only two parameters namely reference_image, query_image:

function [metrix_value] = metrix_mssim(reference_image, query_image)
metrix_value = mssim_index( reference_image, query_image );

Upon looking into the code or mssim_index one notices that there are five input arguments required:

function [mssim, comp, detail] = mssim_index(img1, img2, nlevs,K,lpf)

However, only two arguments were provided. Further down below there are a few try catch statements:
try
K = K;
catch
% Default SSIM parameters (assumes L=255)
K = [0.01 0.03];
end

and
try
lpf = lpf;
catch
% Use Analysis Low Pass filter from Biorthogonal 9/7 Wavelet
lod = [0.037828455507260; -0.023849465019560; -0.110624404418440; ...
0.377402855612830; 0.852698679008890; 0.377402855612830; ...
-0.110624404418440; -0.023849465019560; 0.037828455507260];
lpf = lod*lod';
lpf = lpf/sum(lpf(:));
end

I believe these lines imply default parameter values in case the parameters are not defined. That being said when I run the code even after the execution of the aforementioned lines, the workspace has no variable by the name K or lpf.

There is/are undoubtedly error(s) in the code. For the time being, I'm going to replace the lines:

try
K = K;
catch
% Default SSIM parameters (assumes L=255)
K = [0.01 0.03];
end

and
try
lpf = lpf;
catch
% Use Analysis Low Pass filter from Biorthogonal 9/7 Wavelet
lod = [0.037828455507260; -0.023849465019560; -0.110624404418440; ...
0.377402855612830; 0.852698679008890; 0.377402855612830; ...
-0.110624404418440; -0.023849465019560; 0.037828455507260];
lpf = lod*lod';
lpf = lpf/sum(lpf(:));
end

with

if ~exist('K','var')
    K = [0.01 0.03]
end

and

if ~exist('lpf','var')
    lod = [0.037828455507260; -0.023849465019560;  -0.110624404418440; ...
        0.377402855612830; 0.852698679008890;   0.377402855612830;  ...
        -0.110624404418440; -0.023849465019560; 0.037828455507260];
    lpf = lod*lod';
    lpf = lpf/sum(lpf(:));
end

So, what I am creating this issue for is to know whether these modifications are theoretically correct, as I do not want to make modifications to the code that I might end up regretting later.
Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.