mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-15 20:33:59 +08:00
1 parent
3b8e2ce9ec
commit
9a4f5e8e45
3 files changed
+352
-4
No files matched your search
@@ -64,8 +64,8 @@ def get_depth_image_from_path(
|
||||
interpolation: int = cv2.INTER_NEAREST,
|
||||
) -> torch.Tensor:
|
||||
"""Loads, rescales and resizes depth images.
|
||||
Filepath points to a 16-bit or 32-bit depth image, or a numpy array `*.npy`.
|
||||
|
||||
Assumes filepath points to a 16-bit or 32-bit depth image.
|
||||
Args:
|
||||
filepath: Path to depth image.
|
||||
height: Target depth image height.
|
||||
@@ -76,7 +76,11 @@ def get_depth_image_from_path(
|
||||
Returns:
|
||||
Depth image torch tensor with shape [width, height, 1].
|
||||
"""
|
||||
image = cv2.imread(str(filepath.absolute()), cv2.IMREAD_ANYDEPTH)
|
||||
image = image.astype(np.float64) * scale_factor
|
||||
image = cv2.resize(image, (width, height), interpolation=interpolation)
|
||||
if filepath.suffix == ".npy":
|
||||
image = np.load(filepath) * scale_factor
|
||||
image = cv2.resize(image, (width, height), interpolation=interpolation)
|
||||
else:
|
||||
image = cv2.imread(str(filepath.absolute()), cv2.IMREAD_ANYDEPTH)
|
||||
image = image.astype(np.float64) * scale_factor
|
||||
image = cv2.resize(image, (width, height), interpolation=interpolation)
|
||||
return torch.from_numpy(image[:, :, np.newaxis])
|
||||
Reference in new issue
Block a user