






import math
import os

import cva
import numpy as np

__A  							=  255.0







def 			lowercase__  (				A_:	float     ,			A_:	float		)  ->							float:







       """simple docstring"""






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

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







def 			lowercase__  (				)  ->							None:







       """simple docstring"""






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

       __UpperCAmelCase    							=cva.imread(os.path.join(A_     ,			"""image_data/PSNR-example-base.png"""		)		)
       __UpperCAmelCase    							=cva.imread(
           os.path.join(A_     ,			"""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(A_     ,			A_		)} dB'''		)

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


if __name__ == "__main__":
   main()












__A  							=  [0.485, 0.456, 0.406]
__A  							=  [0.229, 0.224, 0.225]
__A  							=  [0.5, 0.5, 0.5]
__A  							=  [0.5, 0.5, 0.5]
__A  							=  [0.4814_5466, 0.457_8275, 0.4082_1073]
__A  							=  [0.2686_2954, 0.2613_0258, 0.2757_7711]




