



def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					if len(snake_case     ) == 1:
										return a[0], a[0]
					else:
										# split A into half.
										_lowerCAmelCase         =       a[: len(snake_case     ) // 2]
										_lowerCAmelCase         =       a[len(snake_case     ) // 2 :]

										# 2 sub problems, 1/2 of original size.
										_lowerCAmelCase      ,      _lowerCAmelCase         =       max_difference(snake_case     )
										_lowerCAmelCase      ,      _lowerCAmelCase         =       max_difference(snake_case     )

										# get min of first and max of second
										# linear time
										_lowerCAmelCase         =       min(snake_case     )
										_lowerCAmelCase         =       max(snake_case     )

										# 3 cases, either (small1, big1),
										# (min_first, max_second), (small2, big2)
										# constant comparisons
										if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
															return smalla, biga
										elif biga - smalla > max_second - min_first:
															return smalla, biga
										else:
															return min_first, max_second


if __name__ == "__main__":
	import doctest

	doctest.testmod()











"""simple docstring"""

from cva import destroyAllWindows, imread, imshow, waitKey






def _lowerCAmelCase						(	__lowerCamelCase:Tuple			,    __lowerCamelCase:int ):

						'''simple docstring'''






						__magic_name__   ,     __magic_name__      =  img.shape[0], img.shape[1]

						def to_grayscale(__lowerCamelCase:List[str]			,    __lowerCamelCase:Optional[Any]			,    __lowerCamelCase:int ):
												return 0.2_1_2_6 * red + 0.5_8_7 * green + 0.1_1_4 * blue

						def normalize(__lowerCamelCase:Union[str, Any] ):
												return min(__lowerCamelCase			,    2_5_5 )

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

						return img


if __name__ == "__main__":
			# read original image
			lowercase           =							{
			    percentage: imread('''image_data/lena.jpg''', 1) for percentage in (10, 20, 30, 40)
			}

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



