Browse Subversion Repository
Contents of /nyar4psg/trunk/examples/pngMarker/pngMarker.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: 1102 byte(s)
パッケージ構成をProcessing2.0向けに更新
| 1 |
/** |
| 2 |
NyARToolkit for proce55ing/1.2.0 |
| 3 |
(c)2008-2012 nyatla |
| 4 |
airmail(at)ebony.plala.or.jp |
| 5 |
|
| 6 |
マーカファイルの変わりにPNGを使います。 |
| 7 |
PNGは任意解像度の正方形である必要があります。 |
| 8 |
エッジ部分のパターンは含めてください。 |
| 9 |
|
| 10 |
This sample program uses a PNG image instead of the patt file. |
| 11 |
The PNG image must be square form that includes edge. |
| 12 |
*/ |
| 13 |
import processing.video.*; |
| 14 |
import jp.nyatla.nyar4psg.*; |
| 15 |
|
| 16 |
Capture cam; |
| 17 |
MultiMarker nya; |
| 18 |
|
| 19 |
void setup() { |
| 20 |
size(640,480,P3D); |
| 21 |
colorMode(RGB, 100); |
| 22 |
println(MultiMarker.VERSION); |
| 23 |
cam=new Capture(this,640,480); |
| 24 |
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG); |
| 25 |
nya.addARMarker(loadImage("hiro.png"),16,25,80); |
| 26 |
cam.start(); |
| 27 |
} |
| 28 |
|
| 29 |
void draw() |
| 30 |
{ |
| 31 |
if (cam.available() !=true) { |
| 32 |
return; |
| 33 |
} |
| 34 |
cam.read(); |
| 35 |
nya.detect(cam); |
| 36 |
background(0); |
| 37 |
nya.drawBackground(cam);//frustumを考慮した背景描画 |
| 38 |
if((!nya.isExistMarker(0))){ |
| 39 |
return; |
| 40 |
} |
| 41 |
nya.beginTransform(0); |
| 42 |
fill(0,0,255); |
| 43 |
translate(0,0,20); |
| 44 |
box(40); |
| 45 |
nya.endTransform(); |
| 46 |
} |
| 47 |
|
| 48 |
|
| |