DriveWorks SDK Reference
3.0.4260 Release
For Test and Development only

PathDetector Interface

Detailed Description

Defines path detector module based on PathNet, i.e., DNN based path detector.

Note
SW Release Applicability: These APIs are available in NVIDIA DRIVE Software releases.

Data Structures

struct  dwPathDetection
 Output paths from post-processing. More...
 
struct  dwPathNetPath
 Definition of one path in image coordinate system. More...
 
struct  dwPathNetPath3D
 Definition of one path in world coordinate system. More...
 

Macros

#define DW_PATH_MAX_COUNT   8
 
#define DW_PATH_POINT_MAX_COUNT   128
 

Typedefs

typedef struct dwPathDetectorObject * dwPathDetectorHandle_t
 Handle to path detector. More...
 

Functions

DW_API_PUBLIC dwStatus dwPathDetector_getComputeCenterRailFrom3D (bool *computeCenterRailFrom3D, dwPathDetectorHandle_t obj)
 Get the flag to compute 3D center rail from 3D path edges. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getCUDAStream (cudaStream_t *stream, dwPathDetectorHandle_t obj)
 Gets CUDA stream used by the path detection. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getDetectionROI (dwRect *roi, dwPathDetectorHandle_t obj)
 Get detection Region of Interest (ROI) for the detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getDetectionThreshold (float32_t *threshold, dwPathDetectorHandle_t obj)
 Gets the detection confidence threshold for the PathNet based detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getDNNMetaData (dwDNNMetaData *metaData, dwPathDetectorHandle_t obj)
 Returns the DNN metadata. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getMaxLookAheadDistance (float32_t *distance, dwPathDetectorHandle_t obj)
 Get max look ahead distance. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getOppositeTrafficDetectionThreshold (float32_t *threshold, dwPathDetectorHandle_t obj)
 Gets the opposite traffic path attribute confidence threshold for the PathNet based detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getPathDetections (dwPathDetection *paths, dwPathDetectorHandle_t obj)
 Gets the latest computed results in image coordinates. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_getTemporalSmoothingFactor (float32_t *factor, dwPathDetectorHandle_t obj)
 Gets the temporal smoothing factor from Path detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_initializeFromPathNet (dwPathDetectorHandle_t *obj, dwPathNetHandle_t pathnet, uint32_t frameWidth, uint32_t frameHeight, cudaStream_t stream, dwContextHandle_t ctx)
 Initializes a path detector module based on PathNet. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_initializeFromPathNetWithCameraRig (dwPathDetectorHandle_t *obj, dwPathNetHandle_t pathnet, uint32_t frameWidth, uint32_t frameHeight, dwCameraModelHandle_t cam, dwTransformation3f cam2rig, cudaStream_t stream, dwContextHandle_t ctx)
 Initializes a path detector module based on PathNet with camera rig parameters. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_interpretHost (dwPathDetectorHandle_t obj)
 Runs the interpretation of the processed results on the CPU. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_processDeviceAsync (const dwImageCUDA *frame, dwPathDetectorHandle_t obj)
 Processes the given frame on the GPU asynchronously. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_release (dwPathDetectorHandle_t obj)
 Releases the detector module. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_reset (dwPathDetectorHandle_t obj)
 Resets the path detector module. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setCameraExtrinsics (const dwTransformation3f *cam2Rig, dwPathDetectorHandle_t obj)
 Sets new calibrated camera extrinsic. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setComputeCenterRailFrom3D (bool computeCenterRailFrom3D, dwPathDetectorHandle_t obj)
 Set the flag to compute 3D center rail from 3D path edges. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setCUDAStream (cudaStream_t stream, dwPathDetectorHandle_t obj)
 Sets the CUDA stream for CUDA related operations. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setDetectionROI (const dwRect *roi, dwPathDetectorHandle_t obj)
 Set detection Region of Interest (ROI) for the detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setDetectionThreshold (float32_t threshold, dwPathDetectorHandle_t obj)
 Sets the detection confidence threshold for the PathNet based detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setMaxLookAheadDistance (float32_t distance, dwPathDetectorHandle_t obj)
 Set max look ahead distance. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setOppositeTrafficDetectionThreshold (float32_t threshold, dwPathDetectorHandle_t obj)
 Sets the opposite traffic detection confidence threshold for the PathNet based detector. More...
 
DW_API_PUBLIC dwStatus dwPathDetector_setTemporalSmoothingFactor (float32_t factor, dwPathDetectorHandle_t obj)
 Sets the temporal smoothing factor for the Path detector. More...
 

