Peak signal-to-noise ratio (PSNR) is the ratio between the maximum possible power of an image and the power of corrupting noise that affects the quality of its representation. To estimate the PSNR of an image, it is necessary to compare that image to an ideal clean image with the maximum possible power.
PSNR is defined as follows:
Here, L is the number of maximum possible intensity levels (minimum intensity level suppose to be 0) in an image.
MSE is the mean squared error & it is defined as:
Where, O represents the matrix data of original image. D represents the matrix data of degraded image. m represents the numbers of rows of pixels and i represents the index of that row of the image. n represents the number of columns of pixels and j represents the index of that column of the image.
RMSE is the root mean squared error.
Here, we have an original image and it’s compressed version, let’s see the PSNR value for these images,
Original Image :
Compressed Image :
Below is the Python implementation –
PSNR value is 43.862955653517126 dB
PSNR is most commonly used to estimate the efficiency of compressors, filters, etc. The larger the value of PSNR, the more efficient is a corresponding compression or filter method.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.