MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / psnr

Function psnr

analysis/compression_analysis/psnr.py:12–18  ·  view source on GitHub ↗
(original, contrast)

Source from the content-addressed store, hash-verified

10import numpy as np
11
12def psnr(original, contrast):
13 mse = np.mean((original - contrast) ** 2)
14 if mse == 0:
15 return 100
16 PIXEL_MAX = 255.0
17 PSNR = 20 * math.log10(PIXEL_MAX / math.sqrt(mse))
18 return PSNR
19
20
21def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected