Camera pose from homography?
Given K, an intrinsic camera matrix, a reference image from a camera 1 which pose is known and an image from a camera 2 which pose is unknown, is there a way to compute the pose of camera 2 using the homography matrix found between the two images from matched key-points if I know their 3D coordinates (these points may not be coplanar at all)? Or, if not, from anyone of the fundamental or essential matrices?
Could it perform better or faster thant SolvePnP?
Camera pose from homography is possible, see for instance here or here. In both methods, you need to know the 3D coordinates of the points in the object frame also (with the homography based method, it assumes
Z=0
).Note also that with the homography based method, the homography relates the transformation between 2D points on the marker plane (
Z=0
) and their projections in the 2D image plane.So, basically, if I have some complex 3D object like a tree or scene like a landscape with no planes at all, it won't work?
No, the method I linked to compute the camera pose from the homography assumes a planar object: the homography transformation is between the plane object and the image plane (the object projected into the image plane).
so what is the common way in case we do not have any information about the 3D points? I obtain ORB features between consecutive frames, match the features with already available methods in opencv. and use
cv::findHomography()
to calculate the homography. Thencv::decomposeHomographyMat()
give results in 4 different solutions. I do not know what is the correct way is to get correct 4x4 transformation matrix in this approach.What are you trying to achieve?
Camera pose estimation like
solvePnP
(rotation and translation to transform from object frame to camera frame) or camera displacement estimation (rotation and translation to transform from the previous camera frame to the current camera frame)?