home > documentation > coordinate systems

Coordinate Systems

ARToolKit defines different coordinate systems mainly used by the computer vision algorithm and the rendering. You need
to precisely understand relations between them to prevent reverse image or bad position object display.
Rendering Coordinate System

Computer Vision Coordinate System

This sketch designed by Kato summarises the main coordinate systems used in ARToolKit:
You need to notice that `arGetTransMat` give the position of the marker in the camera coordinate
system (not the reverse). If you want the position of the camera in the marker coordinate system you
need to inverse this transformation (`arMatrixInverse`()).

When you use ARToolKit with openGL, remember that openGL is a right-handed coordinate
system, with Z coming to you (i.e. the camera is facing in the direciton of
-Z). So they can easily coincide together.

*OpenGL Programming Guide*. Addison-Wesley. Copyright.

ARToolKit uses a calibrated camera perspective that typically results
in an off-axis projection matrix for OpenGL. Such a projection can not be
created by calling gluPerspective, but requires the extra parameters of glFrustum.
Rather than decomposing ARToolKit's projection into parameters to pass to
glFrustum, we instead directly load the OpenGL projection matrix by setting
`glMatrixMode(GL_PROJECTION_MATRIX);` and calling `glLoadMatrix`

If you use gsub_lite[apidoc] for
the rendering, this off-axis projection is retreived by calling the function
arglCameraFrustum[apidoc].** **

You will find more information on OpenGL coordinate systems in the OpenGL Programming Guide (The Red book)