Understanding cv2.solvePnPRansac

The cv2.solvePnPRansac function implements a solver for the so-called Perspective-n-Point (PnP) problem. Given a set of n unique matches between 3D and 2D points, along with the parameters of the camera and lens that generated this 2D projection of the 3D points, the solver attempts to estimate the 6DOF pose of the 3D object relative to the camera. This problem is somewhat similar to finding the homography for a set of 2D-to-2D keypoint matches, as we did in Chapter 6, Retrieving Images and Searching Using Image Descriptors. However, in the PnP problem, we have enough additional information to estimate a more specific spatial relationship the DOF pose as opposed to the homography, which just tells us a ...

Get Learning OpenCV 4 Computer Vision with Python 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.