Use the SDK interface to quickly obtain LiDAR point cloud data and save it to a PLY file when triggered by user input.
Initialize pipeline and start LiDAR stream
ob::Pipeline pipe;
pipe.start();
Wait for user input to trigger point cloud capture
auto key = ob_smpl::waitForKeyPressed();
if(key == 'r' || key == 'R') {
// Capture point cloud
}
Capture and save LiDAR point cloud data
auto frameset = pipe.waitForFrameset();
auto frame = frameset->getFrame(OB_FRAME_LIDAR_POINTS);
ob::PointCloudHelper::savePointcloudToPly("LiDARPoints.ply", frame, false, false, 50);
Stop the pipeline
pipe.stop();
The program will generate “LiDARPoints.ply” file containing the 3D point cloud data when the R key is pressed. The file can be opened with 3D point cloud visualization software.
LiDAR stream is started!
Press R or r to create LiDAR PointCloud and save to ply file!
Press ESC to exit!
Save LiDAR PointCloud to ply file, this will take some time...
LiDARPoints.ply Saved
Save LiDAR PointCloud to ply file, this will take some time...
LiDARPoints.ply Saved