Browse Subversion Repository
Contents of /nyar4psg/trunk/examples/simpleNyId/simpleNyId.pde
Parent Directory
| Revision Log
Revision 1158 -
( show annotations)
( download)
Tue Jan 6 07:38:11 2015 UTC
(9 years, 2 months ago)
by nyatla
File size: 940 byte(s)
パッケージ構成をProcessing2.0向けに更新
| 1 |
/** |
| 2 |
NyARToolkit for proce55ing/1.0.0 |
| 3 |
(c)2008-2011 nyatla |
| 4 |
airmail(at)ebony.plala.or.jp |
| 5 |
|
| 6 |
NyIdマーカを利用する例です。0番のidマーカを用意して下さい。 |
| 7 |
|
| 8 |
This sample is simple NyId sample. |
| 9 |
The marker id is #0. |
| 10 |
*/ |
| 11 |
import processing.video.*; |
| 12 |
import jp.nyatla.nyar4psg.*; |
| 13 |
|
| 14 |
Capture cam; |
| 15 |
MultiMarker nya; |
| 16 |
|
| 17 |
void setup() { |
| 18 |
size(640,480,P3D); |
| 19 |
colorMode(RGB, 100); |
| 20 |
println(MultiMarker.VERSION); |
| 21 |
cam=new Capture(this,640,480); |
| 22 |
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG); |
| 23 |
nya.addNyIdMarker(0,80); |
| 24 |
cam.start(); |
| 25 |
} |
| 26 |
|
| 27 |
void draw() |
| 28 |
{ |
| 29 |
if (cam.available() !=true) { |
| 30 |
return; |
| 31 |
} |
| 32 |
cam.read(); |
| 33 |
nya.detect(cam); |
| 34 |
background(0); |
| 35 |
nya.drawBackground(cam);//frustumを考慮した背景描画 |
| 36 |
if((!nya.isExistMarker(0))){ |
| 37 |
return; |
| 38 |
} |
| 39 |
nya.beginTransform(0); |
| 40 |
fill(0,0,255); |
| 41 |
translate(0,0,20); |
| 42 |
box(40);println(nya.getNyId(0)); |
| 43 |
nya.endTransform(); |
| 44 |
} |
| 45 |
|
| 46 |
|
| |