|
|
DriveWorks SDK Reference| 0.6.67 Release |
Performs pose estimation and feature triangulation from visual matches.
Data Structures | |
| struct | dwReconstructorConfig |
| Configuration parameters for a reconstructor. More... | |
Typedefs | |
| typedef struct dwReconstructorObject const * | dwConstReconstructorHandle_t |
| Handle representing a const reconstructor object. More... | |
| typedef struct dwReconstructorObject * | dwReconstructorHandle_t |
| Handle representing a reconstructor object. More... | |
Functions | |
| DW_API_PUBLIC dwStatus | dwReconstructor_compactFeatureHistory (const uint32_t cameraIdx, const uint32_t *d_validIndexCount, const uint32_t *d_validIndexes, const uint32_t *d_invalidIndexCount, const uint32_t *d_invalidIndexes, dwReconstructorHandle_t obj) |
| Compacts the internal feature history by keeping only selected features. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_compactWorldPoints (float32_t *d_worldPoints, const uint32_t *d_validIndexCount, const uint32_t *d_validIndexes, const uint32_t *d_invalidIndexCount, const uint32_t *d_invalidIndexes, dwReconstructorHandle_t obj) |
| Compacts the world point array by keeping only selected features. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_enableCamerasForPoseEstimation (const uint8_t enabled[], dwReconstructorHandle_t obj) |
| Marks the cameras to use for pose estimation. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_estimatePose (dwTransformation *d_correctedRig2World, const dwTransformation *d_previousRig2World, const dwTransformation *d_predictedRig2World, const uint32_t listCount, const uint32_t *const d_featureCounts[], const dwFeatureStatus *const d_statuses[], const float32_t *const d_trackedLocations[], const float32_t *const d_worldPoints[], dwReconstructorHandle_t obj) |
| Uses all tracked features from all cameras to estimate the current rig pose. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_getCUDAStream (cudaStream_t *stream, dwReconstructorHandle_t obj) |
| Gets CUDA stream used by the reconstructor. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_initConfig (dwReconstructorConfig *config) |
| Initializes the reconstructor config with default values. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_initialize (dwReconstructorHandle_t *obj, dwContextHandle_t context, cudaStream_t stream, const dwReconstructorConfig config) |
| Creates and initializes a reconstructor. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_predictFeaturePosition (float32_t d_predictedLocations[], uint32_t cameraIdx, const dwTransformation *previousRigToWorld, const dwTransformation *predictedRigToWorld, const uint32_t *d_featureCount, const dwFeatureStatus d_featureStatuses[], const float32_t d_featureLocations[], const float32_t d_worldPoints[], dwReconstructorHandle_t obj) |
| Predicts the positions of features based on the predicted car motion. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_project (float32_t *d_locations[], const dwTransformation *rig2World, const uint32_t *const d_pointCount[], const float32_t *const d_worldPoints[], dwReconstructorHandle_t obj) |
| Projects triangulated features back to the image. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_release (dwReconstructorHandle_t *obj) |
| Releases a reconstructor. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_reset (dwReconstructorHandle_t obj) |
| Resets a reconstructor. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_setCUDAStream (cudaStream_t stream, dwReconstructorHandle_t obj) |
| Sets the CUDA stream for CUDA related operations. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_triangulateFeatures (float32_t *d_worldPoints, dwFeatureStatus *d_statuses, const uint32_t *d_featureCount, const uint32_t cameraIdx, dwReconstructorHandle_t obj) |
| Triangulates the features of a camera from the internal feature and pose history. More... | |
| DW_API_PUBLIC dwStatus | dwReconstructor_updateHistory (int32_t *rig2WorldHistoryIdx, const dwTransformation *rig2World, const uint32_t listCount, const uint32_t *const d_featureCounts[], const float32_t *const d_trackedLocations[], dwReconstructorHandle_t obj) |
| Updates the feature and pose history. More... | |
| struct dwReconstructorConfig |
| Data Fields | ||
|---|---|---|
| uint32_t | maxFeatureCount | Specifies the maximum number of features for each camera. |
| uint32_t | maxPoseHistoryLength | Specifies the maximum size of the history. |
| float32_t | maxReprojectionErrorAngleRad |
Specifies the max angle of the reprojection error (angle between tracked optical ray and triangulated optical ray) to consider the feature an outlier during triangulation. Observations with a reprojection error higher than this after triangulation are discarded. |
| float32_t | minNewObservationAngleRad | Specifies the minimum cosine of the angle between two optical rays to add a new one to the feature history. |
| float32_t | minRigDistance |
Specifies the minimum distance between vehicle poses to add a new one to the list.
|
| uint8_t | minTriangulationEntries | Specifies the minimum number of entries in the feature history needed for triangulation. |
| float32_t | poseEstimationOutlierThresholdRad |
Specifies the max angle of the reprojection error (angle between tracked optical ray and triangulated optical ray) to consider the feature an outlier during pose estimation. Observations with a reprojection error higher than this will have less influence in the pose estimation. |
| dwConstCameraRigHandle_t | rig | Specifies the camera rig to use for reconstruction. |
| typedef struct dwReconstructorObject const* dwConstReconstructorHandle_t |
| typedef struct dwReconstructorObject* dwReconstructorHandle_t |
| DW_API_PUBLIC dwStatus dwReconstructor_compactFeatureHistory | ( | const uint32_t | cameraIdx, |
| const uint32_t * | d_validIndexCount, | ||
| const uint32_t * | d_validIndexes, | ||
| const uint32_t * | d_invalidIndexCount, | ||
| const uint32_t * | d_invalidIndexes, | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Compacts the internal feature history by keeping only selected features.
Note that this method must be called at the same time as dwFeatureList_compact() to keep the feature lists synchronized.
| [in] | cameraIdx | Index of the camera to compact for. |
| [in] | d_validIndexCount | The number of valid indexes in the list. GPU pointer. |
| [in] | d_validIndexes | The indexes of the valid features. GPU pointer. |
| [in] | d_invalidIndexCount | The number of invalid indexes in the list. GPU pointer. |
| [in] | d_invalidIndexes | The indexes of the invalid features. GPU pointer. |
| [in] | obj | The reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_compactWorldPoints | ( | float32_t * | d_worldPoints, |
| const uint32_t * | d_validIndexCount, | ||
| const uint32_t * | d_validIndexes, | ||
| const uint32_t * | d_invalidIndexCount, | ||
| const uint32_t * | d_invalidIndexes, | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Compacts the world point array by keeping only selected features.
Note that this method must be called at the same time as dwFeatureList_compact() to keep the feature lists synchronized.
| [in,out] | d_worldPoints | GPU array of 4-floats. |
| [in] | d_validIndexCount | The number of valid indexes in the list. GPU pointer. |
| [in] | d_validIndexes | The indexes of the valid features. GPU pointer. |
| [in] | d_invalidIndexCount | The number of invalid indexes in the list. GPU pointer. |
| [in] | d_invalidIndexes | The indexes of the invalid features. GPU pointer. |
| [in] | obj | The reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_enableCamerasForPoseEstimation | ( | const uint8_t | enabled[], |
| dwReconstructorHandle_t | obj | ||
| ) |
Marks the cameras to use for pose estimation.
Cameras with their flag set to false are ignored and the value of the feature list and pointers are ignored for that camera during pose estimation.
| [in] | enabled | Array of flags to indicate that a camera is enabled. Camera i is enabled if enabled[i] != 0. Size of the buffer must be the same as the rig's camera count. |
| [in] | obj | The reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_estimatePose | ( | dwTransformation * | d_correctedRig2World, |
| const dwTransformation * | d_previousRig2World, | ||
| const dwTransformation * | d_predictedRig2World, | ||
| const uint32_t | listCount, | ||
| const uint32_t *const | d_featureCounts[], | ||
| const dwFeatureStatus *const | d_statuses[], | ||
| const float32_t *const | d_trackedLocations[], | ||
| const float32_t *const | d_worldPoints[], | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Uses all tracked features from all cameras to estimate the current rig pose.
Processes all cameras simultaneously.
| [out] | d_correctedRig2World | A pointer to the corrected rig2World for the current frame. |
| [in] | d_previousRig2World | A pointer to the position of the rig in the previous frame. |
| [in] | d_predictedRig2World | A pointer to the initial estimate of the rig's pose. The reconstructor refines this initial estimate based on the tracked features. |
| [in] | listCount | The number of feature lists provided in the following parameters. This must match the number of cameras in the rig. |
| [in] | d_statuses | A pointer to the status of the tracked features. Features with an invalid status are ignored. Pointers to GPU memory. |
| [in] | d_featureCounts | A pointer to the number of tracked features. There is one feature count per feature list. Pointers to GPU memory. |
| [in] | d_trackedLocations | A pointer to the 2D position of the tracked features in the images. One list per camera in the rig. List i has 2xlistCount[i] elements. Pointer to GPU memory. |
| [in] | d_worldPoints | A pointer to the 3D position of the tracked features in the images. One list per camera in the rig. List i has 4xlistCount[i] elements. Pointer to GPU memory. |
| [in] | obj | The reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_getCUDAStream | ( | cudaStream_t * | stream, |
| dwReconstructorHandle_t | obj | ||
| ) |
Gets CUDA stream used by the reconstructor.
| [out] | stream | The CUDA stream currently used |
| [in] | obj | A handle to the feature list module. |
| DW_API_PUBLIC dwStatus dwReconstructor_initConfig | ( | dwReconstructorConfig * | config | ) |
Initializes the reconstructor config with default values.
| [out] | config | Config to initialize. |
| DW_API_PUBLIC dwStatus dwReconstructor_initialize | ( | dwReconstructorHandle_t * | obj, |
| dwContextHandle_t | context, | ||
| cudaStream_t | stream, | ||
| const dwReconstructorConfig | config | ||
| ) |
Creates and initializes a reconstructor.
| [out] | obj | A pointer to the reconstructor handle is returned here. |
| [in] | context | Specifies the handle to the context under which it is created. |
| [in] | stream | Specifies the CUDA stream to use for all reconstructor operations. |
| [in] | config | Spcifies the configuration parameters for the reconstructor. |
| DW_API_PUBLIC dwStatus dwReconstructor_predictFeaturePosition | ( | float32_t | d_predictedLocations[], |
| uint32_t | cameraIdx, | ||
| const dwTransformation * | previousRigToWorld, | ||
| const dwTransformation * | predictedRigToWorld, | ||
| const uint32_t * | d_featureCount, | ||
| const dwFeatureStatus | d_featureStatuses[], | ||
| const float32_t | d_featureLocations[], | ||
| const float32_t | d_worldPoints[], | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Predicts the positions of features based on the predicted car motion.
If the feature has been triangulated, it reprojects it using the predicted pose. Else, if the feature is below the horizon, it uses the homography induced by the ground plane to predict the feature movement. If it is above the horizon and it has not been triangulated, the current location is copied as the prediction.
| [out] | d_predictedLocations | GPU buffer of 2-floats. This is where the predicted locations are returned. The buffer must be at least 2*d_featureCount long. |
| [in] | cameraIdx | Index of the camera. |
| [in] | previousRigToWorld | The position of the rig corresponding to the observations in d_featureLocations. |
| [in] | predictedRigToWorld | The predicted position of the rig corresponding to d_predictedLocations. |
| [in] | d_featureCount | GPU pointer to the number of features to predict. |
| [in] | d_featureStatuses | GPU array. Status of each feature. Non-active features are ignored. |
| [in] | d_featureLocations | GPU array of 2-floats. The last observed feature locations. Must have 2*d_featureCount valid entries. |
| [in] | d_worldPoints | GPU array of 4-floats. The triangulated 3D positions of the features. If a triangulation is not available the 4th component should be zero. Must have 4*d_featureCount valid entries. |
| [in] | obj | The reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_project | ( | float32_t * | d_locations[], |
| const dwTransformation * | rig2World, | ||
| const uint32_t *const | d_pointCount[], | ||
| const float32_t *const | d_worldPoints[], | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Projects triangulated features back to the image.
This can be used to predict locations for the feature tracker. Processes all cameras simultaneously.
| [out] | d_locations | A GPU pointer to the projection results. |
| [in] | rig2World | A pointer to the current position of the rig (vehicle). |
| [in] | d_pointCount | A GPU pointer to the number of points in each feature buffer. |
| [in] | d_worldPoints | A GPU pointer to the list of triangulated points. |
| [in] | obj | Specifies the reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_release | ( | dwReconstructorHandle_t * | obj | ) |
Releases a reconstructor.
This method releases all resources associated with a reconstructor.
| [in] | obj | Specifies the object handle to release. |
| DW_API_PUBLIC dwStatus dwReconstructor_reset | ( | dwReconstructorHandle_t | obj | ) |
Resets a reconstructor.
| [in] | obj | Specifies the reconstructor handle to reset. |
| DW_API_PUBLIC dwStatus dwReconstructor_setCUDAStream | ( | cudaStream_t | stream, |
| dwReconstructorHandle_t | obj | ||
| ) |
Sets the CUDA stream for CUDA related operations.
| [in] | stream | The CUDA stream to be used. Default is the one passed during dwReconstructor_initialize. |
| [in] | obj | A handle to the reconstructor module to set CUDA stream for. |
| DW_API_PUBLIC dwStatus dwReconstructor_triangulateFeatures | ( | float32_t * | d_worldPoints, |
| dwFeatureStatus * | d_statuses, | ||
| const uint32_t * | d_featureCount, | ||
| const uint32_t | cameraIdx, | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Triangulates the features of a camera from the internal feature and pose history.
Processes only a single camera.
| [out] | d_worldPoints | A pointer to the list of triangulated points. This list must hold at least 4 x maxFeatureCount items. Pointer must be 16-byte aligned. |
| [out] | d_statuses | A pointer to the list of feature statuses. If the reprojection error is too high, a feature is marked here as invalid. Otherwise, the status is unchanged. |
| [in] | d_featureCount | A pointer to the number of tracked features. Pointer to GPU memory. |
| [in] | cameraIdx | Specifies the index of the camera in the rig that this call should triangulate for. |
| [in] | obj | Specifies the reconstructor object handle. |
| DW_API_PUBLIC dwStatus dwReconstructor_updateHistory | ( | int32_t * | rig2WorldHistoryIdx, |
| const dwTransformation * | rig2World, | ||
| const uint32_t | listCount, | ||
| const uint32_t *const | d_featureCounts[], | ||
| const float32_t *const | d_trackedLocations[], | ||
| dwReconstructorHandle_t | obj | ||
| ) |
Updates the feature and pose history.
Pose history is updated if the vehicle moves or rotates enough. Feature history is updated if the tracked location provides new information for triangulation.
This method receives the features tracked by each camera in the rig. There must be one feature list per camera in the rig. Thus, listCount must be equal to the number of cameras in the rig.
Processes all cameras simultaneously.
| [out] | rig2WorldHistoryIdx | A pointer to the index of the rig's pose in the internal pose history list. -1 if it was not added to the history. You can pass NULL. |
| [in] | rig2World | A pointer to the current position of the rig (vehicle). |
| [in] | listCount | Specifies the number of feature lists provided in the following parameters. This must match the number of cameras in the rig. |
| [in] | d_featureCounts | A pointer to the number of tracked features. There is one feature count per feature list. Pointers to GPU memory. |
| [in] | d_trackedLocations | A pointer to the 2D position of the tracked features in the images. One list per camera in the rig. List i has 2xlistCount[i] elements. Pointer to GPU memory. |
| [in] | obj | Specifies the reconstructor object handle. |