1

I'm now trying to analyze the perspective transform/homography matrix between two images capturing the same object (e.g., a rectangle) but at different perspectives/shooting angles. The perspective transform can be derived by using the function getPerspectiveTransform in OpenCV 2.3.1. I want to find the corresponding rotation and translation matrices.

The output of getPerspectiveTransform is a 3x3 matrix which I can directly use it to warp the source image into the target image. But my question is that how I can find the rotation and translation matrices based on the obtained 3x3 matrix?

I was looking into the funciton decomposeProjectionMatrix for the corresponding rotation and translation matrices. But the input is required to be a 3x4 projection matrix. How can I relate the perspective transformation (i.e., a 3x3 matrix) to the 3x4 projection matrix? Am I on the right track?

Thank you very much.

mintaka
  • 982
  • 1
  • 9
  • 25
  • Check this post: http://stackoverflow.com/a/10750648/744859 – Jav_Rock Aug 23 '12 at 12:21
  • @Jav_Rock: Thanks a lot for your reply. I read the above link, and the problem is to find **homography from pose**. But how can I do it reversely (i.e., **pose from homogrpahy**)? I'm still unclear about how to find out the three more parameters in the pose matrix with size 3x4. It would be greatly approciated if you may provide some more insights. Many thanks – mintaka Aug 27 '12 at 05:06
  • Well I have this post where I share some code about pose from homography: http://stackoverflow.com/a/10781165/744859 Maybe you don't understand it, but the idea is that pose matrix has a redundant column which is the cross product of the first two columns. I will look for a survey where all of this is explain better that I can do. – Jav_Rock Aug 27 '12 at 10:23
  • This is the survey. The relation between homography and pose for "estimation froma 3D plane" is explained in section 2.3.4: http://cvlab.epfl.ch/~lepetit/papers/lepetit_ftcgv05.pdf – Jav_Rock Aug 27 '12 at 10:28
  • Thank you very much, @Jav_Rock! I'll study that. – mintaka Aug 28 '12 at 05:15

1 Answers1

0

The information contained in the homography matrix (returned from getPerspectiveTransform) is not enough to extract rotation/translation. The missing column is key to correctly find the angles.

The good news is that in some scenarios, you can use the solvePnP() function to extract the desired parameters from two sets of points.

Also, this question is about the same thing you are asking for. It should help

Analyze camera movement with OpenCV

Community
  • 1
  • 1
Sam
  • 19,708
  • 4
  • 59
  • 82
  • Thanks for the reply, vasile. I don't understand the 3D pose estimation answer in the link you mentioned. According to [POSIT](http://opencv.willowgarage.com/wiki/Posit), at least non-coplanar points should be given. However, I don't see this is the same case as in mine. – mintaka Aug 16 '12 at 08:44
  • Suppose the source image was taken by a camera at the origin (0, 0, 0) and I know exactly the 3D location of the source image (as well as the rectangle on it). Is there any chance for me to calculate the 3D location of the rectangle in the target image, given the homography matrix? Thanks. – mintaka Aug 16 '12 at 08:48
  • Nope, the POSIT algorithm is for that. – Sam Aug 16 '12 at 08:57
  • Sorry. I still don't quite understand how POSIT can help in my case. May you give some hints? For 3D pose estimation (as in the [paper](http://www.cfar.umd.edu/~daniel/daniel_papersfordownload/Pose25Lines.pdf)), there is a fixed camera, and one is gonna use several non-coplanar points to estimate the pose. Is it? Thanks a lot for your time. – mintaka Aug 16 '12 at 09:35