DriveWorks SDK Reference

| 0.6.67 Release

LaneDetector

Detailed Description

Defines lane detector module based on LaneNet, i.e., DNN based lane detector.

Data Structures

struct  dwLaneDetection
 The output format of detected lanes. More...
 
struct  dwLaneMarking
 A defintion of one lane. More...
 

Macros

#define DW_LANEMARK_MAX_COUNT   16
 
#define DW_LANEMARK_POINT_MAX_COUNT   128
 

Typedefs

typedef struct dwLaneDetectorObject * dwLaneDetectorHandle_t
 Handle to a DataConditioner. More...
 

Enumerations

enum  dwLaneMarkType { DW_LANEMARK_TYPE_UNDEFINED = 0 }
 Type of a lane mark. More...
 
enum  dwLanePositionType {
  DW_LANEMARK_POSITION_ADJACENT_LEFT = -2,
  DW_LANEMARK_POSITION_EGO_LEFT = -1,
  DW_LANEMARK_POSITION_EGO_RIGHT = 1,
  DW_LANEMARK_POSITION_ADJACENT_RIGHT = 2,
  DW_LANEMARK_POSITION_UNDEFINED = 999
}
 Defintion of the position of a lane marking in respect to the ego lane. More...
 

Functions

DW_API_PUBLIC dwStatus dwLaneDetector_getCUDAStream (cudaStream_t *stream, dwLaneDetectorHandle_t obj)
 Gets CUDA stream used by the lane detection. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_getDetectionROI (dwRect *roi, dwLaneDetectorHandle_t obj)
 Get detection Region of Interest (ROI) for the detector. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_getLaneDetections (dwLaneDetection *lanes, dwLaneDetectorHandle_t obj)
 Gets the latest computed results in image coordinates. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_initializeLaneNet (dwLaneDetectorHandle_t *obj, uint32_t frameWidth, uint32_t frameHeight, dwContextHandle_t ctx)
 Initializes a lane detector module based on LaneNet. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_interpretHost (dwLaneDetectorHandle_t obj)
 Runs the interpretation of the processed results on the CPU. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_processDeviceAsync (const dwImageCUDA *frame, dwLaneDetectorHandle_t obj)
 Processes the given frame on the GPU asynchronously. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_release (dwLaneDetectorHandle_t *obj)
 Releases the detector module. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_reset (dwLaneDetectorHandle_t obj)
 Resets the lane detector module. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_setCameraExtrinsics (dwTransformation cam2rig, dwLaneDetectorHandle_t obj)
 Set the transformation from camera to rig. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_setCameraHandle (dwCalibratedCameraHandle_t cam, dwLaneDetectorHandle_t obj)
 Set the handle to the calibrated front looking camera. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_setCUDAStream (cudaStream_t stream, dwLaneDetectorHandle_t obj)
 Sets the CUDA stream for CUDA related operations. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_setDetectionROI (const dwRect *roi, dwLaneDetectorHandle_t obj)
 Set detection Region of Interest (ROI) for the detector. More...
 
DW_API_PUBLIC dwStatus dwLaneDetector_setMaxLaneDistance (float32_t maxDistance, dwLaneDetectorHandle_t obj)
 Set the maximum distance in meters at which lane markings can be detected. More...
 
DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_getDNNMetaData (dwDNNMetaData *metaData, dwLaneDetectorHandle_t obj)
 Returns the DNN metadata. More...
 
DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_getTemporalSmoothFactor (float32_t *factor, dwLaneDetectorHandle_t obj)
 Gets the temporal smoothing factor for the LaneNet based detector. More...
 
DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setDetectionThreshold (float32_t threshold, dwLaneDetectorHandle_t obj)
 Sets the detection confidence threshold for the LaneNet based detector. More...
 
DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setHorizontalFOV (float32_t hfov, dwLaneDetectorHandle_t obj)
 Sets the input camera horizontal Field Of View (FOV) in degree for the LaneNet-based detector. More...
 
DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setTemporalSmoothFactor (float32_t factor, dwLaneDetectorHandle_t obj)
 Sets the temporal smoothing factor for the LaneNet-based detector. More...
 

Data Structure Documentation

◆ dwLaneDetection

struct dwLaneDetection
Data Fields
dwLaneMarking laneMarkings[DW_LANEMARK_MAX_COUNT] Detected lane markings.
uint32_t numLaneMarkings Number of detected lane markings.

