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

Function main

analysis/compression_analysis/psnr.py:21–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19
20
21def main():
22 dir_path = os.path.dirname(os.path.realpath(__file__))
23 # Loading images (original image and compressed image)
24 original = cv2.imread(os.path.join(dir_path, 'original_image.png'))
25 contrast = cv2.imread(os.path.join(dir_path, 'compressed_image.png'), 1)
26
27 original2 = cv2.imread(os.path.join(dir_path, 'PSNR-example-base.png'))
28 contrast2 = cv2.imread(os.path.join(dir_path, 'PSNR-example-comp-10.jpg'), 1)
29
30 # Value expected: 29.73dB
31 print("-- First Test --")
32 print(f"PSNR value is {psnr(original, contrast)} dB")
33
34 # # Value expected: 31.53dB (Wikipedia Example)
35 print("\n-- Second Test --")
36 print(f"PSNR value is {psnr(original2, contrast2)} dB")
37
38
39if __name__ == '__main__':

Callers 1

psnr.pyFile · 0.70

Calls 1

psnrFunction · 0.85

Tested by

no test coverage detected