Data Structure Documentation

◆ dwPathDetection

struct dwPathDetection
Data Fields
uint32_t numPathsImage Total number of paths.
uint32_t numPathsWorld Total number of valid paths in world coordinates.
dwPathNetPath pathsImage[DW_PATH_MAX_COUNT] Post processed paths in image coordinates.
dwPathNetPath3D pathsWorld[DW_PATH_MAX_COUNT] Post processed paths in world coordinates.
dwTime_t timestamp Timestamp of frame used for detection.

◆ dwPathNetPath

struct dwPathNetPath
Data Fields
dwVector2f centerRailPoints[DW_PATH_POINT_MAX_COUNT] Array containing path center locations.
float32_t confidence Confidence value of path.
float32_t confidenceValues[DW_PATH_POINT_MAX_COUNT] Array containing confidence value per point.
dwVector2f leftEdgePoints[DW_PATH_POINT_MAX_COUNT] Array containing path left edge locations.
uint32_t numPoints The total number of points that defines either right edge or left edge or center rail of each drive-able path.

In any case, total number of points for the right, left and the center edge are equal.

float32_t pathAngle[DW_PATH_POINT_MAX_COUNT] Array containing angle in degrees from center rail location.
float32_t pathAttributeConfidence Confidence value of path attributes.
dwPathAttributeType pathAttributeType Category of path attributes.
float32_t pathWidth[DW_PATH_POINT_MAX_COUNT] Array containing width of center rail location.
dwPathPositionType positionType Category of path position.
dwVector2f rightEdgePoints[DW_PATH_POINT_MAX_COUNT] Array containing path right edge locations.

◆ dwPathNetPath3D

struct dwPathNetPath3D
Data Fields
dwVector3f centerRailPoints[DW_PATH_POINT_MAX_COUNT] Array containing path center locations.
float32_t confidence Confidence value of path.
float32_t confidenceValues[DW_PATH_POINT_MAX_COUNT] Array containing confidence value per point.
dwVector3f leftEdgePoints[DW_PATH_POINT_MAX_COUNT] Array containing path left edge locations.
uint32_t numPoints The total number of points that defines either right edge or left edge or center rail of each drive-able path.

In any case, total number of points for the right, left and the center edge are equal.

float32_t pathAngle[DW_PATH_POINT_MAX_COUNT] Array containing angle in degrees from center rail location.
float32_t pathAttributeConfidence Confidence value of path attributes.
dwPathAttributeType pathAttributeType Category of path attributes.
float32_t pathWidth[DW_PATH_POINT_MAX_COUNT] Array containing width of center rail location.
dwPathPositionType positionType Category of path position.
dwVector3f rightEdgePoints[DW_PATH_POINT_MAX_COUNT] Array containing path right edge locations.

Macro Definition Documentation

◆ DW_PATH_MAX_COUNT

#define DW_PATH_MAX_COUNT   8

Definition at line 63 of file PathDetector.h.

◆ DW_PATH_POINT_MAX_COUNT

#define DW_PATH_POINT_MAX_COUNT   128

Definition at line 64 of file PathDetector.h.

Typedef Documentation

◆ dwPathDetectorHandle_t

typedef struct dwPathDetectorObject* dwPathDetectorHandle_t

Handle to path detector.

Definition at line 175 of file PathDetector.h.

Function Documentation

◆ dwPathDetector_getComputeCenterRailFrom3D()

DW_API_PUBLIC dwStatus dwPathDetector_getComputeCenterRailFrom3D ( bool *  computeCenterRailFrom3D,
dwPathDetectorHandle_t  obj 
)

Get the flag to compute 3D center rail from 3D path edges.

Parameters
[out]computeCenterRailFrom3Dflag to compute 3D center rail from 3D path edges.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getCUDAStream()

DW_API_PUBLIC dwStatus dwPathDetector_getCUDAStream ( cudaStream_t *  stream,
dwPathDetectorHandle_t  obj 
)

Gets CUDA stream used by the path detection.

Parameters
[out]streamThe CUDA stream currently used.
[in]objA handle to the path detection module.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_SUCCESS

◆ dwPathDetector_getDetectionROI()

DW_API_PUBLIC dwStatus dwPathDetector_getDetectionROI ( dwRect roi,
dwPathDetectorHandle_t  obj 
)

Get detection Region of Interest (ROI) for the detector.