◆ dwLaneMarking

struct dwLaneMarking
Data Fields
dwVector2f imagePoints[DW_LANEMARK_POINT_MAX_COUNT] Lane marking point location in image domain (pixel).
dwLaneMarkType lineType Category of the line type of lane marking.
uint32_t numPoints Number of points in the array.
dwLanePositionType positionType Category of the position of lane marking.

Macro Definition Documentation

◆ DW_LANEMARK_MAX_COUNT

#define DW_LANEMARK_MAX_COUNT   16

Definition at line 58 of file LaneDetector.h.

◆ DW_LANEMARK_POINT_MAX_COUNT

#define DW_LANEMARK_POINT_MAX_COUNT   128

Definition at line 59 of file LaneDetector.h.

Typedef Documentation

◆ dwLaneDetectorHandle_t

typedef struct dwLaneDetectorObject* dwLaneDetectorHandle_t

Handle to a DataConditioner.

Definition at line 112 of file LaneDetector.h.

Enumeration Type Documentation

◆ dwLaneMarkType

Type of a lane mark.

Enumerator
DW_LANEMARK_TYPE_UNDEFINED 

all detected lane markings are treated the same type

Definition at line 65 of file LaneDetector.h.

◆ dwLanePositionType

Defintion of the position of a lane marking in respect to the ego lane.

Enumerator
DW_LANEMARK_POSITION_ADJACENT_LEFT 

lane marking on the left side next to ego lane

DW_LANEMARK_POSITION_EGO_LEFT 

left lane marking of the ego lane

DW_LANEMARK_POSITION_EGO_RIGHT 

right lane marking of the ego lane

DW_LANEMARK_POSITION_ADJACENT_RIGHT 

lane marking on the right side next to ego lane

DW_LANEMARK_POSITION_UNDEFINED 

lane marking has been identifed but has not been categorized

Definition at line 71 of file LaneDetector.h.

Function Documentation

◆ dwLaneDetector_getCUDAStream()

DW_API_PUBLIC dwStatus dwLaneDetector_getCUDAStream ( cudaStream_t *  stream,
dwLaneDetectorHandle_t  obj 
)

Gets CUDA stream used by the lane detection.

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

◆ dwLaneDetector_getDetectionROI()

