INNER CODE UNIT · Python
resize_img
muskie82/MonoGS · gui/gui_utils.py:115
def resize_img(self, img, width):
if img is None:
return None
# check if img is numpy
if isinstance(img, np.ndarray):
height = int(width * img.shape[0] / img.shape[1])
return cv2.resize(img, (width, height))
height = int(width * img.shape[1] / img.shape[2])
# img is 3xHxW
img = torch.nn.functional.interpolate(
img.unsqueeze(0), size=(height, width), mode="bilinear", align_corners=False
)
return img.squeeze(0)
def get_covariance(self, scaling_modifier=1):
return self.build_covariance_from_scaling_rotation(
self.get_scaling, scaling_modifier, self._rotation