File tree Expand file tree Collapse file tree
src/physics_simulator/utils Expand file tree Collapse file tree Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments