There are 2 Frame
- World Coordinate Frame
- Camera Frame
The OpenCV coordinate is w.r.t the World Coordinate Frame. In order to display correctly on the OpenGL. The coordinate has to be transformed to be w.r.t Camera Frame.
The step is:
- Find the Extrinsic Matrix in OpenCV
- Transform the world coordinate to Camera Coordinate by the following formula
Xcam = P*Xworld - Translate the OpenGL using glTranslate by Xcam , note that y and z axis is multiply by –1 due to the difference in OpenGL and OpenCV frame
- Rotate the Camera by the Camera Orientation using the Rotation Matrix.
The next post will be on more detail on this mathematical derivation
No comments:
Post a Comment