Hao Jiang
Hao Jiang

Reputation: 21

How to store or keep Kinect movement tracking data?

Our group is now facing a problem that, we aim to implement a login system using body movements with Kinect device. That is to say, we use body movements as a so call "password". In order to login, user has to enter the "password" by performing certain movements known only by the user. So We simply Step 1: Detect and track body movements. Step 2: Analyse it. Step 3: Compare with the default one like a password. If they match, login successfully.

We are not confused at the second step. The problem is how to store movement data. We know that, Kinect could give us joints of the bodies like head, neck. How do we keep or store these related data to parse them in a certain algorithm to do the comparison so that we know the login is successful or not.

thanks in advance for your suggestions.

Upvotes: 0

Views: 345

Answers (1)

Senbazuru
Senbazuru

Reputation: 381

You could for example write each joints positional Data in an arbitrary file, like .txt for each frame. something like this:

void WriteSkeletonToFile(const nite::UserData& user, std::string filename) {

std::ofstream skeletonFile;
skeletonFile.open(filename + ".txt", std::fstream::out | std::fstream::app);

auto writeJointCoordinates = [&skeletonFile](const nite::SkeletonJoint& joint) {
    skeletonFile << joint.getPosition().x << ",";
    skeletonFile << joint.getPosition().y << ",";
    skeletonFile << joint.getPosition().z << ",";
};
//Center body parts
writeJointCoordinates(user.getSkeleton().getJoint(nite::JOINT_HEAD));
writeJointCoordinates(user.getSkeleton().getJoint(nite::JOINT_NECK));
... continue for  each joint
skeletonFile << "\n";
skeletonFile.close();

you can afterwards read it in again and use it as you like. But remember to match it with your live skeleton position when comparing it with the stored positions. You can of course save additional Joint data like rotation (those are calculated with the positions anyway, so not really necessary), ID etc, but i would recommend a slicker File formatting then ;)

Upvotes: 0

Related Questions