DW_API_PUBLIC dwStatus dwLaneDetector_getDetectionROI ( dwRect roi,
dwLaneDetectorHandle_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 lane detector handle
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

◆ dwLaneDetector_getLaneDetections()

DW_API_PUBLIC dwStatus dwLaneDetector_getLaneDetections ( dwLaneDetection lanes,
dwLaneDetectorHandle_t  obj 
)

Gets the latest computed results in image coordinates.

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

Parameters
[out]lanesA user pointer to be filled with information about detected lanes.
[in]objA lane detector handle.
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
Note
Lanes are ordered from bottom to top of the image.

◆ dwLaneDetector_initializeLaneNet()

DW_API_PUBLIC dwStatus dwLaneDetector_initializeLaneNet ( dwLaneDetectorHandle_t obj,
uint32_t  frameWidth,
uint32_t  frameHeight,
dwContextHandle_t  ctx 
)

Initializes a lane detector module based on LaneNet.

Parameters
[out]objA pointer to the LaneNet handle for the created module.
[in]frameWidthWidth of camera frames to apply lane detector later.
[in]frameHeightHeight of camera frames to apply lane detector later.
[in]ctxSpecifies the handler to the context to create LaneNet.
Returns
DW_INVALID_ARGUMENT - If provided context handle is invalid.
DW_SUCCESS

◆ dwLaneDetector_interpretHost()

DW_API_PUBLIC dwStatus dwLaneDetector_interpretHost ( dwLaneDetectorHandle_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 dwLaneDetector_processDeviceAsync().

Parameters
[in]objA lane detector handle.
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

◆ dwLaneDetector_processDeviceAsync()

DW_API_PUBLIC dwStatus dwLaneDetector_processDeviceAsync ( const dwImageCUDA frame,
dwLaneDetectorHandle_t  obj 
)

Processes the given frame on the GPU asynchronously.

Parameters
[in]frameCUDA frame to be processed for detection.
[in]objA lane detector handle.
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

◆ dwLaneDetector_release()

DW_API_PUBLIC dwStatus dwLaneDetector_release ( dwLaneDetectorHandle_t obj)

Releases the detector module.

Parameters
[in]objA pointer to the object handle to release.
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
Note
This method renders the handle unusable.

◆ dwLaneDetector_reset()

DW_API_PUBLIC dwStatus dwLaneDetector_reset ( dwLaneDetectorHandle_t  obj)

Resets the lane detector module.

Parameters
[in]objSpecifies the detector to reset.
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

◆ dwLaneDetector_setCameraExtrinsics()

DW_API_PUBLIC dwStatus dwLaneDetector_setCameraExtrinsics ( dwTransformation  cam2rig,
dwLaneDetectorHandle_t  obj 
)

Set the transformation from camera to rig.

Only set after dwLaneDetector_setCameraHandle

Parameters
[in]cam2rigSpecifies the transformation from camera to rig.
[in]objA lane detector handle.
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

◆ dwLaneDetector_setCameraHandle()

DW_API_PUBLIC dwStatus dwLaneDetector_setCameraHandle ( dwCalibratedCameraHandle_t  cam,
dwLaneDetectorHandle_t  obj 
)

Set the handle to the calibrated front looking camera.

Parameters
[in]camSpecifies the handle to the calibrated front looking camera.
[in]objA lane detector handle.
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

◆ dwLaneDetector_setCUDAStream()

DW_API_PUBLIC dwStatus dwLaneDetector_setCUDAStream ( cudaStream_t  stream,
dwLaneDetectorHandle_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 lane detector module for which to set CUDA stream.
Returns
DW_INVALID_HANDLE - If the given context handle is invalid.
DW_SUCCESS

◆ dwLaneDetector_setDetectionROI()

DW_API_PUBLIC dwStatus dwLaneDetector_setDetectionROI ( const dwRect roi,
dwLaneDetectorHandle_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 lane detector handle
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

◆ dwLaneDetector_setMaxLaneDistance()

DW_API_PUBLIC dwStatus dwLaneDetector_setMaxLaneDistance ( float32_t  maxDistance,
dwLaneDetectorHandle_t  obj 
)

Set the maximum distance in meters at which lane markings can be detected.

Parameters
[in]maxDistanceMaximum distance in meters at which lane markings can be detected.
[in]objA lane detector handle.
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

◆ dwLaneDetectorLaneNet_getDNNMetaData()

DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_getDNNMetaData ( dwDNNMetaData metaData,
dwLaneDetectorHandle_t  obj 
)

Returns the DNN metadata.

Parameters
[out]metaDataPointer to metaData struct.
[in]objSpecifies the LaneNet handle.
Returns
DW_SUCCESS, DW_INVALID_HANDLE, DW_BAD_CAST, DW_INVALID_ARGUMENT

◆ dwLaneDetectorLaneNet_getTemporalSmoothFactor()

DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_getTemporalSmoothFactor ( float32_t factor,
dwLaneDetectorHandle_t  obj 
)

Gets the temporal smoothing factor for the LaneNet based detector.

Parameters
[out]factorAverage previous and current lane sample points, which is calculated as:
smoothed point = factor*previous point + (1.0-factor)*current point
[in]objA lane detector handle (must be of type LaneNet)
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

◆ dwLaneDetectorLaneNet_setDetectionThreshold()

DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setDetectionThreshold ( float32_t  threshold,
dwLaneDetectorHandle_t  obj 
)

Sets the detection confidence threshold for the LaneNet based detector.

Parameters
[in]thresholdConfidence threshold above which the DNN result is considered valid lane information.
[in]objA lane detector handle (must be of type LaneNet).
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

◆ dwLaneDetectorLaneNet_setHorizontalFOV()

DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setHorizontalFOV ( float32_t  hfov,
dwLaneDetectorHandle_t  obj 
)

Sets the input camera horizontal Field Of View (FOV) in degree for the LaneNet-based detector.

Parameters
[in]hfovInput camera horizontal FOV in degrees. Default: 60.0 degrees.
[in]objA lane detector handle (must be of type LaneNet)
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

◆ dwLaneDetectorLaneNet_setTemporalSmoothFactor()

DW_API_PUBLIC dwStatus dwLaneDetectorLaneNet_setTemporalSmoothFactor ( float32_t  factor,
dwLaneDetectorHandle_t  obj 
)

Sets the temporal smoothing factor for the LaneNet-based detector.

Parameters
[in]factorAverage previous and current lane sample 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 lane detector handle (must be of type LaneNet)
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