1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page waitcondition_usecase3 Wait Conditions Detector Workflow
5 @note SW Release Applicability: This tutorial is applicable to modules in **NVIDIA DRIVE Software** releases.
7 The following code snippet shows the general structure of a program that uses waitconditions detector to detect intersections, traffic lights and traffic signs.
9 Initialize WaitNet default parameters, WaitNet, detector parameters and then the detector.
11 dwWaitNetParams waitnetParams{};
12 dwWaitNet_initDefaultParams(&waitnetParams)
13 dwWaitNet_initialize(&waitnetHandle, &waitnetParams, context);
14 dwWaitConditionsDetectorParams wcDetectorParams;
15 dwWaitConditionsDetector_initDefaultParams(&wcDetectorParams);
16 dwWaitConditionsDetector_initializeFromWaitNetNew(&wcDetectorHandle, waitnetHandle,
17 &wcDetectorParams, cam2Rig, calibratedCamObj, motionObj, context);
20 Then bind output and set cuda stream:
22 dwWaitConditionsDetectorOutput detectorOutput{};
23 dwIntersectionDetection detectedIntersections[DW_WAIT_CONDITIONS_DETECTOR_MAX_INTERSECTIONS];
24 intersectionsBuffer.buffer = detectedIntersections;
25 intersectionsBuffer.size = 0;
26 intersectionsBuffer.maxSize = DW_WAIT_CONDITIONS_DETECTOR_MAX_INTERSECTIONS;
27 detectorOutput.intersections = &intersectionsBuffer;
28 dwWaitConditionsDetector_bindOutput(&detectorOutput, wcDetectorHandle);
29 dwWaitConditionsDetector_setCUDAStream(cudaStream, wcDetectorHandle);
32 Detect intersections, traffic lights and traffic signs:
34 dwWaitConditionsDetector_inferDeviceAsync(&imageIn, imageNum, wcDetectorHandle);
35 dwWaitConditionsDetector_interpret(imageNum, wcDetectorHandle);
38 When finished, release the module handles:
40 dwWaitConditionsDetector_release(wcDetectorHandle);
41 dwWaitNet_release(waitnetHandle);
44 For more detailed workflow, please refer to the intersection detector sample: @ref dwx_sample_intersection_detector