
"""simple docstring"""






import warnings

from ...utils import logging
from .image_processing_videomae import VideoMAEImageProcessor


__UpperCAmelCase       =  logging.get_logger(__name__)




class 			_SCREAMING_SNAKE_CASE					(			A__							):






			def __init__(					self       ,   *__A       ,   **__A       )			->     None:
						warnings.warn(
						    """The class VideoMAEFeatureExtractor is deprecated and will be removed in version 5 of Transformers."""
						    """ Please use VideoMAEImageProcessor instead."""       ,   __A       ,   )
						super().__init__(*__A       ,   **__A       )








import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image


if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'):
		lowercase  :					int													=       {
		    'linear': PIL.Image.Resampling.BILINEAR,
		    'bilinear': PIL.Image.Resampling.BILINEAR,
		    'bicubic': PIL.Image.Resampling.BICUBIC,
		    'lanczos': PIL.Image.Resampling.LANCZOS,
		    'nearest': PIL.Image.Resampling.NEAREST,
		}
else:
		lowercase  :					Any													=       {
		    'linear': PIL.Image.LINEAR,
		    'bilinear': PIL.Image.BILINEAR,
		    'bicubic': PIL.Image.BICUBIC,
		    'lanczos': PIL.Image.LANCZOS,
		    'nearest': PIL.Image.NEAREST,
		}




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			int)					->    Any:






							'''simple docstring'''





							__UpperCamelCase	:   Union[str, Any]			   =					(images / 2 + 0.5).clamp(0						,  1)
							__UpperCamelCase	:   int			   =					images.cpu().permute(0						,  2						,  3						,  1).float().numpy()
							__UpperCamelCase	:   Dict			   =					numpy_to_pil(_lowerCamelCase)
							return images




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			Optional[Any])					->    Optional[Any]:






							'''simple docstring'''





							if images.ndim == 3:
														__UpperCamelCase	:   Optional[int]			   =					images[None, ...]
							__UpperCamelCase	:   Dict			   =					(images * 255).round().astype("uint8")
							if images.shape[-1] == 1:
														# special case for grayscale (single channel) images
														__UpperCamelCase	:   int			   =					[Image.fromarray(image.squeeze()						,  mode="L") for image in images]
							else:
														__UpperCamelCase	:   Union[str, Any]			   =					[Image.fromarray(_lowerCamelCase) for image in images]

							return pil_images