Recognising multiple markers with the FLAR Toolkit

There have been a few good examples going around recently that make use of the FLAR Toolkit, an augmented reality library for Actionscript 3 that superimposes 3D animations on a marker. The user holds the marker up to the webcam and the model appears scaled and in place on the screen. A great example is at the GE SmartGrid site.

For my first job at Autofuss we decided to try and take this a bit further by using the Toolkit to recognise multiple markers within a single Flash movie. This functionality is already built into the toolkit with the FLARMultiMarkerDetector class. However, this functionality is not well documented and the code is commented in Japanese (which is fair enough really). I got this working and extended the example ARAppBase and PV3DARApp classes to use this alternative detector. The way patterns are passed into this class is a little different than the standard version. If people are interested in seeing the code, post a comment and I'll put it up somewhere.

I used a USB Logitech webcam during this development as the inbuilt webcam on my Gateway laptop doesn't work well with the toolkit (including the previously published examples online). I expect this is due to the lens distortion being more severe than the camera_para.dat file accounts for. The C library provides applications for configuring your webcam but I can't imagine any users at home going through this laborious process. Despite this issue, I'm quite happy with the performance I managed to get out of the application. Using the standard black and white markers that have been used in other projects I was able to differentiate between at least 6 markers with no problem. I did add some 'safety checks' to avoid false positives: the application waits five frames to see if it consistently identifies the same marker before deciding to display something. Given the high frame rate, this delay is not obvious.

The application uses an XML file to describe the patterns to use. The XML file is passed in using FlashVars so the patterns can easily be changed. TaroTaro's very useful marker generating software allows you to specify a resolution to encode the pattern as; this value is also passed via XML. I found that 32 bit works well but is a little slower than 16 bit. 64 bit patterns were actually recognised less well, possibly because a lot of the pixels are similar between patterns. An example XML file is here. So far the model specification lines are not implemented (the models are fixed in the code).

The first project we wanted to try was to see if we could integrate the markers into the Autofuss business cards. I expected size to be the issue but I was pleased to find that by playing with the border width I could easily distinguish markers down to 1 square cm (it failed at 0.5 square cm). However, the position of the pattern within the marker is critical and in the end we would either have had to settle for a design we weren't happy with or rewrite large chunks in the core of the toolkit. Overall, it was a good learning experience and a lot of good ideas have come out of this that I hope we get a chance to develop soon.

Standard markers example

Autofuss markers example