Hello,
Please see the answer to the stackoverflow question linked below.
https://stackoverflow.com/questions/35942095/opencv-strange-rotation-and-translation-matrices-from-decomposehomographymat
It's pretty straight forward with a homography decomposition.
https://hal.inria.fr/inria-00174036v3/document
We already know that there exist 4 solutions, in the general case, for the homography decomposition problem, two of them being the ”opposites” of the other two.
Rtna = {Ra, ta, na} ; Rtna− = {Ra, −ta, −na} (131) Rtnb = {Rb, tb, nb} ; Rtnb− = {Rb, −tb, −nb} (132)
These can be reduced to only two solutions applying the constraint that all the reference points must be visible from the camera (visibility constraint). We will assume along the development that the two solutions verifying this constraint are Rtna and Rtnb and that, among them, Rtna is the ”true” solution. These solutions are related according to (102)- (104). In practice, in order to determine which one is the good solution, we can use an approximation of the normal n∗. Thus, having an approximated parameter vector μ we build a non-linear state observer:
There must be code somewhere for an OpenCV implementation for the refinement of the homographies.
// decompose using identity as internal parameters matrix
std::vector<cv::Mat> Rs, Ts;
cv::decomposeHomographyMat(H,
K,
Rs, Ts,
cv::noArray());
Rs and Ts have multiple solutions. How do i determine which one?
1) Visibility Test - Project points to 3D space using R and t, and check it is in front of the camera. (+ve z value?) 2) How to reduce the final two solutions?
Regards,
Daniel