Suppose I have a pair of overlapping images of a scene containing (a) planar object(s). Thanks to feature detection and matching I am able to estimate the Homography H between the two images. Is it possible to retrieve the camera displacement using H ?
I used the code provided in OpenCV’s demo on homography and the results I obtain for the displacement are not consistent especially regarding the translations. I used the following formulas to go from the homography H to the rotation and translation matrices (provided in the demo at OpenCV: Basic concepts of the homography explained with code) :
// Normalization to ensure that ||c1|| = 1
double norm = sqrt(H.at(0,0)*H.at(0,0) + H.at(1,0)*H.at(1,0) + H.at(2,0)*H.at(2,0));
H /= norm;
Mat c1 = H.col(0);
Mat c2 = H.col(1);
Mat c3 = c1.cross(c2);
Mat tvec = H.col(2);
Mat R(3, 3, CV_64F);
for (int i = 0; i < 3; i++)
R.at(i,0) = c1.at(i,0);
R.at(i,1) = c2.at(i,0);
R.at(i,2) = c3.at(i,0);
I guess my problem has to do with scaling factor,however, I have no idea how to estimate it.