This is the main project page for the Simple ARToolKit Library for Processing.
Information
This is the second version of my experiment with the Java version of the ARToolKit implementation. It builds upon the jARToolKit, which seems to be inactive for a while. There is another active Java implementation at NyARToolkit, which also includes an ActionScript port.
Tested environments
The current library runs only in Windows machine. I perform testings mainly in Windows XP SP2 and SP3 computers with the original Sun JVM 1.6.x. The C++ library is created with Visual Studio Express edition 2008 and the Java file is created in Eclipse Ganymede 3.4.1.
Dependencies
The current version removes the dependency on any video capture mechanism in Processing. The interface is a PImage object instance.
The 3D renderer has to be OpenGL for the library to work.
The original ARToolKit parameter files like the camera data, marker patterns have to be placed inside the data folder of individual Processing sketch.
- camera_para.data
- patt.*
The JVM version is 1.6.x.
Download
SimpleARToolKit 2.0, 24 Mar 2009
Installation
Copy the library folder content into the libraries folder of the Processing installation. Alternatively, you can also put the library content into a code folder into any Processing sketch.
Coding
The 1st step is to import the library,
import pARToolKit.SimpleARToolKit;
The 2nd step is to define the object instance,
SimpleARToolKit ar;
The 3rd step is to initialize everything related to the instance,
ar = new SimpleARToolKit(this, capWidth, capHeight);
ar.loadPattern("patt.hiro", 80, 0.0f, 0.0f);
ar.register("showBox");
The 2 variables, capWidth and capHeight are the capture size. It can be different from the Processing window size, width and height. The second statement loads the marker pattern file from the data folder. The rest of the parameters follow the original ARToolKit ones. The third statement registers a local function in the main sketch that will display any 3D graphics. The graphics will be in proper position and orientation handled by the transformation matrix.
The 4th step is to check if any marker is detected in the current capture scene,
ar.findMatch(img,100);
The PImage variable img contains the latest capture image. It does not matter to create the img by using JMyron, Capture object, JMF or GStream, etc. The function findMatch() will return a boolean result indicating if there is a match or not. Try adjusting the number to different value to cater for various lighting conditions. Usually, increasing the number will do.
The 5th step is to show any user defined graphics on top of the marker,
ar.showObject();
The showObject() function will invoke the registered callback function to display the 3D graphics.
The overall operation is synchronized with the draw() function. No other threads have been implemented.
Example code
The following example uses the JMyron video capture mechanism.
import JMyron.*;
import processing.opengl.*;
import pARToolKit.SimpleARToolKit;
JMyron m;
PImage img;
SimpleARToolKit ar;
int capWidth, capHeight;
void setup() {
size(640, 480, OPENGL);
capWidth = 320;
capHeight = 240;
m = new JMyron();
m.start(capWidth, capHeight);
m.findGlobs(0);
img = createImage(capWidth, capHeight, ARGB);
ar = new SimpleARToolKit(this, capWidth, capHeight);
ar.loadPattern("patt.hiro", 80, 0.0f, 0.0f);
ar.register("showBox");
stroke(200,200,0);
}
void draw() {
background(0);
m.update();
m.imageCopy(img.pixels);
img.updatePixels();
hint(DISABLE_DEPTH_TEST);
image(img,0,0,width,height);
hint(ENABLE_DEPTH_TEST);
if (ar.findMatch(img,100)) {
ar.showObject();
}
}
void showBox(SimpleARToolKit _a) {
noFill();
box(50);
fill(255);
}
License
I release the software library as free. Since the library is based on the ARToolKit, please refer to the licensing requirement of its usage here, especially for use with commercial purpose.
Users
Please send me information about the usage of the library. Here are some reported usage of the library.
Some friends indicated the following site has used the previous version of the SimpleARToolKit library in the commercial application. The design company does not reported to me directly.
GooInteractive
