News Download Projects Publications Community Documentation
home > documentation > tutorial 3: multi-marker tracking
Prev: Tutorial 2: Camera and Marker Relationships
Tutorial 3: Multi-Marker Tracking

ARToolKit can give you the position of multiple markers as a function of the camera CS. You can also have a set of markers (e.g glue to a cardboard plane) that define only one position. ARToolKit can do that with a specific set of functions based on the multiMarker module.

Using Multiple Markers

Print the pattMulti.pdf pattern shown in Figure 1.

Figure 1: multiMarker Pattern

Run multiTest from the bin directory.

Figure 2: multiTest: multiMarker tracking (blue cube correspond to detected markers, red cube to not detected markers).

Try to turn the pattern in different directions and observe the color of the individaul cubes. You will notice that red cubes are displayed where a marker is occluded. How is this possible?

We use the multiMarker tracking principle: a set of markers are defined based on their relative positions. When at least one marker is visible we can compute the position of the marker set in the camera CS.

We now look at the code of multiTest to understand how to program this feature. Open multiTest.c from the examples/multi directory.

if( (config = arMultiReadConfigFile(config_name)) == NULL ) {
    printf("config data load error !!\n");

We now have config (a ARMultiMarkerInfoT structure) and config_name (a specific file, here: Data/multi/marker.dat). The MultiMarker Configuration File contains the list of all patterns and their exact positions within the fixed CS (this can be with respect to the corner of one marker, the middle of the plane of the set of markers, or an arbitrary position).

Figure 3: multiMarker configuration file.

The detection step remains the same, but the computing of the transformation is different:

if( (err=arMultiGetTransMat(marker_info, marker_num, config)) < 0 ) {

The arMultiGetTransMat function doesn't give the position of each marker in the camera CS, but the position of the fixed CS in the camera CS, and the relative position of each marker in the fixed CS. You can employ the resulting transformations to directly display object on any part of the set (for a flat sheet, in any part of that sheet).

In the multiTest example, the draw function used the position of the fixed CS (config->trans), and also the position of marker (config->marker[i].trans) to display the cube.

for( i = 0; i < config->marker_num; i++ ) {
    if( config->marker[i].visible >= 0 )
        draw( config->trans, config->marker[i].trans, 0 );
    else draw( config->trans, config->marker[i].trans, 1 );

You can easily combine this multiMarker tracking with distinct marker tracking to realize more complex applications.