






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



class 				_UpperCamelCase      :


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

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

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

           __lowerCAmelCase             =       __lowerCAmelCase             =       (
               np.ones((self.dst_h, self.dst_w, 3)       ,    np.uinta						) * 2_5_5
           )


      def 			__UpperCAmelCase		(						self						)->						Dict:
           for i in range(self.dst_h						):
                for j in range(self.dst_w						):
                     __lowerCAmelCase             =       self.img[self.get_y(__UpperCamelCase						)][self.get_x(__UpperCamelCase						)]


      def 			__UpperCAmelCase		(						self       ,    __UpperCamelCase						)->						int:
           return int(self.ratio_x * x						)


      def 			__UpperCAmelCase		(						self       ,    __UpperCamelCase						)->						int:
           return int(self.ratio_y * y						)


if __name__ == "__main__":
 lowerCamelCase   ,       lowerCamelCase      :       str    =						800, 600
 lowerCamelCase      :       int    =						imread('''image_data/lena.jpg''', 1)
 lowerCamelCase      :       int    =						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()














# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowerCamelCase      :       Dict    =						abspath(join(dirname(dirname(__file__)), '''src'''))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='''ignore''', category=FutureWarning)





def    __lowerCAmelCase   (    __snake_case							):
     from diffusers.utils.testing_utils import pytest_addoption_shared

     pytest_addoption_shared(__snake_case							)





def    __lowerCAmelCase   (    __snake_case							):
     from diffusers.utils.testing_utils import pytest_terminal_summary_main

     __lowerCAmelCase             =       terminalreporter.config.getoption("--make-reports"							)
     if make_reports:
          pytest_terminal_summary_main(__snake_case       ,			id=__snake_case							)






