Augmented reality Simplelite

A simple example of NyAR4psg (processing.org augmented reality library)

CODE + folder data (patt.hiro, patt.kanji, camera_para.dat)+ folder code (NyARpsg.jar, NyARToolkit.jar)

/**
NyARToolkit for proce55ing/1.0.0
(c)2008-2011 nyatla
airmail(at)ebony.plala.or.jp

最も短いARToolKitのコードです。
Hiroマーカを用意してください。

This sample program is most small sample as simpleLite.
The marker is “patt.hiro”.
*/
import codeanticode.gsvideo.*;
import jp.nyatla.nyar4psg.*;

GSCapture cam;
MultiMarker nya;

void setup() {
size(640,480,P3D);
colorMode(RGB, 100);
println(MultiMarker.VERSION);
cam=new GSCapture(this,640,480);
cam.start();
nya=new MultiMarker(this,width,height,”camera_para.dat”,NyAR4PsgConfig.CONFIG_PSG);
nya.addARMarker(“patt.hiro”,80);
}

void draw()
{
if (cam.available() !=true) {
return;
}
cam.read();
nya.detect(cam);
background(0);
nya.drawBackground(cam);//frustumを考慮した背景描画
if((!nya.isExistMarker(0))){
return;
}
nya.beginTransform(0);
fill(0,0,255);
translate(0,0,20);
box(40);
nya.endTransform();
}

Leave a comment

Your email address will not be published. Required fields are marked *