userMap (OpenNI2)
Post date: 2015/04/16 1:35:32
深度データ中の人物領域の抜き出しで、getUserPixels()が無くなったので、
public int[] userMap()
を利用。配列userMap[]にuser番号が入っている。
void addUserParticle1(SimpleOpenNI context, int xskip, int yskip){
int[] userMap = context.userMap();
PVector pos; pos = new PVector();
int w=context.depthWidth(), h=context.depthHeight();
for (int y = 0; y < h; y+=yskip){
for (int x = 0; x < w; x+=xskip){
int index = x + y * w;
if (userMap[index]!=0){
pos.x=w-x; pos.y=y; //println("x="+x+",y="+y);
ps.addParticleP(pos);
}
}
}
}
Ref: User3d.pde