Background
There is the library for developing maker base AR program.It’s called ARToolKit.
It’s processing version is NyARToolkit.
Implementation
Download library is fromhere.
And copy it to processing’s home directory’s libraries directory.
Then, change the library’s directory name is “nyar4psg”. Program is following.
After save the program, copy nyar4ps/data to the directory.import jp.nyatla.nyar4psg.*; import processing.video.*; // Definition camera device interface Capture cam; MultiMarker ar; // Marker ID int id; void setup() { // Set size size(640,480,P3D); // Create camera device interface cam = new Capture(this, width, height); ar = new MultiMarker(this, width, height, "camera_para.dat", NyAR4PsgConfig.CONFIG_PSG); // Register marker id = ar.addARMarker("patt.hiro", 60); } void draw() { // Check whether camera is available if (cam.available() == false) return; // Get camera image cam.read(); // Draw camera image background(0); ar.drawBackground(cam); // Detect marker ar.detect(cam); if (ar.isExistMarker(id)) { // Draw box ar.beginTransform(id); fill(116,163,241,100); translate(0,0,15); box(30); ar.endTransform(); } }