Spatial Registration
We can use OSG to do the 3D rendering for us, and ARToolKit to do the spatial registration for us. OSGART is a library that allows these two libraries to work together.
OSGART provides a collection of classes that make it easy to make AR applications in OSG. There are three main components to consider:
- Video background
- Projection matrix
- Transformations
The video background is the live video-feed from the camera. This needs to be drawn behind all other 3D geometry to maintain the illusion that the 3D objects are in fact embedded in the real world.
The projection matrix used by ARToolKit needs to be applied within OSG. The projection matrix is generated from the intrinsic parameters of the camera being used. These are collected in a calibration process.
The transformations of markers, computed by ARToolKit, need to be mapped to OSG transformations.
The ARToolKit provides transformation matrices for each marker it recognises in the camera frame.
OSG uses transformation nodes to position 3D geometry within the scene.
OSGART maps ARToolKit transformations onto OSG transformation nodes.