简体   繁体   中英

Is a PSNR score generated between 2 images with different pixel formats accurate?

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?

The both image have to same format. You can convert them and then apply PSNR

both image must be in same size and format and you can resize or change format in OpenCV.

There are several way to Similarity check (PNSR and SSIM) in opencv which can be found in OpenCV documents.

Also you can check other library for this: Using the compare_ssim function from scikit-image

other methods such as:

  • Comparing histograms
  • Template matching
  • Feature matching
  • Dense Vector Representations

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM