Skip to content

Error(s) in testing metric algorithms #1

@shazib-summar

Description

@shazib-summar

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions