Processing 问题:输出为白色,地面处理和kinect

Processing 问题:输出为白色,地面处理和kinect,processing,kinect,simple-openni,Processing,Kinect,Simple Openni,我正在运行下面的代码,但我只得到一个白色的背景 import processing.opengl.*; import SimpleOpenNI.*; SimpleOpenNI kinect; import saito.objloader.*; OBJModel model; void setup() { size(1028, 768, OPENGL); model = new OBJModel(this, "kinect.obj", "relative", TRIANGLES); model.

我正在运行下面的代码,但我只得到一个白色的背景

import processing.opengl.*;
import SimpleOpenNI.*;
SimpleOpenNI kinect;
import saito.objloader.*;
OBJModel model;
void setup() { 
size(1028, 768, OPENGL);
model = new OBJModel(this, "kinect.obj", "relative", TRIANGLES);
model.translateToCenter();
// translate the model so its origin
// is at its left side
BoundingBox box = new BoundingBox(this, model); 
model.translate(box.getMin()); 
kinect = new SimpleOpenNI(this);
kinect.enableDepth();
kinect.enableUser();
kinect.setMirror(true);
}
void draw() { 
kinect.update();
background(255);
translate(width/2, height/2, 0);
rotateX(radians(180));
IntVector userList = new IntVector();
kinect.getUsers(userList);
if (userList.size() > 0) {
int userId = userList.get(0);
if ( kinect.isTrackingSkeleton(userId)) {
PVector leftHand = new PVector();
kinect.getJointPositionSkeleton(userId,
SimpleOpenNI.SKEL_LEFT_HAND, leftHand);
PVector rightHand = new PVector();
kinect.getJointPositionSkeleton(userId,
SimpleOpenNI.SKEL_RIGHT_HAND,
rightHand);
// subtract right from left hand
// to turn leftHand into a vector representing
// the difference between them
leftHand.sub(rightHand); 
// convert leftHand to a unit vector
leftHand.normalize(); 
// model is rotated so "up" is the x-axis
PVector modelOrientation = new PVector(1, 0, 0); 
// calculate angle and axis
float angle = acos(modelOrientation.dot(leftHand)); 
PVector axis = modelOrientation.cross(leftHand); 
stroke(255, 0, 0);
strokeWeight(5);
drawSkeleton(userId);
pushMatrix(); 
lights();
stroke(175);
strokeWeight(1);
fill(250);
translate(rightHand.x, rightHand.y, rightHand.z); 
// rotate angle amount around axis
rotate(angle, axis.x, axis.y, axis.z); 
model.draw(); 
popMatrix();
}
}
}
void drawSkeleton(int userId) {
drawLimb(userId, SimpleOpenNI.SKEL_HEAD, SimpleOpenNI.SKEL_NECK);
drawLimb(userId, SimpleOpenNI.SKEL_NECK,SimpleOpenNI.SKEL_LEFT_SHOULDER);
drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER,SimpleOpenNI.SKEL_LEFT_ELBOW);
drawLimb(userId, SimpleOpenNI.SKEL_LEFT_ELBOW,
SimpleOpenNI.SKEL_LEFT_HAND);
drawLimb(userId, SimpleOpenNI.SKEL_NECK,
SimpleOpenNI.SKEL_RIGHT_SHOULDER);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER,
SimpleOpenNI.SKEL_RIGHT_ELBOW);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_ELBOW,
SimpleOpenNI.SKEL_RIGHT_HAND);
drawLimb(userId, SimpleOpenNI.SKEL_LEFT_SHOULDER,SimpleOpenNI.SKEL_TORSO);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_SHOULDER,SimpleOpenNI.SKEL_TORSO);
drawLimb(userId, SimpleOpenNI.SKEL_TORSO,SimpleOpenNI.SKEL_LEFT_HIP);
drawLimb(userId, SimpleOpenNI.SKEL_LEFT_HIP,SimpleOpenNI.SKEL_LEFT_KNEE);
drawLimb(userId, SimpleOpenNI.SKEL_LEFT_KNEE,SimpleOpenNI.SKEL_LEFT_FOOT);
drawLimb(userId, SimpleOpenNI.SKEL_TORSO,SimpleOpenNI.SKEL_RIGHT_HIP);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP,SimpleOpenNI.SKEL_RIGHT_KNEE);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_KNEE,SimpleOpenNI.SKEL_RIGHT_FOOT);
drawLimb(userId, SimpleOpenNI.SKEL_RIGHT_HIP,SimpleOpenNI.SKEL_LEFT_HIP);
}
void drawLimb(int userId, int jointType1, int jointType2)
{
PVector jointPos1 = new PVector();
PVector jointPos2 = new PVector();
float confidence;
// draw the joint position
confidence = kinect.getJointPositionSkeleton(userId, jointType1, jointPos1);
confidence = kinect.getJointPositionSkeleton(userId, jointType2, jointPos2);
line(jointPos1.x, jointPos1.y, jointPos1.z,jointPos2.x, jointPos2.y, jointPos2.z);
}

// user-tracking callbacks!
void onNewUser(SimpleOpenNI Kinect ,int userId)
{
  println("onNewUser - userId: " + userId);
  println("\tstart tracking skeleton");

  Kinect.startTrackingSkeleton(userId);
}

void onLostUser(SimpleOpenNI Kinect,int userId)
{
  println("onLostUser - userId: " + userId);
}

void onVisibleUser(SimpleOpenNI Kinect,int userId)
{
  //println("onVisibleUser - userId: " + userId);
}
im使用processing 2.2.1和SimplePenni 1.96 这段代码来自博彩业,但我更改了//用户跟踪回调下的最后几行! 因为我在运行原始代码处理时遇到问题,告诉我一些函数不存在,所以我还更改了kinect.enableUserSimplePenni.SKEL_PROFILE_ALL;tokinect.enableUser;
帮助plz:?

在绘图功能中,您正在做很多不同的事情。相反,尝试从更小的开始。你想看到的第一件事是什么?用它创造一个新的世界,我们将从那里开始。请注意,这不应该是您的整个草图!只是一个示例项目,其中只包含与您的问题直接相关的代码。欢迎使用Stackoverflow!请记住,您正在请求其他人帮助您解决代码问题,因此请花点时间编辑您的帖子并正确设置代码格式,以便人们能够轻松阅读。