Skip to content

Commit 2769206

Browse files
committed
update preprocess_depth method
1 parent e1f9112 commit 2769206

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

src/physics_simulator/utils/file_process.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,13 @@ def preprocess_depth(
133133
Raises:
134134
ValueError: If the depth data is not a valid shape or if the specified min_value/max_value are invalid.
135135
"""
136-
# Scale the depth data
137136
depth_data_scaled = depth_data * scale
138-
139-
# Clamp the depth data
140-
# if min_value is not None or max_value is not None:
141-
# depth_data_clamped = np.clip(depth_data_scaled, min_value, max_value)
142-
depth_data_clamped = depth_data_scaled
143-
if max_value is not None:
144-
depth_data_clamped[depth_data_clamped > max_value] = 0
145-
if min_value is not None:
146-
depth_data_clamped[depth_data_clamped < min_value] = 0
147-
137+
if min_value is not None or max_value is not None:
138+
depth_data_clamped = np.clip(depth_data_scaled,
139+
min_value if min_value is not None else depth_data_scaled.min(),
140+
max_value if max_value is not None else depth_data_scaled.max())
148141
else:
149142
depth_data_clamped = depth_data_scaled
150-
# Convert to the desired data type
151143
processed_data = depth_data_clamped.astype(data_type)
152144
return processed_data
153145

0 commit comments

Comments
 (0)