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 authored and GitHub committed 2023-12-27 01:07:08 +00:00
1 parent 7a8e31d84e
commit 38fc72729c
1 file changed
+4 -1
@@ -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 /= np.linalg.norm(viewdirs, axis=-1, keepdims=True)
viewdirs = viewdirs.reshape((*batch_shape, 3)) viewdirs = viewdirs.reshape((*batch_shape, 3))
cosa = viewdirs @ (cam["camera_to_worlds"][:, 2]) 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 return depth