camera rotation and translation based on two images
Hello,
I'm just starting my little project in OpenCV and I need your help :) I would like to calculate rotation and translation values of the camera basing on two views of the same planar, square object.
I have already found functions such as: getPerspectiveTransform, decomposeEssentialMat, decomposeHomographyMat. Plenty of tools, but I'm not sure which of them to use in my case.
I have a square object of known real-world dimensions [meters]. After simple image processing I can extract pixel values of the vertices and the center of the square.
Now I would like to calculate the relative rotation and translation of the camera which led to obtain the second of two images:
"Reference view" and "View #n"
(please see below).
Any suggestions will be appreciated :)
- Reference view:
(center of the object is on the optical axis of camera, the camera-object distance is known) - View #1:
- View #2:
- View #3: