
'''simple docstring'''
from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
from numpy import divide, inta, multiply, ravel, sort, zeros_like

def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE=3    ):
    """simple docstring"""






    snake_case_	:      int            =  int(mask / 2    )
    # copy image size
    snake_case_	:      Optional[Any]            =  zeros_like(__SCREAMING_SNAKE_CASE    )
    for i in range(__SCREAMING_SNAKE_CASE,						gray_img.shape[0] - bd    ):
        for j in range(__SCREAMING_SNAKE_CASE,						gray_img.shape[1] - bd    ):
            # get mask according with mask
            snake_case_	:      Dict            =  ravel(gray_img[i - bd : i + bd + 1, j - bd : j + bd + 1]    )
            # calculate mask median
            snake_case_	:      int            =  sort(__SCREAMING_SNAKE_CASE    )[inta(divide((multiply(__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE    )),						2    ) + 1    )]
            snake_case_	:      List[Any]            =  median
    return median_img


if __name__ == "__main__":
  # read original image
  a_     =  imread("../image_data/lena.jpg")
  # turn image in gray scale value
  a_     =  cvtColor(img, COLOR_BGR2GRAY)

  # get values with two different mask size
  a_     =  median_filter(gray, 3)
  a_     =  median_filter(gray, 5)

  # show result images
  imshow("median filter with 3x3 mask", medianaxa)
  imshow("median filter with 5x5 mask", medianaxa)
  waitKey(0)






'''simple docstring'''
from __future__ import annotations

from collections.abc import Callable

def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE = 1_0_0,						):
    """simple docstring"""






    snake_case_	:      Optional[Any]            =  x_start
    snake_case_	:      str            =  fnc(__SCREAMING_SNAKE_CASE    )
    snake_case_	:      List[str]            =  0.0

    for _ in range(__SCREAMING_SNAKE_CASE    ):
        # Approximates small segments of curve as linear and solve
        # for trapezoidal area
        snake_case_	:      List[str]            =  (x_end - x_start) / steps + xa
        snake_case_	:      Optional[int]            =  fnc(__SCREAMING_SNAKE_CASE    )
        area += abs(fxa + fxa    ) * (xa - xa) / 2

        # Increment step
        snake_case_	:      List[Any]            =  xa
        snake_case_	:      Optional[Any]            =  fxa
    return area


if __name__ == "__main__":

  def   UpperCamelCase_       (		__SCREAMING_SNAKE_CASE    ):
      """simple docstring"""






      return x**3

  print("f(x) = x^3")
  print("The area between the curve, x = -10, x = 10 and the x axis is:")
  a_     =  10
  while i <= 10_0000:
    a_     =  trapezoidal_area(f, -5, 5, i)
    print(f"""with {i} steps: {area}""")
    i *= 10




