





'''simple docstring'''

import numpy as np
from PIL import Image




def  _a     (				lowerCAmelCase_						):





      """simple docstring"""



      _snake_case  ,				_snake_case  ,				_snake_case		:						Optional[int]         =  rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2]
      return 0.2_989 * r + 0.5_870 * g + 0.1_140 * b




def  _a     (				lowerCAmelCase_						):





      """simple docstring"""



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




def  _a     (				lowerCAmelCase_      ,   lowerCAmelCase_						):





      """simple docstring"""



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

      # Copy image to padded image
      _snake_case		:						Any         =  image

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


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

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









'''simple docstring'''

def  _a     (				lowerCAmelCase_ = 4_000_000						):





      """simple docstring"""



      _snake_case		:						Optional[int]         =  1
      _snake_case		:						Tuple         =  2
      _snake_case		:						Optional[Any]         =  0
      while j <= n:
            if j % 2 == 0:
                  total += j
            _snake_case  ,				_snake_case		:						str         =  j, i + j

      return total


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


