General
SLARToolkit uses simple black square markers to calculate the camera position and orientation in real time.
Usage
SLARToolkit ships with three markers: the
SLAR,
L and
Hiro marker. The PDFs and the pat files that are used by the Toolkit are included in the CommonData folder.
A marker PDF should be printed non-scaled at the original size (80 x 80 mm) and centered for a small white border. As an alternative it's also possible to open a marker file on a mobile device and to use the device's screen as marker. But for the best results the marker should be printed and glued on a piece of cardboard to avoid warping. It is also important that the camera is set up properly and the scene is illuminated well without hard shadows. A darker lightning is often better than too bright or back light.
A good print and soft lighting are the keys.
Custom markers
It is also possible to use custom markers with SLARToolkit. The easiest way is to use two online tools for the marker generation:
- Use the The ARToolkit Marker Maker to create a PDF with an ARToolkit 2.X marker from an image. The default size of 80 mm is appropriate.
- Convert the created PDF to a JPG, PNG or GIF. You can use the nice online converter tool from Neevia.
- The ARToolKit Marker Generator generates the pat file that SLARToolkit uses. The ARToolkit Marker Maker generates markers where 50% of the size is the actual pattern. 16 x 16 segments should be sufficient for most scenarios. The FLARToolkit documentation has an excellent tutorial about the ARToolKit Marker Generator.
- The generated pat file is then used to initialize a SLARToolkit marker. The physical marker size / width (80 mm) and the number of segments (16 x 16) are passed as parameters:
var markerStream = App.GetResourceStream(new Uri("SLARToolKitSample;component/data/Marker_SLAR_16x16segments_80width.pat", UriKind.Relative)).Stream;
var marker = Marker.Load(markerStream, 16, 16, 80.0);
// or even simpler when the Marker is built in the assembly as Resource:
var marker = Marker.LoadFromResource("data/Marker_SLAR_16x16segments_80width.pat", 16, 16, 80.0);