DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

Object Detector Workflow
SW Release Applicability: This tutorial is applicable to modules in NVIDIA DRIVE Software releases.

This code snippet shows how the Object Detector module is typically used. Note that error handling is left out for clarity.

Initialize ObjectDetector parameters with default values.

Modify parameters as needed.

// Detect objects inside the full image
detectorParams.ROIs[0] = {0, 0, imageWidth, imageHeight};

Initialize ObjectDetector module from DriveNet.

dwObjectDetector_initializeFromDriveNet(&detectorHandle, &detectorParameters, driveNetHandle, contextHandle);

Allocate a container for storing the detections. The container needs to have enough space for all detections of all classes known to the object detector.

dwObjectArray detections = {};

Run all object detector processing steps on the given image.

dwObjectDetector_detectObjects(&detections, rcbImage, detectorHandle);

Access the bounding boxes and classes of the detections.

dwObjectCamera* array = static_cast<dwObjectCamera*>(detections.objects);
for (uint32_t i = 0; i < detections.count; ++i)
// dwRectf boundingBox = array[i].box2D;
// dwObjectClass objectClass = array[i].details.objectClass;

To check whether depth values for the objects detected from DriveNet are available.

bool isObjectDepthEnabled;
dwObjectDetector_isObjectDepthEnabled(&isObjectDepthEnabled, detectorHandle);

Finally, free memory allocated by the array and the detector.

// Free resources

For more details see DriveNet Sample.