Parameters
[out]roiROI of frame to be processed by the detector, default to full frame
[in]objA path detector handle
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given output pointer is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getDetectionThreshold()

DW_API_PUBLIC dwStatus dwPathDetector_getDetectionThreshold ( float32_t threshold,
dwPathDetectorHandle_t  obj 
)

Gets the detection confidence threshold for the PathNet based detector.

Parameters
[out]thresholdConfidence threshold above which the DNN result is considered valid path information.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given output pointer is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getDNNMetaData()

DW_API_PUBLIC dwStatus dwPathDetector_getDNNMetaData ( dwDNNMetaData metaData,
dwPathDetectorHandle_t  obj 
)

Returns the DNN metadata.

Parameters
[out]metaDataPointer to metaData struct.
[in]objSpecifies the PathNet handle.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given output pointer is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getMaxLookAheadDistance()

DW_API_PUBLIC dwStatus dwPathDetector_getMaxLookAheadDistance ( float32_t distance,
dwPathDetectorHandle_t  obj 
)

Get max look ahead distance.

Parameters
[out]distanceMax look ahead distance in meters.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getOppositeTrafficDetectionThreshold()

DW_API_PUBLIC dwStatus dwPathDetector_getOppositeTrafficDetectionThreshold ( float32_t threshold,
dwPathDetectorHandle_t  obj 
)

Gets the opposite traffic path attribute confidence threshold for the PathNet based detector.

Parameters
[out]thresholdabove which the DNN result is considered opposite traffic direction.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given output pointer is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getPathDetections()

DW_API_PUBLIC dwStatus dwPathDetector_getPathDetections ( dwPathDetection paths,
dwPathDetectorHandle_t  obj 
)

Gets the latest computed results in image coordinates.

This method has to be executed after dwpathDetector_interpretHost() to get the current output of the detector.

Note
The dwPathDetector component pointers are only valid till the next proccessDeviceAsync method
Parameters
[out]pathsA user pointer to be filled with information about detected paths.
[in]objA path detector handle.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_getTemporalSmoothingFactor()

DW_API_PUBLIC dwStatus dwPathDetector_getTemporalSmoothingFactor ( float32_t factor,
dwPathDetectorHandle_t  obj 
)

Gets the temporal smoothing factor from Path detector.

Parameters
[out]factorAverage previous and current path detection points, which is calculated as:
smoothed point = factor*previous point + (1.0-factor)*current point
[in]objA path detector handle
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given output pointer is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_initializeFromPathNet()

DW_API_PUBLIC dwStatus dwPathDetector_initializeFromPathNet ( dwPathDetectorHandle_t obj,
dwPathNetHandle_t  pathnet,
uint32_t  frameWidth,
uint32_t  frameHeight,
cudaStream_t  stream,
dwContextHandle_t  ctx 
)

Initializes a path detector module based on PathNet.

Parameters
[out]objA pointer to the PathDetector handle for the created module.
[in]pathnetSpecifies the handle to the PathNet module.
[in]frameWidthWidth of camera frames to apply path detector later.
[in]frameHeightHeight of camera frames to apply path detector later.
[in]streamCUDA stream on which to perform all operations.
[in]ctxSpecifies the handle to the context to create PathNet.
Returns
DW_INVALID_HANDLE - If the given context handle is invalid.
DW_SUCCESS

◆ dwPathDetector_initializeFromPathNetWithCameraRig()

DW_API_PUBLIC dwStatus dwPathDetector_initializeFromPathNetWithCameraRig ( dwPathDetectorHandle_t obj,
dwPathNetHandle_t  pathnet,
uint32_t  frameWidth,
uint32_t  frameHeight,
dwCameraModelHandle_t  cam,
dwTransformation3f  cam2rig,
cudaStream_t  stream,
dwContextHandle_t  ctx 
)

Initializes a path detector module based on PathNet with camera rig parameters.

Parameters
[out]objA pointer to the PathDetector handle for the created module.
[in]pathnetSpecifies the handle to the PathNet module.
[in]frameWidthWidth of camera frames to apply path detector later.
[in]frameHeightHeight of camera frames to apply path detector later.
[in]camSpecifies the handle to the calibrated camera.
[in]cam2rigSpecifies the transformation from camera to rig.
[in]streamCUDA stream on which to perform all operations.
[in]ctxSpecifies the handle to the context to create PathNet.
Returns
DW_INVALID_HANDLE - If the given context handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_interpretHost()

DW_API_PUBLIC dwStatus dwPathDetector_interpretHost ( dwPathDetectorHandle_t  obj)

