Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculating scale, rotation and translation from Homography matrix

I am trying to calculate scale, rotation and translation between two consecutive frames of a video. So basically I matched keypoints and then used opencv function findHomography() to calculate the homography matrix.
homography = findHomography(feature1 , feature2 , CV_RANSAC); //feature1 and feature2 are matched keypoints

My question is: How can I use this matrix to calculate scale, rotation and translation?.
Can anyone provide me the code or explanation as to how to do it?

like image 425
Lakshya Kejriwal Avatar asked Sep 04 '14 06:09

Lakshya Kejriwal


People also ask

Does homography include translation?

In the field of computer vision, any two images of the same planar surface in space are related by a homography (assuming a pinhole camera model). This has many practical applications, such as image rectification, image registration, or camera motion—rotation and translation—between two images.

How is homography calculated?

Thus, homography can be calculated using relative rotation and translation between two cameras.

What is translation and rotation matrix?

A rotation matrix and a translation matrix can be combined into a single matrix as follows, where the r's in the upper-left 3-by-3 matrix form a rotation and p, q and r form a translation vector. This matrix represents rotations followed by a translation.


1 Answers

if you can use opencv 3.0, this decomposition method is available http://docs.opencv.org/3.0-beta/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#decomposehomographymat

like image 54
Vineet Avatar answered Sep 19 '22 01:09

Vineet