DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

PnP Interface

Detailed Description

Defines the PnP module.

Macros

#define DW_PNP_MAX_POINT_COUNT   128
 Defines the maximum number of points that can be processed by the PnP solver. More...
 

Typedefs

typedef struct dwPnPObject * dwPnPHandle_t
 A pointer to the handle representing a PnP solver. More...
 

Functions

DW_API_PUBLIC dwStatus dwPnP_initialize (dwPnPHandle_t *obj, size_t ransacIterations, size_t optimizerIterations, dwContextHandle_t ctx)
 Initializes a PnP solver. More...
 
DW_API_PUBLIC dwStatus dwPnP_release (dwPnPHandle_t obj)
 Releases the PnP solver. More...
 
DW_API_PUBLIC dwStatus dwPnP_reset (dwPnPHandle_t obj)
 Resets the PnP solver. More...
 
DW_API_PUBLIC dwStatus dwPnP_solve (dwTransformation3f *worldToCamera, size_t matchCount, const dwVector3f *rays, const dwVector3f *worldPoints, dwPnPHandle_t obj)
 Estimates the worldToCamera pose based on optical ray to 3D world point correspondences. More...
 

Macro Definition Documentation

◆ DW_PNP_MAX_POINT_COUNT

#define DW_PNP_MAX_POINT_COUNT   128

Defines the maximum number of points that can be processed by the PnP solver.

Definition at line 92 of file PnP.h.

Typedef Documentation

◆ dwPnPHandle_t

typedef struct dwPnPObject* dwPnPHandle_t

A pointer to the handle representing a PnP solver.

This object allows you to solve perspective-n-points problems, i.e. estimating camera pose from 2D-3D correspondences.

Definition at line 59 of file PnP.h.

Function Documentation

◆ dwPnP_initialize()

DW_API_PUBLIC dwStatus dwPnP_initialize ( dwPnPHandle_t obj,
size_t  ransacIterations,
size_t  optimizerIterations,
dwContextHandle_t  ctx 
)

Initializes a PnP solver.

Parameters
[out]objA pointer to the PnP handle for the created module.
[in]ransacIterationsThe number of P3P ransac iterations to run when solving a PnP pose.
[in]optimizerIterationsThe number of non-linear optimization iterations to run when solving a PnP pose.
[in]ctxSpecifies the handler to the context to create the rectifier.
Returns
DW_INVALID_ARGUMENT - if the PnP handle is NULL
DW_SUCCESS

◆ dwPnP_release()

DW_API_PUBLIC dwStatus dwPnP_release ( dwPnPHandle_t  obj)

Releases the PnP solver.

Parameters
[in]objThe object handle to release.
Returns
DW_SUCCESS
DW_INVALID_HANDLE - If the given handle is invalid,i.e. null or of wrong type
Note
This method renders the handle unusable.

◆ dwPnP_reset()

DW_API_PUBLIC dwStatus dwPnP_reset ( dwPnPHandle_t  obj)

Resets the PnP solver.

Parameters
[in]objSpecifies the solver to reset.
Returns
DW_SUCCESS
DW_INVALID_HANDLE - If the given handle is invalid,i.e. null or of wrong type

◆ dwPnP_solve()

DW_API_PUBLIC dwStatus dwPnP_solve ( dwTransformation3f worldToCamera,
size_t  matchCount,
const dwVector3f rays,
const dwVector3f worldPoints,
dwPnPHandle_t  obj 
)

Estimates the worldToCamera pose based on optical ray to 3D world point correspondences.

The rays can be obtained by applying the camera model to 2D pixel positions. The 3D world points come from known world structure.

Parameters
[out]worldToCameraThe estimated pose
[in]matchCountThe number of ray to point correspondences.
[in]raysThe optical rays. Their norm is expected to be one.
[in]worldPointsThe 3D world points that correspond to the rays provided.
[in]objA pointer to the PnP handle for the created module.
Returns
DW_SUCCESS
DW_INVALID_HANDLE - If the given handle is invalid,i.e. null or of wrong type
DW_INVALID_ARGUMENT - If any arguments is null, or too few (minimum three are required), or too many points (more than DW_PNP_MAX_POINT_COUNT) are provided