: Documentation : Content Creation Tutorials

Creating Multi-Markers

A multi-marker configuration is simply a set of individual markers that are treated as one single marker. Such a configuration is defined in a text file that lists each marker and its relationship to the local origin of the marker set.

As an example, consider the multi-marker configuration included with the plugin.

multiMarker1.png

It is made up of six 40mm square markers arranged in a 2x3 grid. You can design such a layout in a similar way to making single markers: simply draw the arrangement in a tool like PowerPoint or Adobe Illustrator. It is best if you can set the units in your drawing program to millimetres so that you can maintain the correct dimensions and positions of the markers.

Once you have designed your multi-marker layout, the next step is to print it and train each of the individual markers. Just follow the instructions for single marker training and repeat it for each of the markers in your layout. The example layout has six markers, which have been trained and name patt.a, patt.b, patt.c, patt.d, patt.g and patt.f.

Now you need to create a new text file that describes the multi-marker layout. The contents of the included multi-marker are shown below.

#the number of patterns to be recognized
6

#marker 1
Data/multi/patt.a
40.0
0.0 0.0
1.0000 0.0000 0.0000 0.0000
0.0000 1.0000 0.0000 0.0000
0.0000 0.0000 1.0000 0.0000

#marker 2
Data/multi/patt.b
40.0
0.0 0.0
1.0000 0.0000 0.0000  100.0000
0.0000 1.0000 0.0000    0.0000
0.0000 0.0000 1.0000    0.0000

#marker 3
Data/multi/patt.c
40.0
0.0 0.0
1.0000 0.0000 0.0000  200.0000
0.0000 1.0000 0.0000    0.0000
0.0000 0.0000 1.0000    0.0000

#marker 4
Data/multi/patt.d
40.0
0.0 0.0
1.0000 0.0000 0.0000    0.0000
0.0000 1.0000 0.0000 -100.0000
0.0000 0.0000 1.0000    0.0000

#marker 5
Data/multi/patt.g
40.0
0.0 0.0
1.0000 0.0000 0.0000  100.0000
0.0000 1.0000 0.0000 -100.0000
0.0000 0.0000 1.0000    0.0000

#marker 6
Data/multi/patt.f
40.0
0.0 0.0
1.0000 0.0000 0.0000  200.0000
0.0000 1.0000 0.0000 -100.0000
0.0000 0.0000 1.0000    0.0000

The structure of the file is quite simple. Any line beginning with a # is simply a comment and will be ignored by the loading program. Therefore, the first important line of the file says how many markers make up the multi-marker, in this case it is 6.

Then follows that many sections, one for each marker. Each section gives the directory path to the pattern file for the marker. Note that this path is relative to the osgART application.

The next line states the size of the marker, which in our example is 40mm for each one. You can see that you could potentially have markers of different sizes making up the multi-marker.

The following line is the centre point of the marker. This is almost always left as 0,0, meaning that the tracked location of the marker is at the very centre.

Finally, the last three lines of the section describe a transformation matrix that defines this marker’s relationship to the origin of the multi-marker layout. Each line contains four values, making a 3x4 matrix. The left group of 3x3 values is the rotation part, and the right column of 3 values is the translation part.

In the case of all the markers in this multi-marker arrangement, the rotation part is the identity, that is, there is no rotation applied. However, there are changes in each marker’s translation part.

The origin in this example file is at the centre of the top left marker, as shown below. All the other markers have translation offsets relative to this origin. The markers are spaced 100mm apart on a grid, so finding the offsets is quite easy. Note that in this example, the markers are all on a plane, so they all have a Z value of 0.

multiMarker2.png

There are many possible marker configurations. Cubes are often used to allow tracking of a three-dimensional object from all sides.