1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page imageprocessing_geometry_pose_usecase1 Pose estimation
5 The tutorial shows the general structure of a program that uses the PnP pose estimator to determine the camera pose.
7 #### Initialize the pose estimator
9 We select a conservative number of ransac and non-linear optimizer iterations (10 and 10).
10 `contextHandle` is assumed to be previously initialized `::dwContextHandle_t`.
13 dwPnP_initialize(&pnp, 10, 10, contextHandle);
19 dwVector3f worldPoints[BUFFER_SIZE];
20 dwVector2f imagePoints[BUFFER_SIZE];
23 // The application must obtain the matches and fill the above three variables
27 #### Undistort feature points
29 `cameraModel` is assumed to be previously initialized `::dwCameraModelHandle_t`
32 dwVector2f rays[BUFFER_SIZE];
34 for(size_t i = 0; i < pointCount; ++i)
36 const auto& point = imagePoints[i];
38 dwCameraModel_pixel2Ray(&ray.x, &ray.y, &ray.z, point.x, point.y, cameraModel);
46 dwTransformation3f worldToCamera;
47 dwPnP_solve(&worldToCamera, pointCount, rays, worldPoints, pnp);
50 #### Finally, free previously allocated memory.