OrbbecSDK_v2

C++ Sample: 0.lidar_quik_start

Overview

Use the SDK interface to quickly obtain LiDAR point cloud data and save it to a PLY file when triggered by user input.

Knowledge

Code Overview

  1. Initialize pipeline and start LiDAR stream

     ob::Pipeline pipe;
     pipe.start();
    
  2. Wait for user input to trigger point cloud capture

     auto key = ob_smpl::waitForKeyPressed();
     if(key == 'r' || key == 'R') {
         // Capture point cloud
     }
    
  3. 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);
    
  4. Stop the pipeline

     pipe.stop();
    

Run Sample

Result

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