
'''simple docstring'''
from __future__ import annotations






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				):  # noqa: E741
							while r - l > 1:
														_snake_case       =  (l + r) // 2
														if v[m] >= key:
																					_snake_case       =  m
														else:
																					_snake_case       =  m  # noqa: E741
							return r






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							if len(_SCREAMING_SNAKE_CASE				) == 0:
														return 0

							_snake_case       =  [0] * len(_SCREAMING_SNAKE_CASE				)
							_snake_case       =  1

							_snake_case       =  v[0]

							for i in range(1							, len(_SCREAMING_SNAKE_CASE				)				):
														if v[i] < tail[0]:
																					_snake_case       =  v[i]
														elif v[i] > tail[length - 1]:
																					_snake_case       =  v[i]
																					length += 1
														else:
																					_snake_case       =  v[i]

							return length


if __name__ == "__main__":
				import doctest

				doctest.testmod()

'''simple docstring'''
import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey


class       _lowerCAmelCase   :







							'''simple docstring'''

							def __init__(self  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       List[str]:
														if dst_width < 0 or dst_height < 0:
																					raise ValueError("""Destination width/height should be > 0"""  )

														_snake_case       =  img
														_snake_case       =  img.shape[1]
														_snake_case       =  img.shape[0]
														_snake_case       =  dst_width
														_snake_case       =  dst_height

														_snake_case       =  self.src_w / self.dst_w
														_snake_case       =  self.src_h / self.dst_h

														_snake_case       =  _snake_case       =  (
														    np.ones((self.dst_h, self.dst_w, 3)  ,  np.uinta  ) * 255
														)

							def 	lowercase							(self  )					->       List[Any]:
														for i in range(self.dst_h  ):
																					for j in range(self.dst_w  ):
																												_snake_case       =  self.img[self.get_y(UpperCAmelCase  )][self.get_x(UpperCAmelCase  )]

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
														return int(self.ratio_x * x  )





							def 	lowercase							(self  ,  UpperCAmelCase  )					->       int:
														return int(self.ratio_y * y  )


if __name__ == "__main__":
				__lowerCAmelCase							,    __lowerCAmelCase												=	800, 600
				__lowerCAmelCase												=	imread('image_data/lena.jpg', 1)
				__lowerCAmelCase												=	NearestNeighbour(im, dst_w, dst_h)
				n.process()

				imshow(
				    f'''Image resized from: {im.shape[1]}x{im.shape[0]} to {dst_w}x{dst_h}''', n.output
				)
				waitKey(0)
				destroyAllWindows()