





'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
    is_vision_available,
)


_a      :				int											=					{
    """configuration_tvlt""": ["""TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TvltConfig"""],
    """feature_extraction_tvlt""": ["""TvltFeatureExtractor"""],
    """processing_tvlt""": ["""TvltProcessor"""],
}

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_a      :				Union[str, Any]											=					[
	    """TVLT_PRETRAINED_MODEL_ARCHIVE_LIST""",
	    """TvltModel""",
	    """TvltForPreTraining""",
	    """TvltForAudioVisualClassification""",
	    """TvltPreTrainedModel""",
	]

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_a      :				str											=					["""TvltImageProcessor"""]


if TYPE_CHECKING:
	from .configuration_tvlt import TVLT_PRETRAINED_CONFIG_ARCHIVE_MAP, TvltConfig
	from .processing_tvlt import TvltProcessor
	from .feature_extraction_tvlt import TvltFeatureExtractor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tvlt import (
		    TVLT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TvltForAudioVisualClassification,
		    TvltForPreTraining,
		    TvltModel,
		    TvltPreTrainedModel,
		)

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .image_processing_tvlt import TvltImageProcessor


else:
	import sys

	_a      :				Tuple											=					_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






'''simple docstring'''







from cva import destroyAllWindows, imread, imshow, waitKey





def      _lowerCAmelCase		(		lowercase      ,			lowercase			)      ->      int:
			__lowerCAmelCase		, __lowerCAmelCase      		=       img.shape[0], img.shape[1]

			def to_grayscale(lowercase      ,			lowercase      ,			lowercase			):
						return 0.21_26 * red + 0.5_87 * green + 0.1_14 * blue

			def normalize(lowercase			):
						return min(lowercase      ,			255			)

			for i in range(lowercase			):
						for j in range(lowercase			):
									__lowerCAmelCase      		=       int(to_grayscale(*img[i][j]			)			)
									__lowerCAmelCase      		=       [
									    normalize(lowercase			),
									    normalize(greyscale + factor			),
									    normalize(greyscale + 2 * factor			),
									]

			return img


if __name__ == "__main__":
	# read original image
	_a      :				Any											=					{
	    percentage: imread("""image_data/lena.jpg""", 1) for percentage in (1_0, 2_0, 3_0, 4_0)
	}

	for percentage, img in images.items():
		make_sepia(img, percentage)

	for percentage, img in images.items():
		imshow(f'Original image with sepia (factor: {percentage})', img)

	waitKey(0)
	destroyAllWindows()

