'''simple docstring'''


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





class       _a    :


  """simple docstring"""

  def __init__(		self      :       Optional[Any]   ,				lowercase_      :       int   ,				lowercase_      :       int   ,				lowercase_      :       int      ):







    '''simple docstring'''


    if dst_width < 0 or dst_height < 0:
      raise ValueError("""Destination width/height should be > 0"""      )

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

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

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




  def 		lowerCamelCase__  (		self      :       Union[str, Any]      ):







    '''simple docstring'''


    for i in range(self.dst_h      ):
      for j in range(self.dst_w      ):
        lowercase_     =       self.img[self.get_y(lowercase_      )][self.get_x(lowercase_      )]




  def 		lowerCamelCase__  (		self      :       Union[str, Any]   ,				lowercase_      :       int      ):







    '''simple docstring'''


    return int(self.ratio_x * x      )





  def 		lowerCamelCase__  (		self      :       int   ,				lowercase_      :       int      ):







    '''simple docstring'''


    return int(self.ratio_y * y      )


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


'''simple docstring'''


from typing import TYPE_CHECKING

# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


__snake_case						  =		{"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]}


try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __snake_case						  =		[
           """FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """FocalNetForImageClassification""",
           """FocalNetForMaskedImageModeling""",
           """FocalNetBackbone""",
           """FocalNetModel""",
           """FocalNetPreTrainedModel""",
       ]

if TYPE_CHECKING:
       from .configuration_focalnet import FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FocalNetConfig

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_focalnet import (
                  FOCALNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                  FocalNetBackbone,
                  FocalNetForImageClassification,
                  FocalNetForMaskedImageModeling,
                  FocalNetModel,
                  FocalNetPreTrainedModel,
              )

else:
       import sys

       __snake_case						  =		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)

