





"""simple docstring"""




import math
import os

import cva
import numpy as np

UpperCamelCase_	 =255.0





def 			a_							(				_lowercase			,		_lowercase  ):
						_UpperCamelCase     :   Dict      =       np.mean((original - contrast) ** 2  )
						if mse == 0:
												return 100

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





def 			a_							(				):
						_UpperCamelCase     :   Tuple      =       os.path.dirname(os.path.realpath(_lowercase  )  )
						# Loading images (original image and compressed image)
						_UpperCamelCase     :   List[str]      =       cva.imread(os.path.join(_lowercase			,		'''image_data/original_image.png'''  )  )
						_UpperCamelCase     :   str      =       cva.imread(os.path.join(_lowercase			,		'''image_data/compressed_image.png'''  )			,		1  )

						_UpperCamelCase     :   Dict      =       cva.imread(os.path.join(_lowercase			,		'''image_data/PSNR-example-base.png'''  )  )
						_UpperCamelCase     :   List[Any]      =       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()








from collections.abc import Callable

__magic_name__       =     Callable[[float], float]  # type alias for a real -> real function





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			):
					"""simple docstring"""






					lowercase						   =       float(_UpperCAmelCase				)
					while True:
										try:
															lowercase						   =       prev_guess - function(_UpperCAmelCase				) / derivative(_UpperCAmelCase				)
										except ZeroDivisionError:
															raise ZeroDivisionError('Could not find root'				) from None
										if abs(prev_guess - next_guess				) < 10**-5:
															return next_guess
										lowercase						   =       next_guess





def 		__snake_case						(    _UpperCAmelCase				):
					"""simple docstring"""






					return (x**3) - (2 * x) - 5





def 		__snake_case						(    _UpperCAmelCase				):
					"""simple docstring"""






					return 3 * (x**2) - 2


if __name__ == "__main__":
		print(newton(f, fa, 3))






