Finding a relative camera-object pose through the PnP algorithm

The camera removes information regarding how far away the object that is being photographed is. It may be a small but close object, or a big but far away one—the images may be the same—but by knowing the geometrical size of the object, we can compute the distance from it to the camera. In general, our knowledge about an object's geometry is the positions of some set of 3D points in an object's local coordinate system. And usually, we want to know not only the distance between the camera and the object's local coordinate system, but also how the object is oriented. This task can be successfully done with OpenCV. This recipe will show you how to find a 6-DOF (degrees of freedom) ...

Get OpenCV 3 Computer Vision with Python Cookbook 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.