HRESULT GesturesAnalyzer::SaveSkeleton(vector<vector<cv::Point3d>>& pRecordedSkeleton, const nite::Array<nite::UserData>& pUsers)
{
	vector<cv::Point3d> skeletonTemp(11);
	for (int i = 0; i < pUsers.getSize(); ++i)
	{
		const nite::UserData& userData = pUsers[i];
		if (!userData.isLost())
		{
			if (pUsers[i].getSkeleton().getState() == nite::SKELETON_TRACKED)
			{
				for(int iterator = 0; iterator < 11; iterator++)
				{
					cv::Point3d p = cv::Point3d();
					nite::SkeletonJoint joint = userData.getSkeleton().getJoint((nite::JointType)iterator);
					p.x = joint.getPosition().x;
					p.y = joint.getPosition().y;
					p.z = joint.getPosition().z;
					skeletonTemp[iterator] = p;
				}
			}
		}
	}
	pRecordedSkeleton.push_back(skeletonTemp);
	return S_OK;
}
Beispiel #2
0
void elApp::updateUserPositions(const nite::Array<nite::UserData>& users)
{
    return;
    const u32 len = users.getSize();

    for (u32 i = 0; i < len; i++)
    {
        const nite::UserData& user = users[i];
        if (user.isNew())
        {
            scene::ISceneNode* sn = sman->addMeshSceneNode(sman->getMesh("../res/user.obj"));
            sn->setVisible(false);
            sn->setMaterialFlag(video::EMF_LIGHTING, false);
            sn->setMaterialFlag(video::EMF_WIREFRAME, true);
            userPositions.insert(std::pair<s32, scene::ISceneNode*>(user.getId(), sn));
        }
        else if (user.isLost())
        {
            sman->addToDeletionQueue(userPositions.find(user.getId())->second);
            userPositions.erase(user.getId());
        }
        else
        {
            if (user.getSkeleton().getState() == SKELETON_TRACKED)
            {
                scene::ISceneNode* sn = userPositions.find(user.getId())->second;
                sn->setVisible(true);
                const Point3f tPos = user.getSkeleton().getJoint(nite::JOINT_TORSO).getPosition();
                sn->setPosition(core::vector3df(tPos.x * -0.001f, tPos.y * 0.001f, tPos.z * 0.001f));
            }
        }
    }
}