Pages

Tuesday, December 15, 2009

OpenGL and OpenCV world frame

There are 2 Frame

  1. World Coordinate Frame
  2. 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:

  1. Find the Extrinsic Matrix in OpenCV
  2. Transform the world coordinate to Camera Coordinate by the following formula
    Xcam = P*Xworld
  3. 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
  4. 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