Browse Subversion Repository
Annotation of /nyar4psg/trunk/examples/arPlusNyIdMarker/arPlusNyIdMarker.pde
Parent Directory
| Revision Log
Revision 1158 -
( hide annotations)
( download)
Tue Jan 6 07:38:11 2015 UTC
(9 years, 3 months ago)
by nyatla
File size: 1301 byte(s)
パッケージ構成をProcessing2.0向けに更新
| 1 |
nyatla |
1158 |
/** |
| 2 |
|
|
NyARToolkit for proce55ing/1.0.0 |
| 3 |
|
|
(c)2008-2011 nyatla |
| 4 |
|
|
airmail(at)ebony.plala.or.jp |
| 5 |
|
|
|
| 6 |
|
|
ARマーカとIdマーカを同時に使う例です。 |
| 7 |
|
|
ARマーカはkanji,hiro、idマーカは0,1番のマーカを使う事ができます。 |
| 8 |
|
|
|
| 9 |
|
|
This sample handles 2 ARToolkit style markers and 2 NyId markers at same time. |
| 10 |
|
|
The ARToolKit marker files are kanji.patt and hiro.patt. NyId marker ids are #0 and #1. |
| 11 |
|
|
*/ |
| 12 |
|
|
import processing.video.*; |
| 13 |
|
|
import jp.nyatla.nyar4psg.*; |
| 14 |
|
|
|
| 15 |
|
|
Capture cam; |
| 16 |
|
|
MultiMarker nya; |
| 17 |
|
|
|
| 18 |
|
|
void setup() { |
| 19 |
|
|
size(640,480,P3D); |
| 20 |
|
|
colorMode(RGB, 100); |
| 21 |
|
|
println(MultiMarker.VERSION); |
| 22 |
|
|
cam=new Capture(this,640,480); |
| 23 |
|
|
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG); |
| 24 |
|
|
nya.addARMarker("patt.hiro",80);//id=0 |
| 25 |
|
|
nya.addARMarker("patt.kanji",80);//id=1 |
| 26 |
|
|
nya.addNyIdMarker(0,80);//id=2 |
| 27 |
|
|
nya.addNyIdMarker(1,80);//id=3 |
| 28 |
|
|
cam.start(); |
| 29 |
|
|
} |
| 30 |
|
|
|
| 31 |
|
|
void draw() |
| 32 |
|
|
{ |
| 33 |
|
|
if (cam.available() !=true) { |
| 34 |
|
|
return; |
| 35 |
|
|
} |
| 36 |
|
|
cam.read(); |
| 37 |
|
|
nya.detect(cam); |
| 38 |
|
|
background(0); |
| 39 |
|
|
nya.drawBackground(cam);//frustumを考慮した背景描画 |
| 40 |
|
|
for(int i=0;i<4;i++){ |
| 41 |
|
|
if((!nya.isExistMarker(i))){ |
| 42 |
|
|
continue; |
| 43 |
|
|
} |
| 44 |
|
|
nya.beginTransform(i); |
| 45 |
|
|
fill(100*(((i+1)/4)%2),100*(((i+1)/2)%2),100*(((i+1))%2)); |
| 46 |
|
|
translate(0,0,20); |
| 47 |
|
|
box(40); |
| 48 |
|
|
nya.endTransform(); |
| 49 |
|
|
} |
| 50 |
|
|
} |
| 51 |
|
|
|
| 52 |
|
|
|
| |