Created
February 10, 2012 12:40
-
-
Save tatsuro-ueda/1789407 to your computer and use it in GitHub Desktop.
2D-3D-Error.pde
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import processing.video.*; | |
import jp.nyatla.nyar4psg.*; | |
MultiMarker nya; | |
import SimpleOpenNI.*; | |
SimpleOpenNI context; | |
void setup() | |
{ | |
context = new SimpleOpenNI(this); | |
// 深度カメラを有効にする | |
if(context.enableDepth() == false) | |
{ | |
println("Can't open the depthMap, maybe the camera is not connected!"); | |
exit(); | |
return; | |
} | |
// 人物検出を有効にする | |
context.enableScene(); | |
// RGBカメラを有効にする | |
if(context.enableRGB() == false) | |
{ | |
println("Can't open the rgbMap, maybe the camera is not connected or there is no rgbSensor!"); | |
exit(); | |
return; | |
} | |
// キャンバスの大きさ | |
size(context.depthWidth() , context.depthHeight()); | |
// ARマーカーのセットアップ | |
println(MultiMarker.VERSION); | |
nya=new MultiMarker(this,width,height,"camera_para.dat",NyAR4PsgConfig.CONFIG_PSG); | |
nya.addARMarker("patt.hiro",80); | |
} | |
void draw() | |
{ | |
// カメラ情報を更新する | |
context.update(); | |
PImage img = context.rgbImage(); // RGBカメラの映像 | |
nya.detect(img); | |
nya.drawBackground(img);//frustumを考慮した背景描画 ←ここでエラー★★★ | |
if((!nya.isExistMarker(0))){ | |
return; | |
} | |
nya.beginTransform(0); | |
fill(0,0,255); | |
translate(0,0,20); | |
box(40); | |
nya.endTransform(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment