mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-27 19:40:17 +08:00
Fixing resize_image and adding additional distortion check (#3162)
adding fixes for the runtime error on masking as well as distortion checking Co-authored-by: J.Y <132313008+jb-ye@users.noreply.github.com>
This commit is contained in:
1 parent
5a341eac2c
commit
456930c213
2 files changed
+2
-1
No files matched your search
@@ -161,7 +161,7 @@ class FullImageDatamanager(DataManager, Generic[TDataset]):
|
|||||||
f'The size of image ({data["image"].shape[1]}, {data["image"].shape[0]}) loaded '
|
f'The size of image ({data["image"].shape[1]}, {data["image"].shape[0]}) loaded '
|
||||||
f'does not match the camera parameters ({camera.width.item(), camera.height.item()})'
|
f'does not match the camera parameters ({camera.width.item(), camera.height.item()})'
|
||||||
)
|
)
|
||||||
if camera.distortion_params is None:
|
if camera.distortion_params is None or torch.all(camera.distortion_params == 0):
|
||||||
return data
|
return data
|
||||||
K = camera.get_intrinsics_matrices().numpy()
|
K = camera.get_intrinsics_matrices().numpy()
|
||||||
distortion_params = camera.distortion_params.numpy()
|
distortion_params = camera.distortion_params.numpy()
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ def resize_image(image: torch.Tensor, d: int):
|
|||||||
"""
|
"""
|
||||||
import torch.nn.functional as tf
|
import torch.nn.functional as tf
|
||||||
|
|
||||||
|
image = image.to(torch.float32)
|
||||||
weight = (1.0 / (d * d)) * torch.ones((1, 1, d, d), dtype=torch.float32, device=image.device)
|
weight = (1.0 / (d * d)) * torch.ones((1, 1, d, d), dtype=torch.float32, device=image.device)
|
||||||
return tf.conv2d(image.permute(2, 0, 1)[:, None, ...], weight, stride=d).squeeze(1).permute(1, 2, 0)
|
return tf.conv2d(image.permute(2, 0, 1)[:, None, ...], weight, stride=d).squeeze(1).permute(1, 2, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user