DriveWorks SDK Reference
5.8.83 Release
For Test and Development only

Point Cloud Stitching

This tutorial shows how to stitch multiple point clouds in a common coordinate system.

Assume there are three individual point clouds created and accumulated. You can initialize the module:

dwPointCloud accumulatedPointClouds[3];
dwPointCloud stitchedPointCloud;
dwTransformation3f pointCloudTransformations[3];
// allocate memory for individual point cloud and stitched point cloud
......
// accumulate lidar packets to point cloud spin
......
// get transformations for each point cloud
......
dwPointCloudStitcher_initialize(&stitcher, context);
for (uint32_t i = 0; i < 3; i++)
{
dwPointCloudStitcher_bindInput(i, &accumulatedPointClouds[i], pointCloudTransformations[i], stitcher);
}
dwPointCloudStitcher_bindOutput(&stitchedPointCloud, stitcher);
Specifies a 3D rigid transformation.
Definition: Types.h:536
Defines point cloud data structure.
Definition: PointCloud.h:99
DW_API_PUBLIC dwStatus dwPointCloudStitcher_bindInput(dwBindSlot slot, const dwPointCloud *pointCloud, const dwTransformation3f *transform, dwPointCloudStitcherHandle_t obj)
Binds input point cloud to the point cloud stitcher.
DW_API_PUBLIC dwStatus dwPointCloudStitcher_bindOutput(dwPointCloud *points, dwPointCloudStitcherHandle_t obj)
Binds output buffer to the point cloud stitcher.
DW_API_PUBLIC dwStatus dwPointCloudStitcher_initialize(dwPointCloudStitcherHandle_t *obj, dwContextHandle_t ctx)
Initializes point cloud stitcher.
struct dwPointCloudStitcherObject * dwPointCloudStitcherHandle_t
DW_API_PUBLIC dwStatus dwPointCloudStitcher_setCUDAStream(const cudaStream_t stream, dwPointCloudStitcherHandle_t obj)
Sets CUDA stream of point cloud stitcher.

There is an ability to apply global transformation to all stitched points. To do this:

DW_API_PUBLIC dwStatus dwPointCloudStitcher_setGlobalTransformation(const dwTransformation3f *tx, dwPointCloudStitcherHandle_t obj)
Sets global transformation for the stitched point cloud.

In reality each point cloud was captured in a different timestamp, stitching together would cause motion artifacts. To correct such distortion:

dwPointCloudStitcher_enableMotionCompensation(referenceTimestamp, egomotion, stitcher);
cudaStreamSynchronize(stream);
DW_API_PUBLIC dwStatus dwPointCloudStitcher_process(dwPointCloudStitcherHandle_t obj)
Transforms all the input point clouds to a common coordinate.
DW_API_PUBLIC dwStatus dwPointCloudStitcher_enableMotionCompensation(dwTime_t timestamp, dwEgomotionConstHandle_t egomotion, dwPointCloudStitcherHandle_t obj)
Enables motion compensation for the stitched point cloud.

egomotion is needed to correct the distortion based on the relative egomotion between referenceTimestamp and individual point cloud's timestamp. Please see Relative Egomotion Workflow for egomotion usecase.

To release the module:

DW_API_PUBLIC dwStatus dwPointCloudStitcher_release(dwPointCloudStitcherHandle_t obj)
Releases point cloud stitcher.

For more details see Point Cloud Processing Sample