1 # Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
3 @page imageprocessing_geometry_pose_usecase1 Pose estimation
5 @note SW Release Applicability: This tutorial is applicable to modules in both **NVIDIA DriveWorks** and **NVIDIA DRIVE Software** releases.
7 The tutorial shows the general structure of a program that uses the PnP pose estimator to determine the camera pose.
9 #### Initialize the pose estimator
11 We select a conservative number of ransac and non-linear optimizer iterations (10 and 10).
12 `contextHandle` is assumed to be previously initialized `::dwContextHandle_t`.
15 dwPnP_initialize(&pnp, 10, 10, contextHandle);
21 dwVector3f worldPoints[BUFFER_SIZE];
22 dwVector2f imagePoints[BUFFER_SIZE];
25 // The application must obtain the matches and fill the above three variables
29 #### Undistort feature points
31 `cameraModel` is assumed to be previously initialized `::dwCameraModelHandle_t`
34 dwVector2f rays[BUFFER_SIZE];
36 for(size_t i = 0; i < pointCount; ++i)
38 const auto& point = imagePoints[i];
40 dwCameraModel_pixel2Ray(&ray.x, &ray.y, &ray.z, point.x, point.y, cameraModel);
48 dwTransformation3f worldToCamera;
49 dwPnP_solve(&worldToCamera, pointCount, rays, worldPoints, pnp);
52 #### Finally, free previously allocated memory.