Skip to content

Commit bf69981

Browse files
committed
downsample pc2
1 parent 2872618 commit bf69981

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

GEMstack/onboard/perception/fusion.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,24 @@ def fusion_callback(self, image: Image, lidar_pc2_msg: PointCloud2):
4545

4646
# Convert 1D PointCloud2 data to x, y, z coords
4747
lidar_points = convert_pointcloud2_to_xyz(lidar_pc2_msg)
48-
49-
# Transform LiDAR points into the camera coordinate frame.
50-
lidar_in_camera = transform_lidar_points(lidar_points, self.R, self.t)
51-
52-
# Project the transformed points into the image plane.
53-
projected_pts = project_points(lidar_in_camera, self.K)
5448

5549
# Convert numpy array to Open3D point cloud
56-
transformed_points = projected_pts
5750
pcd = o3d.geometry.PointCloud()
58-
pcd.points = o3d.utility.Vector3dVector(transformed_points)
51+
pcd.points = o3d.utility.Vector3dVector(lidar_points)
5952

6053
# Apply voxel grid downsampling
6154
voxel_size = 0.1 # Adjust for desired resolution
6255
downsampled_pcd = pcd.voxel_down_sample(voxel_size=voxel_size)
6356

6457
# Convert back to numpy array
6558
transformed_points = np.asarray(downsampled_pcd.points)
66-
print(f"after :{transformed_points.shape}")
59+
60+
# Transform LiDAR points into the camera coordinate frame.
61+
lidar_in_camera = transform_lidar_points(transformed_points, self.R, self.t)
62+
63+
# Project the transformed points into the image plane.
64+
projected_pts = project_points(lidar_in_camera, self.K)
65+
6766

6867
# Process bboxes
6968
self.last_person_boxes = []

0 commit comments

Comments
 (0)