tracking more than one active user

22 views
Skip to first unread message

ghazaleh p

unread,
Aug 4, 2011, 6:52:02 PM8/4/11
to GeometricMusicStudio
Hi everyone,

I want to know how can I track more than one active user. I am
currently using kinect and OpenNI but I do not know how to change the
code for the GeometricMusicStudio and even where to fid the code.

Thanks

AdbC

unread,
Aug 4, 2011, 7:51:31 PM8/4/11
to GeometricMusicStudio
Hi,

The code is available at:
http://sourceforge.net/projects/geometricmusic/

there are a variety of versions, your choice is really between the old
midi version and the newer osc version. I have some links where people
discuss the multiple kinect issue, my opinion is that it is best to
use multiple machines and then merge the data together. I might be
able to make some changes to the latest viewer I am making so that it
will render your multiple people in 3D. First though is working out
how you want to crack the multiple kinects issue, I'll forward the
links tomorrow.

Cheers,
Alistair

ghazaleh p

unread,
Aug 4, 2011, 8:29:35 PM8/4/11
to GeometricMusicStudio
Hi Alisrtair,

Actually I tried the idea of using multiple devices but it is much
harder than just using one kinect. I looked trough the code and now I
am trying to figure out the part that I can chenge so it will allow me
to track more users. do you know what part of the code is related to
that?


Thanks for helping
> > Thanks- Hide quoted text -
>
> - Show quoted text -

Alistair Clarkson

unread,
Aug 5, 2011, 4:25:39 AM8/5/11
to geometricm...@googlegroups.com
Ah, if you are only interested in tracking multiple users then you will need to edit all the OpenNI callbacks at the top of the code, the functions starting void XN_CALLBACK_TYPE to allow multiple players, definitely you will want to edit LostUserCB to remove the player lost off screen bits, and you will want to edit PoseStartCB to remove the assertion style check at the top. Also in the skeleton draw function there is a line that gets the current players joints positions, you will need to edit that so that it gets all players joint positions, prob best to call the method in a loop. This is all assuming you are using the latest version.

You will also need to think about what you are outputting and where. Do you want to output to a midi device or OSC? What platform are you on, Windows or Mac?


From: ghazaleh p <ghaza...@gmail.com>
To: GeometricMusicStudio <geometricm...@googlegroups.com>
Sent: Friday, 5 August 2011, 1:29
Subject: Re: tracking more than one active user

ghazaleh p

unread,
Aug 8, 2011, 4:54:53 PM8/8/11
to GeometricMusicStudio
I am using Windows and my output will go into OSC and then to Touch
Designer software. The focus of my project is on the Touch Designer
side so that is why I am not really good in editing this code and I am
aslo a high school student that is trying to learn how to code. I
looked at the part that you said I have to edit for example that is
the first callback that I have to change:

void XN_CALLBACK_TYPE LostUserCB(xn::UserGenerator& generator,
XnUserID user, void* pCookie)
{
/* If we lose a user that's not a problem, if we lose a player then
reset the software */
if (XnPlayer != user)
{
printf("Lost: User %d\n", user);
}
else
{
printf("Lost: Player (User %d)\n", user);
XnPlayer = 0;

statusCheck(XN_STATUS_ERROR,"Player lost off screen, restart
sotware");
}
}

can you tell me how can I change this so I can get an idea of how to
change the other callbacks on my own?

thank you


On Aug 5, 4:25 am, Alistair Clarkson
<alistair_de_b_clark...@yahoo.co.uk> wrote:
> Ah, if you are only interested in tracking multiple users then you will need to edit all the OpenNI callbacks at the top of the code, the functions starting void XN_CALLBACK_TYPE to allow multiple players, definitely you will want to edit LostUserCB to remove the player lost off screen bits, and you will want to edit PoseStartCB to remove the assertion style check at the top. Also in the skeleton draw function there is a line that gets the current players joints positions, you will need to edit that so that it gets all players joint positions, prob best to call the method in a loop. This is all assuming you are using the latest version.
>
> You will also need to think about what you are outputting and where. Do you want to output to a midi device or OSC? What platform are you on, Windows or Mac?
>
> ________________________________
> From: ghazaleh p <ghazaleh...@gmail.com>
> > - Show quoted text -- Hide quoted text -

AdbC

unread,
Aug 12, 2011, 5:08:08 PM8/12/11
to geometricm...@googlegroups.com
Hi,

I think I should do some explanation for you for every callback. I will start with the one you mentioned and tomorrow I will go through them all.

The issue is that the callback here checks if the user has been lost then if the user was the current player the program ends (statusCheck will kill it). In a multiuser environment you would look to keep some kind of data structure to keep track of users, in the openNI sample implementation they use an array; but i think you really want to use a map from STL, actually either are fine as long as you do it right.

In a multiuser environment you would check the array to see if your user is in the array and if they are in the array then you can delete them. One option is to say I have a maximum of 10 users and if we go over 10 then we erase number 1. (i.e. you look up user mod 10 and then user 11 will come out as user 1 again).

Anyway, thats all the lostuserCB need do.

AdbC

unread,
Aug 12, 2011, 5:18:47 PM8/12/11
to geometricm...@googlegroups.com
Hi,

If you want to edit the new user CB to make it support multiple users you would again need to have already crated a data structure to hold the users in. I'm going to assume that you decided to use an STL map, see here:


so you did something like

#include <map>

#define USER_NOT_FOUND 0
#define USER_FOUND_NOT_CALIBRATED 1

/* map of users to user's status (int) */
std::map<XnUserID, int> users;

void XN_CALLBACK_TYPE NewUserCB(xn::UserGenerator& generator, XnUserID user, void* pCookie)

{

/* Device has found new user, if they make the right pose then try to detect them */

printf("Found: User %d\n", user);

         

        users[user] = USER_FOUND_NOT_CALIBRATED;



printf("Begin: Pose detection on user %d\n", user);

XnUserGenerator.GetPoseDetectionCap().StartPoseDetection("Psi", user);

}


This will add the new player to your list of players and start calibration on the player.


Let me know if this is too much or too little assistance, I have been away for a couple of days so have been a bit slower than usual getting back to you.


Cheers,

Alistair

AdbC

unread,
Aug 15, 2011, 6:17:19 PM8/15/11
to geometricm...@googlegroups.com
Hi, I forgot, the OpenNI players sample would show you how to handle multiple users, if you go to program files / OpenNI / and find the samples directory that will have a skeletal tracking example that handles multiple users, you can use that as a way to alter the callbacks, then you just need to have a copy of all the player data for each player so that you draw each one, and send all the values via osc.
Reply all
Reply to author
Forward
0 new messages