Runs the interpretation of the processed results on the CPU.

To get the actual output of the detector, this method must be executed after dwPathDetector_processDeviceAsync().

Parameters
[in]objA path detector handle.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_processDeviceAsync()

DW_API_PUBLIC dwStatus dwPathDetector_processDeviceAsync ( const dwImageCUDA frame,
dwPathDetectorHandle_t  obj 
)

Processes the given frame on the GPU asynchronously.

Parameters
[in]frameCUDA frame to be processed for detection.
[in]objA path detector handle.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_release()

DW_API_PUBLIC dwStatus dwPathDetector_release ( dwPathDetectorHandle_t  obj)

Releases the detector module.

Parameters
[in]objThe object handle to release.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_reset()

DW_API_PUBLIC dwStatus dwPathDetector_reset ( dwPathDetectorHandle_t  obj)

Resets the path detector module.

Parameters
[in]objSpecifies the detector to reset.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setCameraExtrinsics()

DW_API_PUBLIC dwStatus dwPathDetector_setCameraExtrinsics ( const dwTransformation3f cam2Rig,
dwPathDetectorHandle_t  obj 
)

Sets new calibrated camera extrinsic.

Parameters
[in]cam2Rigspecifies camera to rig transformation
[in]objA path detector handle
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_SUCCESS

◆ dwPathDetector_setComputeCenterRailFrom3D()

DW_API_PUBLIC dwStatus dwPathDetector_setComputeCenterRailFrom3D ( bool  computeCenterRailFrom3D,
dwPathDetectorHandle_t  obj 
)

Set the flag to compute 3D center rail from 3D path edges.

Parameters
[in]computeCenterRailFrom3Dflag to compute 3D center rail from 3D path edges.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setCUDAStream()

DW_API_PUBLIC dwStatus dwPathDetector_setCUDAStream ( cudaStream_t  stream,
dwPathDetectorHandle_t  obj 
)

Sets the CUDA stream for CUDA related operations.

Note
The ownership of the stream remains by the callee.
Parameters
[in]streamThe CUDA stream to be used. Default is the one passed during initialization.
[in]objA handle to the path detector module for which to set CUDA stream.
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_SUCCESS

◆ dwPathDetector_setDetectionROI()

DW_API_PUBLIC dwStatus dwPathDetector_setDetectionROI ( const dwRect roi,
dwPathDetectorHandle_t  obj 
)

Set detection Region of Interest (ROI) for the detector.

Parameters
[in]roiROI of frame to be processed by the detector, default to full frame
[in]objA path detector handle
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setDetectionThreshold()

DW_API_PUBLIC dwStatus dwPathDetector_setDetectionThreshold ( float32_t  threshold,
dwPathDetectorHandle_t  obj 
)

Sets the detection confidence threshold for the PathNet based detector.

Parameters
[in]thresholdConfidence threshold above which the DNN result is considered valid path information.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given detection threshold is not between (0,1).
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setMaxLookAheadDistance()

DW_API_PUBLIC dwStatus dwPathDetector_setMaxLookAheadDistance ( float32_t  distance,
dwPathDetectorHandle_t  obj 
)

Set max look ahead distance.

Parameters
[in]distanceMax look ahead distance in meters.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given distance is negative.
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setOppositeTrafficDetectionThreshold()

DW_API_PUBLIC dwStatus dwPathDetector_setOppositeTrafficDetectionThreshold ( float32_t  threshold,
dwPathDetectorHandle_t  obj 
)

Sets the opposite traffic detection confidence threshold for the PathNet based detector.

Parameters
[in]thresholdabove which the DNN result is considered opposite traffic direction.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given detection threshold is not between (0,1).
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS

◆ dwPathDetector_setTemporalSmoothingFactor()

DW_API_PUBLIC dwStatus dwPathDetector_setTemporalSmoothingFactor ( float32_t  factor,
dwPathDetectorHandle_t  obj 
)

Sets the temporal smoothing factor for the Path detector.

Parameters
[in]factorAverage previous and current path detection points, which is calculated as:
smoothed point = factor*previous point + (1.0-factor)*current point
Set to 0 to turn off temporal smoothing.
[in]objA path detector handle (must be of type PathNet).
Returns
DW_INVALID_HANDLE - If the given path detector handle is invalid.
DW_INVALID_ARGUMENT - If the given factor is not in the range (0,1).
DW_BAD_CAST - If cannot cast the given handle to the expected type.
DW_SUCCESS