The core idea behind FLARToolkit (which is an AS3 port of ARToolkit) as I understand it … is that it can detect if a given pattern is present in a bitmap, if so .. then where is it located and how much has it been transformed in 3D space. Once we have this information .. we can manipulate the bitmap (or a frame of video from a webcam in our case) to add virtual objects that can be moved and transformed same as the pattern. If this is done over each frame of the movie coming from the webcam it creates the illusion of a real object being added to the video and the object moves around as we move the pattern in reality.
Here’s the code with detailed comments on how this is achieved … You can download the complete project here.
Try it out yourself …
- Print out this marker pattern [pdf]
- You’ll need a webcam
- Visit this application
- Allow it to use your webcam
- Move the pattern in front of the webcam
- You should see a virtual cow moving with it.
Here are the various places where I got a lot of this information from ..
- Saqoosha’s getting started article
- Mikko Haapoja’s post on Getting Started with FLARToolkit
- Lee Brimelow’s video tutorial at gotondlearn
- FLARToolkit source and examples
I hope everyone who came to my talk enjoyed it .. I would love to hear any feedback that you may have.
Also a very special thankyou to the all the guys who were behind organizing Devcamp, I had a great time and learned a lot.