






from __future__ import annotations

SCREAMING_SNAKE_CASE__		:       List[str]   							=							"""Alexander Joslin"""





def    _lowerCamelCase	(	__lowerCamelCase					)   -> int:

     '''simple docstring'''

     if number <= 0:
          UpperCAmelCase__			:     Tuple										= F"n must be greater than 0. Got n = {number}"
          raise ValueError(__lowerCamelCase					)

     UpperCAmelCase__			:     List[Any]										= [number + 1] * (number + 1)

     # starting position
     UpperCAmelCase__			:     Optional[Any]										= 0
     for i in range(1   ,       __lowerCamelCase					):
          UpperCAmelCase__			:     str										= min(table[i + 1]   ,       table[i] + 1					)
          # check if out of bounds
          if i * 2 <= number:
               UpperCAmelCase__			:     int										= min(table[i * 2]   ,       table[i] + 1					)
          # check if out of bounds
          if i * 3 <= number:
               UpperCAmelCase__			:     Dict										= min(table[i * 3]   ,       table[i] + 1					)
     return table[number]


if __name__ == "__main__":
      import doctest

      doctest.testmod()














import math
import os

import cva
import numpy as np

SCREAMING_SNAKE_CASE__		:       Optional[Any]   							=							255.0





def    _lowerCamelCase	(	__lowerCamelCase   ,       __lowerCamelCase					)   -> float:

     '''simple docstring'''
     UpperCAmelCase__			:     List[Any]										= np.mean((original - contrast) ** 2					)
     if mse == 0:
          return 100

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





def    _lowerCamelCase	(	)   -> None:

     '''simple docstring'''
     UpperCAmelCase__			:     Union[str, Any]										= os.path.dirname(os.path.realpath(__lowerCamelCase					)					)
     # Loading images (original image and compressed image)
     UpperCAmelCase__			:     List[Any]										= cva.imread(os.path.join(__lowerCamelCase   ,       """image_data/original_image.png"""					)					)
     UpperCAmelCase__			:     Dict										= cva.imread(os.path.join(__lowerCamelCase   ,       """image_data/compressed_image.png"""					)   ,       1					)

     UpperCAmelCase__			:     Tuple										= cva.imread(os.path.join(__lowerCamelCase   ,       """image_data/PSNR-example-base.png"""					)					)
     UpperCAmelCase__			:     int										= cva.imread(
         os.path.join(__lowerCamelCase   ,       """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(__lowerCamelCase   ,       __lowerCamelCase					)} dB"					)

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


if __name__ == "__main__":
      main()






