


"""simple docstring"""


import numpy as np
from cva import destroyAllWindows, imread, imshow, waitKey
class snake_case      :







		def __init__(					self      :       Union[str, Any]    ,   a__      :       List[str]    ,   a__      :       int    ,   a__      :       int		)       ->						List[str]:





						'''simple docstring'''







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

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

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

						_A					  =			_A					  =			(
						    np.ones((self.dst_h, self.dst_w, 3)    ,   np.uinta		) * 2_55
						)







		def  a_ (					self      :       Dict		)       ->						Dict:





						'''simple docstring'''







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







		def  a_ (					self      :       Tuple    ,   a__      :       int		)       ->						int:





						'''simple docstring'''







						return int(self.ratio_x * x		)







		def  a_ (					self      :       Any    ,   a__      :       int		)       ->						int:





						'''simple docstring'''







						return int(self.ratio_y * y		)


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

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a_       							=    {
    "configuration_upernet": ["UperNetConfig"],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		a_       							=    [
		    "UperNetForSemanticSegmentation",
		    "UperNetPreTrainedModel",
		]


if TYPE_CHECKING:
		from .configuration_upernet import UperNetConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_upernet import UperNetForSemanticSegmentation, UperNetPreTrainedModel


else:
		import sys

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