From 38fc72729cc86d3e0d11c2df16f69f5da603b2d8 Mon Sep 17 00:00:00 2001 From: Abhik Ahuja Date: Tue, 26 Dec 2023 17:07:08 -0800 Subject: [PATCH] Fix dycheck depth and rgb rescale (#2623) Fix depth and rgb rescale Not sure if depth is correct since I'm not sure what the 3rd dim is for, the code runs properly though. --- nerfstudio/data/dataparsers/dycheck_dataparser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nerfstudio/data/dataparsers/dycheck_dataparser.py b/nerfstudio/data/dataparsers/dycheck_dataparser.py index d9d4c8f4c..9af4f5800 100644 --- a/nerfstudio/data/dataparsers/dycheck_dataparser.py +++ b/nerfstudio/data/dataparsers/dycheck_dataparser.py @@ -173,7 +173,10 @@ def _rescale_depth(depth_raw: np.ndarray, cam: Dict) -> np.ndarray: viewdirs /= np.linalg.norm(viewdirs, axis=-1, keepdims=True) viewdirs = viewdirs.reshape((*batch_shape, 3)) cosa = viewdirs @ (cam["camera_to_worlds"][:, 2]) - depth = depth_raw / cosa[..., None] + if depth_raw.ndim == cosa.ndim: + depth = depth_raw[..., None] / cosa[..., None] + else: + depth = depth_raw / cosa[..., None] return depth