multiple user based on userId?

edited July 2015 in Kinect

Hi, I'm using simpleOpenNI with the Kinect. I have an array of 5 colors and a certain number of people (12-13) that will come in front of the kinect one by one. I need to relate a single color to a single person. When the index of the array of colors will arrive at 5, it will be reset to 0. My problem is that I cant' do something like 'new user = index++' because the userId doesn't seem to change everytime a person exit the kinect space and a new one enters in.

I think I should do something in this part of code but not sure where

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);
    }
  }

}
Tagged:

Answers

  • edited July 2015

    I am trying to understand your question

    draw() loops in itself automatically

    so you don't need a for-loop there

    just say something like (pseudo-code here)

    fill(colorList[userCount]);
    

    now, when the user leaves the screen and a user enters the screen, you need to detect that and say

    if (userChange()) {
        userCount++;
        if (userCount>=5) 
            userCount=0;
    }
    

    You can't recognize users as such, right?

    You can only say, oh, here a person left and a person came in, right?

    Chrisir ;-)

  • the code I posted is the basic example of simpleOpenNI. Yes, that's exactly what I want to do..but my problem is that I don't understand when/where a new user is detected. thanks

  • I don't know

  • does the above code work?

    then you could count the tracking skeletons (with for-loop).

    when it's = 0 , no human present. when it's > 0 human present. on any change (1) just increase the counter as I said above.

    (maybe: to avoid multiple countings of (1) I suggest a small marker changeHasBeenCount boolean that you switch on and off accordingly )

Sign In or Register to comment.