作者 主题: processing 多台kinect问题!!  (阅读 3953 次)

pengbookfifa

  • Newbie
  • *
  • 帖子: 14
processing 多台kinect问题!!
« 于: 四月 21, 2013, 01:13:40 下午 »
请问processing 怎么连接两台kinect

这是google上找的代码
import SimpleOpenNI.*;

SimpleOpenNI  cam1;
SimpleOpenNI  cam2;

void setup()
{
  size(640 * 2 + 10,480 * 2 + 10);

  // start OpenNI, loads the library
  SimpleOpenNI.start();
 
  // print all the cams
  StrVector strList = new StrVector();
  SimpleOpenNI.deviceNames(strList);
  for(int i=0;i<strList.size();i++)
    println(i + ":" + strList.get(i));

  // init the cameras
  cam1 = new SimpleOpenNI(0,this);
  cam2 = new SimpleOpenNI(1,this);

  // set the camera generators
  cam1.enableDepth();
  cam1.enableIR();
 
  cam2.enableDepth();
  cam2.enableIR();
 
 
  background(10,200,20);
}

void draw()
{
  // update the cam
  SimpleOpenNI.updateAll();
 
  // draw depthImageMap
  image(cam1.depthImage(),0,0);
  image(cam1.irImage(),0,480 + 10);
 
  image(cam2.depthImage(),640 + 10,0);
  image(cam2.irImage(),640 + 10,480 + 10);
 
}


运行到 image(cam2.depthImage(),640 + 10,0);
出现错误
Exception in thread "Animation Thread" java.lang.NullPointerException
   at processing.core.PGraphics.image(Unknown Source)
   at processing.core.PApplet.image(Unknown Source)
   at sketch_130421aaaaa.draw(sketch_130421aaaaa.java:77)
   at processing.core.PApplet.handleDraw(Unknown Source)
   at processing.core.PGraphics.requestDraw(Unknown Source)
   at processing.core.PApplet.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:662)
« 最后编辑时间: 四月 21, 2013, 01:24:25 下午 作者 pengbookfifa »

Tags: