Attention: Old PyARTK module is obsolete for a long time. Now the new ARTKBlender module is available. It works on current version of Blender and provides similar functionality as old one.
PyARTK is Python wrapper for ARToolKit. I used it to integrate ARToolKit with Blender Game Engine.
There are actual sources of wrapper. I have downloaded version 0.1 from its home page and modified sources to use module NumPy instead of older module Numeric. Wrapper uses SWIG to generate Python interfaces.
To build PyARTK module it’s necessary to have installed:
To make it easier to use this wrapper, I have built binaries for Windows. They are built for Python 2.5.x using VisualStudio 2003. As long as actual version of Blender (2.49a) is built with Python 2.6, I prepared binaries for it, too.
To install you have to unpack them and store folder PyARTK in path listed in PYTHONPATH environment variable. It’s required to have NumPy module installed.
ARToolKit installation is recommended, because it contains lots of tools and resources.
Examples and demos
GameBlender – ARToolKit demo contains camera tracking in GameBlender’s virtual scene, as it is shown in this video.
Demo zip content
Demo contains main file artkdemo.blend and video file artkdemo.avi with live video footage. In Data folder there are files needed for ARToolKit: camera parameters file, marker pattern file and marker picture (to use this demo with your own video files or webcams). I have picked this marker from PatternMaker set.
Demo requires Texture Plug-in to be available for video replay.
artkdemo.blend file contains virtual scene setup (little man, some spheres and invisible table and ground mesh), camera with parented video backplane and three important scripts for initialization and pattern detection.
Scripts are designed to allow multiple patterns handling. Initialization script init.py is bound to backplane. It initializes PyARTK modules and loads video frames to backplane texture from source defined in backplane property.
Every blender object can define ARToolKit pattern which will control its position and orientation. It must call script initPatt.py to be registered for pattern detection. Properties of object define filename of pattern, its size (in Blender units), position of center in pattern, flag to indicate if object should behave like camera or not, and properties for pattern detection.
Script detect.py load video frame from source, displays it on backplane, detects paterns and matches them to registered objects. Then for every matched object calculates its position and orientation.
There is also different simple scene setup in layer 11, which I used to test pattern detection on one object with webcam. This setup contains initialization for camera not driven by ARTK – positions of objects are calculated relatively to camera position.
One warning: GameBlender and numpy don’t like each other – when game is started for the second time, numpy doens’t work correctly. So it’s necessary to restart Blender after game is stopped.
I hope you’ll enjoy this demo and it’ll inspire you to get into AR world.