
'''simple docstring'''
import numpy as np
from PIL import Image




def       _UpperCamelCase	(					SCREAMING_SNAKE_CASE__ )     ->       np.array:


		'''simple docstring'''


		snake_case     :					str     =	rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
		return 0.2989 * r + 0.5870 * g + 0.1140 * b




def       _UpperCamelCase	(					SCREAMING_SNAKE_CASE__ )     ->       np.array:


		'''simple docstring'''


		return (gray > 127) & (gray <= 255)




def       _UpperCamelCase	(					SCREAMING_SNAKE_CASE__   ,					SCREAMING_SNAKE_CASE__ )     ->       np.array:


		'''simple docstring'''


		snake_case     :					List[str]     =	np.zeros_like(SCREAMING_SNAKE_CASE__ )
		snake_case     :					str     =	np.zeros(
		    (image.shape[0] + kernel.shape[0] - 1, image.shape[1] + kernel.shape[1] - 1) )

		# Copy image to padded image
		snake_case     :					List[Any]     =	image

		# Iterate over image & apply kernel
		for x in range(image.shape[1] ):
				for y in range(image.shape[0] ):
						snake_case     :					Dict     =	(
						    kernel * image_padded[y : y + kernel.shape[0], x : x + kernel.shape[1]]
						).sum()
						snake_case     :					List[str]     =	int(summation == 5 )
		return output


# kernel to be applied
lowercase__						=			np.array([[0, 1, 0], [1, 1, 1], [0, 1, 0]])

if __name__ == "__main__":
						# read original image
						lowercase__						=			np.array(Image.open(R"..\image_data\lena.jpg"))
						# Apply erosion operation to a binary image
						lowercase__						=			erosion(grayabinary(rgbagray(image)), structuring_element)
						# Save the output image
						lowercase__						=			Image.fromarray(output).convert("RGB")
						pil_img.save("result_erosion.png")




'''simple docstring'''
def       _UpperCamelCase	(					)     ->       int:


		'''simple docstring'''


		for a in range(300 ):
				for b in range(a + 1   ,					400 ):
						for c in range(b + 1   ,					500 ):
								if (a + b + c) == 1000 and (a**2) + (b**2) == (c**2):
										return a * b * c

		return -1




def       _UpperCamelCase	(					)     ->       int:


		'''simple docstring'''


		for a in range(300 ):
				for b in range(400 ):
						snake_case     :					Dict     =	1000 - a - b
						if a < b < c and (a**2) + (b**2) == (c**2):
								return a * b * c

		return -1




def       _UpperCamelCase	(					)     ->       None:


		'''simple docstring'''


		import timeit

		print(
		    timeit.timeit('''solution()'''   ,					setup='''from __main__ import solution'''   ,					number=1000 ) )
		print(
		    timeit.timeit(
		        '''solution_fast()'''   ,					setup='''from __main__ import solution_fast'''   ,					number=1000 ) )


if __name__ == "__main__":
						print(f"{solution() = }")


