
'''simple docstring'''

def 	_UpperCAmelCase				(  _lowerCamelCase						:       str		)    ->						int:
  _lowerCAmelCase       :  Optional[Any]   				=					str(_lowerCamelCase		).strip()
  if not oct_string:
    raise ValueError("""Empty string was passed to the function"""		)
  _lowerCAmelCase       :  int   				=					oct_string[0] == """-"""
  if is_negative:
    _lowerCAmelCase       :  Tuple   				=					oct_string[1:]
  if not oct_string.isdigit() or not all(0 <= int(_lowerCamelCase		) <= 7 for char in oct_string		):
    raise ValueError("""Non-octal value was passed to the function"""		)
  _lowerCAmelCase       :  str   				=					0
  for char in oct_string:
    _lowerCAmelCase       :  str   				=					8 * decimal_number + int(_lowerCamelCase		)
  if is_negative:
    _lowerCAmelCase       :  Optional[int]   				=					-decimal_number
  return decimal_number


if __name__ == "__main__":
     from doctest import testmod

     testmod()




'''simple docstring'''

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


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


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

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

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


