





import math
import os

import cva
import numpy as np

__lowerCAmelCase			:Dict	 =     2_5_5.0







def  A					(				UpperCAmelCase	,	UpperCAmelCase					):
					_snake_case							:       Union[str, Any]												= np.mean((original - contrast) ** 2					)
					if mse == 0:
										return 100

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







def  A					(				):
					_snake_case							:       Optional[Any]												= os.path.dirname(os.path.realpath(UpperCAmelCase					)					)
					# Loading images (original image and compressed image)
					_snake_case							:       Dict												= cva.imread(os.path.join(UpperCAmelCase	,	"image_data/original_image.png"					)					)
					_snake_case							:       List[str]												= cva.imread(os.path.join(UpperCAmelCase	,	"image_data/compressed_image.png"					)	,	1					)

					_snake_case							:       List[str]												= cva.imread(os.path.join(UpperCAmelCase	,	"image_data/PSNR-example-base.png"					)					)
					_snake_case							:       Any												= cva.imread(
					    os.path.join(UpperCAmelCase	,	"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(UpperCAmelCase	,	UpperCAmelCase					)} dB"""					)

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


if __name__ == "__main__":
							main()






def  A					(				UpperCAmelCase	,	UpperCAmelCase					):
					# "Simpson Rule"
					# int(f) = delta_x/2 * (b-a)/3*(f1 + 4f2 + 2f_3 + ... + fn)
					_snake_case							:       List[str]												= (boundary[1] - boundary[0]) / steps
					_snake_case							:       List[Any]												= boundary[0]
					_snake_case							:       Tuple												= boundary[1]
					_snake_case							:       str												= make_points(UpperCAmelCase	,	UpperCAmelCase	,	UpperCAmelCase					)
					_snake_case							:       str												= 0.0
					y += (h / 3.0) * f(UpperCAmelCase					)
					_snake_case							:       Tuple												= 2
					for i in x_i:
										y += (h / 3) * (4 - 2 * (cnt % 2)) * f(UpperCAmelCase					)
										cnt += 1
					y += (h / 3.0) * f(UpperCAmelCase					)
					return y







def  A					(				UpperCAmelCase	,	UpperCAmelCase	,	UpperCAmelCase					):
					_snake_case							:       Union[str, Any]												= a + h
					while x < (b - h):
										yield x
										_snake_case							:       Optional[Any]												= x + h







def  A					(				UpperCAmelCase					):  # enter your function here
					_snake_case							:       Dict												= (x - 0) * (x - 0)
					return y







def  A					(				):
					_snake_case							:       int												= 0.0  # Lower bound of integration
					_snake_case							:       Union[str, Any]												= 1.0  # Upper bound of integration
					_snake_case							:       List[str]												= 1_0.0  # define number of steps or resolution
					_snake_case							:       Optional[int]												= [a, b]  # define boundary of integration
					_snake_case							:       List[str]												= method_a(UpperCAmelCase	,	UpperCAmelCase					)
					print(F"""y = {y}"""					)


if __name__ == "__main__":
							main()