


'''simple docstring'''




import math
import os

import cva
import numpy as np

__lowercase	:   List[str]   		=					2_55.0





def 				a_							(    lowercase				,    lowercase     )      ->Dict:






				'''simple docstring'''

				__lowerCamelCase		:   Tuple           =       np.mean((original - contrast) ** 2     )
				if mse == 0:
								return 100

				return 20 * math.logaa(PIXEL_MAX / math.sqrt(lowercase     )     )





def 				a_							(    )      ->int:






				'''simple docstring'''

				__lowerCamelCase		:   Any           =       os.path.dirname(os.path.realpath(lowercase     )     )
				# Loading images (original image and compressed image)
				__lowerCamelCase		:   Any           =       cva.imread(os.path.join(lowercase				,    "image_data/original_image.png"     )     )
				__lowerCamelCase		:   Any           =       cva.imread(os.path.join(lowercase				,    "image_data/compressed_image.png"     )				,    1     )

				__lowerCamelCase		:   Optional[Any]           =       cva.imread(os.path.join(lowercase				,    "image_data/PSNR-example-base.png"     )     )
				__lowerCamelCase		:   Tuple           =       cva.imread(
				    os.path.join(lowercase				,    "image_data/PSNR-example-comp-10.jpg"     )				,    1     )

				# Value expected: 29.73dB
				print("-- First Test --"     )
				print(F'PSNR value is {peak_signal_to_noise_ratio(lowercase				,    lowercase     )} dB'     )

				# # Value expected: 31.53dB (Wikipedia Example)
				print("\n-- Second Test --"     )
				print(F'PSNR value is {peak_signal_to_noise_ratio(lowercase				,    lowercase     )} dB'     )


if __name__ == "__main__":
				main()











"""simple docstring"""





_lowercase						   =     [0.4_85, 0.4_56, 0.4_06]
_lowercase						   =     [0.2_29, 0.2_24, 0.2_25]
_lowercase						   =     [0.5, 0.5, 0.5]
_lowercase						   =     [0.5, 0.5, 0.5]
_lowercase						   =     [0.48_14_54_66, 0.4_57_82_75, 0.40_82_10_73]
_lowercase						   =     [0.26_86_29_54, 0.26_13_02_58, 0.27_57_77_11]


