Browse Subversion Repository
Contents of /nyar4psg/trunk/examples/imagePickup/imagePickup.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: 1177 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 |
ARマーカと同じ平面からマーカパターンを得る事ができます。 |
| 7 |
Hiroマーカを使います。 |
| 8 |
|
| 9 |
This program gets the image from around the marker. |
| 10 |
The marker file is "patt.hiro" |
| 11 |
*/ |
| 12 |
import processing.video.*; |
| 13 |
import jp.nyatla.nyar4psg.*; |
| 14 |
|
| 15 |
Capture cam; |
| 16 |
MultiMarker nya; |
| 17 |
|
| 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("patt.hiro",80);//id=0 |
| 26 |
cam.start(); |
| 27 |
|
| 28 |
} |
| 29 |
|
| 30 |
int c=0; |
| 31 |
void draw() |
| 32 |
{ |
| 33 |
c++; |
| 34 |
if (cam.available() !=true) { |
| 35 |
return; |
| 36 |
} |
| 37 |
cam.read(); |
| 38 |
nya.detect(cam); |
| 39 |
background(0); |
| 40 |
nya.drawBackground(cam);//frustumを考慮した背景描画 |
| 41 |
if((!nya.isExistMarker(0))){ |
| 42 |
return; |
| 43 |
} |
| 44 |
PImage pm=nya.pickupRectMarkerImage(0,-40,-40,80,80,100,100); |
| 45 |
//以下のコードと意味は同じです。 The meaning of this code is the same as the next lines. |
| 46 |
//PImage pm=nya.pickupMarkerImage(0,40,40,-40,40,-40,-40,40,-40,100,100); |
| 47 |
image(pm,0,0); |
| 48 |
} |
| 49 |
|
| 50 |
|
| |