Point Cloud Capture Process

The capture API returns at some moment in time after the camera completes capturing raw images and before or at the moment the point cloud processing is done. This depends on the GPU (vendor and driver). Therefore, after the capture API returns, the point cloud processing might still be running in the background.

Tip

Use recommended hardware to minimize computation time.

Go to source

source

const auto frame = camera.capture(settings);

The API to get the point cloud always returns a point cloud object right away. The point cloud object holds a handle to the point cloud data in GPU memory. Point cloud processing might also still be running in the background at this point.

Go to source

source

const auto pointCloud = frame.pointCloud();

We need to call the API to copy the point cloud from the GPU memory to the CPU memory. The copy function will block and wait until the data is available before copying it. When the function returns, the data is available and ready for use in CPU memory.

Note

Even if using a CPU with an integrated GPU, the data is copied to a different area on the same main RAM.

Go to source

source

const auto data = pointCloud.copyData<Zivid::PointXYZColorRGBA>();

When the point cloud is available on the CPU memory, we can utilize it in our machine vision application.

Performance considerations

Operations on the point cloud in Zivid SDK, e.g., Downsample, Transform, and Normals, are computed on the GPU while the point cloud is still in GPU memory. In addition, by downsampling on the GPU with Zivid API, there is also less data to copy to the CPU. Therefore, it is beneficial to use Zivid SDK for these operations for performance reasons. Implementing these point cloud operations with a third-party library is likely more time-consuming. In general, CPU computations are much slower. In addition, GPU computations require another copy from the CPU memory back to the GPU memory because a Zivid SDK user cannot access the GPU memory used by Zivid SDK.