UserCounter for all tracked users (simpleopenni)

edited May 2017 in Kinect

Hi everyone! I'm complete beginner to processing, kinect and simpleopenni. I'm sorry for asking stupid question, but please help me :(

I tried to create a usercounter for many times for my program, since I'd like to base on the amount of the tracked user to switch my sketch between two function, yet it did't work at all. ( e.g usercount is 1-20 = function A; usercount is 21-29=switch to function B; usercount is 30-50= function A; ...)

if I count it by getting the number of userID or using kinect.getNumberOfUsers() , it only gets the current detecting user, and the count will go back to 0, or even -1 when the users is out of the scene map.

I'd like to have a user countor accumulating all the users instead of the current ones, what should i do?

I'm using simpleopenni 1.96, processing 2.1 and window sdk 1.8. (OS: window 7) Thank you so much!


  • edited May 2017

    When you make your own counter, name it userCounter

    Every time the internal counter changes from 0 to 1 increase userCounter

  • I tried, but I kinda ruined it into keep increasing :S How can I make it to only add 1 at a time?

  • Answer ✓

    you want to achieve this:

    Every time the internal counter changes from 0 to 1 increase userCounter

    You have to think of an idea to check this change, so that he doesn't count userCounter always up, but only if there has been a change.

    One idea:

    make a variable previousValueForCount = kinect.getNumberOfUsers() ; at end of draw (I think).

    Now say

    if(kinect.getNumberOfUsers() == 1 && previousValueForCount == 0) {
        // change detected
        previousValueForCount = 1; 

    or if(kinect.getNumberOfUsers() > 1 and userCounter+=kinect.getNumberOfUsers()

  • Thank you!! Let me try!! Sincerely thanks Chrisir!!

  • Hi there!

    I really have a big problem with skeleton tracking using SimpleOpenNI. I’m working on Windows 10 with Kinect v1 and SimpleOpenNI. Since two days I’m searching solution in internet, but there is no skeleton tracking code that will work in Processing 2.2.1. There is no errors, just plain white box instead of program… I'm using codes from 1. the book ,,Making this see" by Greg Borenstein, 2. trying examples from (but I think it's for v2, not sure), 3. reading what to with the problem in this site 4. or that one

    I'm pretty sure, that I have installed SimpleOpenNI properly, with NITE and SensorKinect. Do you have any advice what is wrong? I would be very grateful for any advice.

  • @zgapiane -- please start your own new thread with a new title for your new question.

Sign In or Register to comment.