I am attempting to validate some image conversion qualities between pixel formats. I have a base test image, and am converting it from a given pixel format (such as Y444) to a different one (say Y42B). I then compare the new image to the test image by generating a PSNR score. However, there are concerns that because the array size of the pixel formats are different, that the score generated may not be accurate.
I am currently using a custom coded PSNR score generator, though I may switch to OpenCV's PSNR function. This is the current code for the score generation:
"""Computes the PSNR rating between 2 given images."""
mse = mean((original - converted) ** 2)
if (mse == 0): # MSE is zero means no noise is present.
# Therefore PSNR have no importance.
return 100
max_pixel = 255.0
psnr = 20 * log10(max_pixel / sqrt(mse))
return psnr
Does anyone know if this score would indeed be accurate? Or is there a library oo method I could use that would provide a more accurate measure, such as OpenCV's PSNR score function, or doing a SSIM comparison?