DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

pointcloudprocessing/docs/usecase3.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
2 
3 @page pointcloudprocessing_usecase3 Point Cloud Stitching
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
6 
7 This tutorial shows how to stitch multiple point clouds in a common coordinate system.
8 
9 Assume there are three individual point clouds created and accumulated. You can initialize the module:
10 
11 ```{.cpp}
12 dwPointCloud accumulatedPointClouds[3];
13 dwPointCloud stitchedPointCloud;
14 dwTransformation3f pointCloudTransformations[3];
15 
16 // allocate memory for individual point cloud and stitched point cloud
17 ......
18 
19 // accumulate lidar packets to point cloud spin
20 ......
21 
22 // get transformations for each point cloud
23 ......
24 
25 dwPointCloudStitcherHandle_t stitcher;
26 dwPointCloudStitcher_initialize(&stitcher, context);
27 dwPointCloudStitcher_setCUDAStream(stream, stitcher);
28 
29 for (uint32_t i = 0; i < 3; i++)
30 {
31  dwPointCloudStitcher_bindInput(i, &accumulatedPointClouds[i], pointCloudTransformations[i], stitcher);
32 }
33 
34 dwPointCloudStitcher_bindOutput(&stitchedPointCloud, stitcher);
35 ```
36 
37 There is an ability to apply global transformation to all stitched points. To do this:
38 
39 ```{.cpp}
40 dwPointCloudStitcher_setGlobalTransformation(&rigToWorld, stitcher);
41 ```
42 
43 In reality each point cloud was captured in a different timestamp, stitching together would cause motion artifacts.
44 To correct such distortion:
45 
46 ```{.cpp}
47 dwPointCloudStitcher_enableMotionCompensation(referenceTimestamp, egomotion, stitcher);
48 dwPointCloudStitcher_process(stitcher);
49 cudaStreamSynchronize(stream);
50 ```
51 
52 `egomotion` is needed to correct the distortion based on the relative egomotion between `referenceTimestamp` and individual point cloud's timestamp.
53 Please see @ref egomotion_usecase1 for egomotion usecase.
54 
55 
56 To release the module:
57 
58 ```{.cpp}
59 dwPointCloudStitcher_release(stitcher);
60 ```
61 
62 For more details see @ref dwx_pointcloudprocessing_sample