A python implementation of PSNR that takes the Human visual system into account. This code is based on Nikolay Ponomarenko matlab implementation of the PSNR-HVS & PSNR-m algorithm.
PSNR-HVS-M is Peak Signal to Noise Ratio taking into account Contrast Sensitivity Function (CSF) and between-coefficient contrast masking of DCT basis functions.
Eduardo Prado (t2ac32)
Nikolay Ponomarenko http://www.ponomarenko.info/psnrhvsm.htm
Clone the repository or dowload the zip. Add the 'psnrhvsm' folder to your project
In you .py file imports add this line.
'from psnrhvsm import psnrhvsm'
Or use the jupyter notebook included in the main folder the test images used in the paper are also included.
Input :
- img1: the first image being compared
- img2: the second image being compared
- wstep: step of 8x8 window to calculate DCT coefficients. Default value is 8.
- p_hvs_m: the PSNR-HVS-M value between 2 images.
- If one of the images being compared is regarded as perfect quality, then PSNR-HVS-M can be considered as the quality measure of the other image.
- If compared images are visually undistingwished,then PSNR-HVS-M = 100000.
- p_hvs: the PSNR-HVS value between 2 images.
Given 2 test images img1 and img2, whose dynamic range is 0-255
[p_hvs_m, p_hvs] = psnrhvsm(img1, img2);
p_hvs_m # Gives the PSNR-HVS-M value
p_hvs # Gives the PSNR-HVS value
[1] K. Egiazarian, J. Astola, N. Ponomarenko, V. Lukin, F. Battisti, M. Carli, New full-reference quality metrics based on HVS, CD-ROM Proceedings of the Second International Workshop on Video Processing and Quality Metrics, Scottsdale, USA, 2006, 4 p.
[2] Nikolay Ponomarenko, Flavia Silvestri, Karen Egiazarian, Marco Carli, Jaakko Astola, Vladimir Lukin, On between-coefficient contrast masking of DCT basis functions, CD-ROM Proceedings of the Third International Workshop on Video Processing and Quality Metrics for Consumer Electronics VPQM-07, Scottsdale, Arizona, USA, 25-26 January, 2007, 4 p.