Ask Your Question
0

What represents the output of SolvePnP?

asked 2015-07-18 20:37:04 -0600

Banquin gravatar image

Hi there, Im working on object tracking, for this i used SURF for keypoints detection and matching, findHomography(), which gave me the corners of the object im tracking in the video frame, and finally, i am using solvePnP to get the 3d position of the object from the camera. The code i've got is working perfectly, but I dont understand the results.

I mean, the tvector from solvePnp() got the x,y,z coordinates of the object in which frame, to what origin? I dont know, but when im facing the object directly, two of the three coordinates of the tvector show me negative values. I cant understand why.

Maybe someone can help me, or give me a link where this is explained

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-07-19 17:22:31 -0600

Eduardo gravatar image

updated 2015-07-19 17:35:07 -0600

The function solvePnP will return the rotation and translation vectors such as we have:

image description

[X Y Z] are the 3D coordinates in the object frame and [u v] the 2D coordinates in the image frame.

So rvec (see Rodrigues to transform a rotation vector to a rotation matrix and vice versa) and tvec are the rotation and translation vectors that express the camera pose. With these information, you can pass from an object frame coordinate to a camera frame coordinate.

Another thing is that the when we change the coordinate from one frame to another frame, the rotation operation operates first. That means the translation vector operates in the camera frame in our case.

You should draw the different frames to get a better view of the problem.

More information on transformation matrices here (in 2D, in 3D).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-18 20:37:04 -0600

Seen: 6,526 times

Last updated: Jul 19 '15