beafe3656fed73a0adff4cd9ad3dfd5c0b1d294b,analysis/compression_analysis/psnr.py,,main,#,13
Before Change
//Getting image height and width
height,width = orignal_image.shape[:2]
orignalPixelAt = calculate(orignal_image)
compressedPixelAt = calculate(compressed_image)
diff = orignalPixelAt - compressedPixelAt
error = np.sum(np.abs(diff) ** 2)
error = error/(height*width)
//MSR = error_sum/(height*width)
PSNR = -(10*math.log10(error/(255*255)))
print("PSNR value is {}".format(PSNR))
After Change
contrast2 = cv2.imread("PSNR-example-comp-10.jpg", 1)
// Value expected: 29.73dB
print("-- First Test --")
print(f"PSNR value is {psnr(original, contrast)} dB")
// // Value expected: 31.53dB (Wikipedia Example)
print("\n-- Second Test --")
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances Project Name: TheAlgorithms/Python
Commit Name: beafe3656fed73a0adff4cd9ad3dfd5c0b1d294b
Time: 2018-11-05
Author: r.gc@hotmail.es
File Name: analysis/compression_analysis/psnr.py
Class Name:
Method Name: main
Project Name: geomstats/geomstats
Commit Name: 88f01a67f6cc3c16bf20b7c892fcca9b9ab33937
Time: 2018-04-12
Author: ninamio78@gmail.com
File Name: geomstats/hyperbolic_space.py
Class Name: HyperbolicMetric
Method Name: exp_basis
Project Name: geomstats/geomstats
Commit Name: 984791ffafd92b472624bc24056ddc7edd4012aa
Time: 2018-04-12
Author: ninamio78@gmail.com
File Name: geomstats/hyperbolic_space.py
Class Name: HyperbolicMetric
Method Name: exp_basis