





'''simple docstring'''

from PIL import Image




def    _a    (							lowerCAmelCase_	):





      """simple docstring"""



      _snake_case     ,							_snake_case		:	Optional[int]					     =     image.size
      _snake_case		:	Optional[Any]					     =     0
      _snake_case		:	Any					     =     image.load()
      for i in range(lowerCAmelCase_	):
            for j in range(lowerCAmelCase_	):
                  _snake_case		:	Dict					     =     pixels[j, i]
                  mean += pixel
      mean //= width * height

      for j in range(lowerCAmelCase_	):
            for i in range(lowerCAmelCase_	):
                  _snake_case		:	Optional[int]					     =     255 if pixels[i, j] > mean else 0
      return image


if __name__ == "__main__":
    UpperCAmelCase					:		List[Any]		=							mean_threshold(Image.open('path_to_image').convert('L'))
    image.save('output_image_path')









'''simple docstring'''

UpperCAmelCase					:		Union[str, Any]		=							tuple[float, float, float]
UpperCAmelCase					:		int		=							tuple[float, float, float]




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	str					     =     end_pointa[0] - end_pointa[0]
      _snake_case		:	Tuple					     =     end_pointa[1] - end_pointa[1]
      _snake_case		:	Any					     =     end_pointa[2] - end_pointa[2]
      return (x, y, z)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      _snake_case		:	Dict					     =     ab[1] * ac[2] - ab[2] * ac[1]  # *i
      _snake_case		:	List[str]					     =     (ab[0] * ac[2] - ab[2] * ac[0]) * -1  # *j
      _snake_case		:	Optional[int]					     =     ab[0] * ac[1] - ab[1] * ac[0]  # *k
      return (x, y, z)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_	):





      """simple docstring"""



      return tuple(round(lowerCAmelCase_			,      lowerCAmelCase_	) for x in vector	) == (0, 0, 0)




def    _a    (							lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_			,      lowerCAmelCase_ = 10	):





      """simple docstring"""



      _snake_case		:	str					     =     create_vector(lowerCAmelCase_			,      lowerCAmelCase_	)
      _snake_case		:	Tuple					     =     create_vector(lowerCAmelCase_			,      lowerCAmelCase_	)
      return is_zero_vector(get_ad_vectors_cross(lowerCAmelCase_			,      lowerCAmelCase_	)			,      lowerCAmelCase_	)


