





'''simple docstring'''







from dataclasses import dataclass
from typing import List, Optional, Union

import numpy as np
import PIL
from PIL import Image

from ...utils import BaseOutput, is_torch_available, is_transformers_available





@dataclass
# Copied from diffusers.pipelines.stable_diffusion.__init__.StableDiffusionPipelineOutput with Stable->Alt
class 					_UpperCAmelCase							(		lowerCAmelCase_     ):
		a     :     Union[List[PIL.Image.Image], np.ndarray]
		a     :     Optional[List[bool]]


if is_transformers_available() and is_torch_available():
	from .modeling_roberta_series import RobertaSeriesModelWithTransformation
	from .pipeline_alt_diffusion import AltDiffusionPipeline
	from .pipeline_alt_diffusion_imgaimg import AltDiffusionImgaImgPipeline








'''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()

