DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

perception/path/camera/docs/usecase1_pathdetector.md
Go to the documentation of this file.
1 # Copyright (c) 2019-2020 NVIDIA CORPORATION. All rights reserved.
2 
3 @page pathperception_usecase1_pathdetector Path Perception Workflow
4 
5 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
6 
7 The following code snippet shows the general structure of a program that uses path detector to detect drive-able paths from a single camera. Note that error handling is left out for clarity.
8 
9 Initialize PathNet default parameters and then the module:
10 ```
11 dwPathNetParams pathNetParams{};
12 dwPathNet_initDefaultParams(&pathNetParams));
13 dwPathNet_initialize(&pathNetHandle, &pathNetParams, sdkHandle));
14 ```
15 
16 Initialize Path detector module from initialized PathNet handle without calibrated camera:
17 ```
18 dwPathDetector_initializeFromPathNet(&pathDetectorHandle,
19  pathNetHandle,
20  cameraWidth,
21  cameraHeight,
22  cudaStream,
23  sdkHandle);
24 ```
25 
26 Initialize Path detector module from initialized PathNet handle with calibrated camera:
27 ```
28 dwPathDetector_initializeFromPathNet(&pathDetectorHandle,
29  pathNetHandle,
30  cameraWidth,
31  cameraHeight,
32  calibratedCameraHandle,
33  tranformationMatrix,
34  cudaStream,
35  sdkHandle);
36 ```
37 
38 Initialize detector parameters (optional):
39 ```
40 dwPathDetector_setTemporalSmoothFactor(temporalSmoothFactor, pathDetectorHandle);
41 dwRect roi = {...};
42 dwPathDetector_setDetectionROI(&roi, pathDetectorHandle);
43 dwStatus dwPathDetector_setComputeCenterRailFrom3D(computeCenterRailFrom3D, pathDetectorHandle);
44 ```
45 
46 Detect paths from a video sequence:
47 ```
48 while(true)
49 {
50  dwPathDetection paths{};
51  dwPathDetector_processDeviceAsync(frame, pathDetectorHandle);
52  dwPathDetector_interpretHost(pathDetectorHandle);
53  dwPathDetector_getPathDetections(&paths, pathDetectorHandle);
54 }
55 ```
56 
57 When finished, release the module handles:
58 ```
59 dwPathDetector_release(pathDetectorHandle);
60 dwPathNet_release(pathNetHandle);
61 ```
62 
63 For more detailed workflow, please refer to the path detection sample: @ref dwx_path_perception_sample