'''simple docstring'''






from PIL import Image






def 			UpperCamelCase__       (       _lowercase     :					Union[str, Any]  )				->						Union[str, Any]:
  __UpperCAmelCase:       str		=			image.size
  __UpperCAmelCase:       List[Any]		=			0
  __UpperCAmelCase:       Dict		=			image.load()
  for i in range(lowerCAmelCase__  ):
    for j in range(lowerCAmelCase__  ):
      __UpperCAmelCase:       int		=			pixels[j, i]
      mean += pixel
  mean //= width * height

  for j in range(lowerCAmelCase__  ):
    for i in range(lowerCAmelCase__  ):
      __UpperCAmelCase:       List[Any]		=			2_5_5 if pixels[i, j] > mean else 0
  return image


if __name__ == "__main__":
    SCREAMING_SNAKE_CASE_						 =      mean_threshold(Image.open('path_to_image').convert('L'))
    image.save('output_image_path')






import warnings

from ...utils import logging
from .image_processing_yolos import YolosImageProcessor


_lowercase		:  int			       =logging.get_logger(__name__)






class 						UpperCamelCase_  (  snake_case__							):



					def __init__(		self     :     Tuple       ,      *lowerCamelCase     :     List[Any]       ,      **lowerCamelCase     :     Union[str, Any]						):
							warnings.warn(
							    'The class YolosFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
							    ' use YolosImageProcessor instead.'       ,      lowerCamelCase       ,      )
							super().__init__(*lowerCamelCase       ,      **lowerCamelCase						)
