4
0
mirror of https://github.com/nerfstudio-project/nerfstudio.git synced 2026-11-11 18:44:21 +08:00

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.
This commit is contained in:
Abhik Ahuja 2023-12-26 17:07:08 -08:00 committed by GitHub
parent 7a8e31d84e
commit 38fc72729c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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