Skip to content

Commit ffbd16a

Browse files
authored
Fix edge case of depth colormap (#3139)
If the user sets near_plane as 0.0, the "or" will take the second term (float(torch.min(depth))) instead of using the 0.0 value. We fix this by checking explicitely for a "None" variable
1 parent 7ba02be commit ffbd16a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nerfstudio/utils/colormaps.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def apply_depth_colormap(
134134
Colored depth image with colors in [0, 1]
135135
"""
136136

137-
near_plane = near_plane or float(torch.min(depth))
138-
far_plane = far_plane or float(torch.max(depth))
137+
near_plane = near_plane if near_plane is not None else float(torch.min(depth))
138+
far_plane = far_plane if far_plane is not None else float(torch.max(depth))
139139

140140
depth = (depth - near_plane) / (far_plane - near_plane + 1e-10)
141141
depth = torch.clip(depth, 0, 1)

0 commit comments

Comments
 (0)