Skip to content

Commit 3f6902b

Browse files
committed
update depth filter
1 parent aa61b0f commit 3f6902b

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

GEMstack/onboard/perception/fusion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self):
1919
self.confidence = 0.7
2020
self.classes_to_detect = 0
2121
self.ground_threshold = 1.6
22-
self.human_depth = 1.2
22+
self.max_human_depth = 1.0
2323

2424
# Load calibration data
2525
self.R = load_extrinsics(os.getcwd() + '/GEMstack/onboard/perception/calibration/extrinsics/R.npy')
@@ -93,7 +93,7 @@ def fusion_callback(self, rgb_image_msg: Image, lidar_pc2_msg: PointCloud2):
9393

9494
# Apply ground and max distance filter to the extracted 5D points
9595
extracted_pts = filter_ground_points(extracted_pts, self.ground_threshold)
96-
extracted_pts = filter_far_points(extracted_pts)
96+
extracted_pts = filter_depth_points(extracted_pts)
9797

9898
# Extract 2D pedestrians points in camera frame
9999
extracted_2d_pts = list(extracted_pts[:, :2].astype(int))

GEMstack/onboard/perception/fusion_utils.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,14 @@ def filter_ground_points(lidar_points, ground_threshold = 0):
3535
return filtered_array
3636

3737

38-
def filter_far_points(lidar_points, human_depth=1.2):
39-
""" Filter points beyond a max distance in a point cluster """
40-
min_dist = np.min(lidar_points[:, 4])
41-
max_depth = min_dist + human_depth
42-
filtered_array = lidar_points[lidar_points[:, 4] < max_depth]
38+
def filter_depth_points(lidar_points, max_human_depth=1.0):
39+
""" Filter points beyond a max possible human depth in a point cluster """
40+
lidar_points_dist = lidar_points[:, 4]
41+
min_dist = np.min(lidar_points_dist)
42+
max_dist = np.max(lidar_points_dist)
43+
max_possible_dist = min_dist + max_human_depth
44+
actual_dist = min(max_dist, max_possible_dist)
45+
filtered_array = lidar_points[lidar_points_dist < actual_dist]
4346
return filtered_array
4447

4548

0 commit comments

Comments
 (0)