


"""simple docstring"""
from math import loga

def 				_snake_case      (   __snake_case							:      Optional[Any]   ):




   """simple docstring"""







   if a < 0:
      raise ValueError("""Input value must be a positive integer"""   )
   elif isinstance(a__						, a__   ):
      raise TypeError("""Input value must be a \'int\' type"""   )
   return 0 if (a == 0) else int(loga(a & -a   )   )


if __name__ == "__main__":
 import doctest

 doctest.testmod()









"""simple docstring"""


import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey




class 						__UpperCamelCase     :
					def __init__(							self							:	Union[str, Any]     , UpperCAmelCase							:	Union[str, Any]     , UpperCAmelCase							:	int     , UpperCAmelCase							:	int   )	->       Tuple:
											if dst_width < 0 or dst_height < 0:
																	raise ValueError('Destination width/height should be > 0'   )

											lowerCAmelCase   :List[Any]						=			img
											lowerCAmelCase   :Optional[int]						=			img.shape[1]
											lowerCAmelCase   :Union[str, Any]						=			img.shape[0]
											lowerCAmelCase   :Optional[int]						=			dst_width
											lowerCAmelCase   :Optional[int]						=			dst_height

											lowerCAmelCase   :Any						=			self.src_w / self.dst_w
											lowerCAmelCase   :Dict						=			self.src_h / self.dst_h

											lowerCAmelCase   :int						=			(
											    np.ones((self.dst_h, self.dst_w, 3)     , np.uinta   ) * 255
											)
					def        UpperCAmelCase__ (							self							:	Union[str, Any]   )	->       List[str]:
											for i in range(self.dst_h   ):
																	for j in range(self.dst_w   ):
																							lowerCAmelCase   :Optional[Any]						=			self.img[self.get_y(UpperCAmelCase   )][self.get_x(UpperCAmelCase   )]
					def        UpperCAmelCase__ (							self							:	Optional[int]     , UpperCAmelCase							:	int   )	->       int:
											return int(self.ratio_x * x   )
					def        UpperCAmelCase__ (							self							:	List[str]     , UpperCAmelCase							:	int   )	->       int:
											return int(self.ratio_y * y   )


if __name__ == "__main__":
		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE   =   8_00, 6_00
		__SCREAMING_SNAKE_CASE   =   imread('image_data/lena.jpg', 1)
		__SCREAMING_SNAKE_CASE   =   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()