我在 Kinect 中使用 simpleOpenNI。我有 5 种颜色的数组和一定数量的人(12-13 人)会一个一个来到 kinect 面前。我需要将一种颜色与一个人联系起来。当颜色数组的索引到达 5 时,它将被重置为 0。我的问题是我不能做类似 'new user = index++' 之类的事情,因为每次一个人退出时,userId 似乎都不会改变kinect 空间和一个新用户进入。我的问题是我不明白何时/何地检测到新用户。
我想我应该在这部分代码中做点什么,但不确定在哪里
void draw()
{
// update the cam
context.update();
// draw depthImageMap
image(context.rgbImage(),0,0,200, 200);
// draw the skeleton if it's available
int[] userList = context.getUsers();
for(int i=0;i<userList.length;i++)
{
if(context.isTrackingSkeleton(userList[i]))
{
stroke(userClr[ (userList[i] - 1) % userClr.length ] );
drawSkeleton(userList[i]);
draw_line(xL, yL, oldXL, oldYL, xR, yR, oldXR, oldYR);
}
}
}