image-quality-tools
image-quality-tools copied to clipboard
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
:
https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/metrix_mssim.m#L40-L42
Upon looking into the code or mssim_index
one notices that there are five input arguments required:
https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/mssim/mssim_index.m#L56
However, only two arguments were provided. Further down below there are a few try catch statements:
https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/mssim/mssim_index.m#L72-L77
and
https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/mssim/mssim_index.m#L79-L88
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: https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/mssim/mssim_index.m#L72-L77 and https://github.com/sattarab/image-quality-tools/blob/163fff128a86260efcc962de52196c71a3d3d06e/metrix_mux/metrix/mssim/mssim_index.m#L79-L88 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.