Ask Your Question

# Using solvePnP to work out the pose of my camera in terms of my model's coordinates

Right now, I'm working on adding more sophisticated graphics to the my markerless augmented reality app built using OpenCV. I'm using a lightweight android Graphics engine called JPCT to load and render a 3D model of the OpenCV logo I created. I use OpenCV to detect the four corners of a book.

The graphics engine abstracts the problem as a 3D world with objects placed in it and a camera that can also be placed in the world. The issue I have at the moment is figuring out where the 'camera' should be placed relative to the origin. The origin of the world coordinates (0,0,0) is the centre of the book. The model's coordinates are the same as the world coordinates.

I know that the position of where the camera is can be solved using solvePnP.

Indeed, solvePnP takes the 2D camera coordinates of the book's corners and the 3D world coordinates of the book's corners (which are predefined) and returns an output rotation matrix an output translation vector NOW... this is where I become unsure

I believe that the rotation matrix and translation vector can be used to figure out the position and orientation of where the camera is in the world's coordinate system. Is this correct?

If the camera's starting position is at the origin facing down the zaxis THEN we apply the translation vector to the camera's position to move it to its correct position. We then apply the rotation matrix to the camera's orientation to change its direction of sight.

Have I got this right? Let me know if I should provide more info.

edit retag close merge delete

## Comments

solvePnP returns book's translation and rotation in camera coordinate system. You can use it for model rendering. Look here to know how

( 2013-12-18 09:07:40 -0500 )edit

## 1 answer

Sort by ยป oldest newest most voted

SolvePnP returns rotation and translation to transform object from initial 3d coordinates to camera coordinate system. In this system camera is located in (0,0,0). And it oriented along Z axis. So if you know object position in your global system you can find new camera coordinates in this system too. Also you can imagine that inverted found transformation describes motion of camera. So if you know camera position in initial time moment you can apply inverted transformation to got new camera position.

more

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2013-12-13 06:02:01 -0500

Seen: 4,528 times

Last updated: Dec 27 '13