• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ UserGenerator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中UserGenerator的典型用法代码示例。如果您正苦于以下问题:C++ UserGenerator类的具体用法?C++ UserGenerator怎么用?C++ UserGenerator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserGenerator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GetForwardVector

	XnVector3D OpenNIUser::GetForwardVector()
	{
		if( mId ) 
		{
			UserGenerator* userGen = _device->getUserGenerator();

			// OpenNI's orientation does not work very well.
			/*
			XnSkeletonJointTransformation t;
			m_userGen->GetSkeletonCap().GetSkeletonJoint(userID, XN_SKEL_TORSO, t);	
			float* e = t.orientation.orientation.elements;
			return XV3(e[6], e[7], -e[8]);
			*/

			XnSkeletonJointPosition p0, p1, p2;
			userGen->GetSkeletonCap().GetSkeletonJointPosition( mId, XN_SKEL_RIGHT_SHOULDER, p0 );
			userGen->GetSkeletonCap().GetSkeletonJointPosition( mId, XN_SKEL_TORSO, p1 );
			userGen->GetSkeletonCap().GetSkeletonJointPosition( mId, XN_SKEL_LEFT_SHOULDER, p2 );
			XnVector3D v0(p0.position), v1(p1.position), v2(p2.position);

			XnVector3D res1, res2;
			res1 = sub( v1, v0 );
			res2 = sub( v2, v0 );
			XnVector3D res = cross( res1, res2 );
			res = normalize( res );
		}
		
		return XnVector3D();
	}
开发者ID:kod3000,项目名称:BlockOpenNI,代码行数:29,代码来源:VOpenNIUser.cpp


示例2: UserCalibration_CalibrationComplete

// Callback: Finished calibration
void XN_CALLBACK_TYPE UserCalibration_CalibrationComplete(xn::SkeletonCapability& capability, XnUserID nId, XnCalibrationStatus eStatus, void* pCookie)
{
	XnUInt32 epochTime = 0;
	xnOSGetEpochTime(&epochTime);
	if (eStatus == XN_CALIBRATION_STATUS_OK)
	{
		// Calibration succeeded
		printf("%d Calibration complete, start tracking user %d\n", epochTime, nId);		
		g_UserGenerator.GetSkeletonCap().StartTracking(nId);
	}
	else
	{
		// Calibration failed
		printf("%d Calibration failed for user %d\n", epochTime, nId);
        /*if(eStatus==XN_CALIBRATION_STATUS_MANUAL_ABORT)
        {
            printf("Manual abort occured, stop attempting to calibrate!");
            return;
        }*/
		if (g_bNeedPose)
		{
			g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId);
		}
		else
		{
			g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
		}
	}
}
开发者ID:Pajinek,项目名称:kinect-annotation,代码行数:30,代码来源:openni.cpp


示例3: UserPose_PoseDetected

// Callback: Detected a pose
void XN_CALLBACK_TYPE UserPose_PoseDetected(xn::PoseDetectionCapability& capability, const XnChar* strPose, XnUserID nId, void* pCookie)
{
	XnUInt32 epochTime = 0;
	xnOSGetEpochTime(&epochTime);
	printf("%d Pose %s detected for user %d\n", epochTime, strPose, nId);
	g_UserGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
	g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE);
}
开发者ID:Pajinek,项目名称:kinect-annotation,代码行数:9,代码来源:openni.cpp


示例4: xnOSGetEpochTime

void XN_CALLBACK_TYPE UserTracker::UserPose_PoseDetected(xn::PoseDetectionCapability& capability, const XnChar* strPose, XnUserID nId, void* pCookie)
{
    XnUInt32 epochTime = 0;
	xnOSGetEpochTime(&epochTime);
	//printf("%d Pose %s detected for user %d\n", epochTime, strPose, nId);
    UserGenerator *userGenerator = static_cast<xn::UserGenerator*>(pCookie);
    if(userGenerator)
    {
        userGenerator->GetPoseDetectionCap().StopPoseDetection(nId);
        userGenerator->GetSkeletonCap().RequestCalibration(nId, TRUE); 
    }
    
}
开发者ID:yongxiaofeng,项目名称:earthQuakeProject,代码行数:13,代码来源:UserTracker.cpp


示例5: drawGameInfo

/**
 *  Draw the scores over the users in the game (openGL).
 */
void SuperFiremanBrothers :: drawGameInfo ()
{
    float y;
    int score;
    char strLabel[20] = "";
    char strLevel[20] = "";
    char strStart[20] = "Calibrate to begin";
    char strEnd[20] = "Game Over";
    UserGenerator uGen;
    DepthGenerator dGen;
    XnUserID player;
    XnPoint3D com;
    map <XnUserID, int> :: iterator iter;

    float amb[3] = {1.0, 1.0, 1.0};
    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb);
    glDisable(GL_LIGHTING);
    y = -768;

    uGen = userDetector -> retUserGenerator();
    dGen = userDetector -> retDepthGenerator();

    for (iter = players.begin(); iter != players.end(); iter++) {
        player = iter -> first;
        score  = iter -> second;
        sprintf(strLabel, "Score: %d", score);
        uGen.GetCoM(player, com);
        dGen.ConvertRealWorldToProjective(1, &com, &com);

        glRasterPos3f( com.X + 100, com.Y - 300, com.Z);
        glPrintString(GLUT_BITMAP_HELVETICA_18, strLabel);
        y += 150;
    }

    sprintf(strLevel, "Level %d", level);
    glRasterPos2f( 500, -768);
    glPrintString(GLUT_BITMAP_HELVETICA_18, strLevel);

    if (gameStatus == NOT_STARTED) {
        glRasterPos2f( 500, 0);
        glPrintString(GLUT_BITMAP_HELVETICA_18, strStart);
    }
    else if (gameStatus > STARTED) {
        glRasterPos2f( 500, 0);
        glPrintString(GLUT_BITMAP_HELVETICA_18, strEnd);
    }

    glEnable(GL_LIGHTING);
}
开发者ID:IAIshFons,项目名称:Super-Fireman-Brothers-Kinect-Game,代码行数:52,代码来源:SuperFiremanBrothers.cpp


示例6: GetUpVector

	XnVector3D OpenNIUser::GetUpVector()
	{
		if( mId ) 
		{
			UserGenerator* userGen = _device->getUserGenerator();

			XnSkeletonJointPosition p0, p1;
			userGen->GetSkeletonCap().GetSkeletonJointPosition( mId, XN_SKEL_TORSO, p0 );
			userGen->GetSkeletonCap().GetSkeletonJointPosition( mId, XN_SKEL_NECK, p1 );
			XnVector3D v0(p0.position), v1(p1.position);
			XnVector3D res1 = sub( v1, v0 );
			res1 = sub( v1, v0 );
			res1 = normalize( res1 );
			return res1;
		}
		
		return XnVector3D();
	}
开发者ID:kod3000,项目名称:BlockOpenNI,代码行数:18,代码来源:VOpenNIUser.cpp


示例7: lostUser

/*
 *	Function:	lostUser
 *
 *	Gets the number of users remaining (including the lost user).
 *	If this was the last user, an alert is fired for "Patient not tracked."
 *
 *	Parameters:
 *		UserGenerator&	generator	-	A reference to the UserGenerator module. Not Used.
 *		XNUserID				nID				-	The id referring to the lost user.
 *		void*						pCookie
 */
void XN_CALLBACK_TYPE lostUser(UserGenerator &generator,
    XnUserID nID, void *pCookie) {
  
	// Get the available users (allowing enough space for up to 15 different users)
  XnUInt16 numUsers = 15;
	XnUserID users[numUsers];
	userGenerator.GetUsers(users, numUsers);
	// Raise an alert if there are no users being tracked (meaning we lost the patient).
	if( numUsers <= 1) {
		printf("Patient not tracked.\n");
	}
}
开发者ID:tlrobrn,项目名称:mdpnp-kinect,代码行数:23,代码来源:monitor.cpp


示例8: User_NewUser

void XN_CALLBACK_TYPE User_NewUser(UserGenerator& generator, XnUserID nId, void* pCookie)
{
	if(_printUserTracking) printf("AS3OpenNI :: New User: %d\n", nId);
	if(_needPose)
	{
		_userGenerator.GetPoseDetectionCap().StartPoseDetection(_strPose, nId);
	}
	else
	{
		_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
	}
	
	char cValue[50];
	sprintf(cValue, "user_tracking_new_user:%d", nId);
	if(_useSockets) 
	{
		#if (XN_PLATFORM == XN_PLATFORM_WIN32)
			g_AS3Network.sendMessage(1,2,nId);
		#else
			sendToSocket(USER_TRACKING_SOCKET, cValue);
		#endif
	}
}
开发者ID:alfiandosengkey,项目名称:as3openni,代码行数:23,代码来源:main.cpp


示例9: glutDisplay

void glutDisplay (void){
    glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    // Setup the OpenGL viewpoint
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    SceneMetaData sceneMD;
    DepthMetaData depthMD;
    ImageMetaData imageMD;
    g_DepthGenerator.GetMetaData(depthMD);
    glOrtho(0, depthMD.XRes(), depthMD.YRes(), 0, -1.0, 1.0);
    glDisable(GL_TEXTURE_2D);
    //XnStatus rc = g_Context.WaitOneUpdateAll(g_DepthGenerator);
    XnStatus rc = g_Context.WaitAnyUpdateAll();
    CHECK_RC("Wait Data",rc);
    g_DepthGenerator.GetMetaData(depthMD);
    if(g_UserGenerator.IsValid())
        g_UserGenerator.GetUserPixels(0, sceneMD);
    g_ImageGenerator.GetMetaData(imageMD);

    DrawDepthMap(depthMD, sceneMD);
    DrawImage(imageMD);
    glutSwapBuffers();
}//glutdisplay
开发者ID:msdark,项目名称:Kinect-Counter,代码行数:24,代码来源:glinit.cpp


示例10: drawNeutral

/**
 *  DrawNeutral function.
 *
 *  This function draws the stick figure depending on the
 *  transforming stage of the player or draws a diamond if the
 *  player is not tracked.
 *
 *  @param player is the ID of the player.
 *
 */
void NeutralModel :: drawNeutral (XnUserID player)
{
    // UserGenerator.
    UserGenerator userGen;

    // Color of the stick figure.
    XnFloat color[3];

    // Material properties.
    GLfloat mat_specular[] = { 0.3, 0.3, 0.3, 0.3 };
    GLfloat mat_shininess[] = { 10.0 };

    // Center of mass.
    XnPoint3D com;

    // Player's stage.
    int stage;

    float ax;
    Vector3D a;
    Vector3D b;
    Vector3D c;
    Vector3D u;
    Vector3D v;
    Vector3D w;

    GLuint mode;

    // Select the players color according his ID.
    color[0] = Colors[player % nColors][0];
    color[1] = Colors[player % nColors][1];
    color[2] = Colors[player % nColors][2];

    // Set the material for the stick figure.
    GLfloat materialColor[] = {color[0], color[1], color[2], 1.0f};
    
    glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, materialColor);
    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);

    userGen = nm_UserDetector -> retUserGenerator();
    SkeletonCapability skelCap = userGen.GetSkeletonCap();

    mode =  GLM_SMOOTH | GLM_MATERIAL;


    a = Vector3D(joint[LSHOULDER]);
    b = Vector3D(joint[RSHOULDER]);
    c = Vector3D(joint[RHIP]);

    u = b - a;
    v = c - a;

    w = u.cross(v);
    w.y = 0.0;
    w.normalize();

    ax = 57.2957795 * acos(w.z);

    if (w.x <= 0.0) {
        ax = -ax;
    }

    // Init the drawing process.
    // Draws a stick figure if player is been tracked.
    if (skelCap.IsTracking(player)) {
       
        // Get player's stage.
        stage = nm_UserDetector -> retStage(player);

        loadJoints(player, skelCap);

        // Drawing legs.
        if ((stage >= 0) && (stage < 4)) { 

            // Left leg.
            glPushMatrix();
                orientMatrix(joint[RHIP],joint[RKNEE]);
                glTranslatef( 0.0, 0.0, 50.0);
                glScalef(250.0, 250.0, 250.0);
                glRotatef(90, -1.0, 0.0, 0.0);
                glRotatef(ax, 0.0,-1.0, 0.0);
                glmDraw(zamusModelParts.thigh, mode); 

            glPopMatrix();
            
            glPushMatrix();
                orientMatrix(joint[RKNEE],joint[RFOOT]);
                glTranslatef( 0.0, 0.0, 50.0);
                glScalef(100.0, 100.0, 100.0);
//.........这里部分代码省略.........
开发者ID:IAIshFons,项目名称:Super-Fireman-Brothers-Kinect-Game,代码行数:101,代码来源:NeutralModel.cpp


示例11: nextFrame

/**
 *  Method that controls the fireballs that are 
 *  going to be spawned per frames.
 */
void SuperFiremanBrothers :: nextFrame ()
{
    if (gameStatus != STARTED) {
        return;
    }

    static int counter = 0;
    static int spawnRate = (SPAWN_RATE_FIRST_LEVEL) * players.size();
    static float speedRate = (SPEED_RATE_FIRST_LEVEL) * players.size(); 
    static int flamesInLevel = (FLAMES_IN_FIRST_LEVEL) * players.size();
    const static int riseSpawnRate = (RISE_SPAWN_RATE) * players.size();
    const static int riseSpeedRate = (RISE_SPEED_RATE) * players.size();
    const static int riseFlamesInLevel = (RISE_FLAMES_IN_LEVEL) * players.size();

    int i;
    int j;
    int hp;
    float x;
    float y;
    Vector3D position;

    vector <ZamusShoot> zShoot; 
    vector <LinqSpawnIce> lShoot; 

    zShoot = zamusDetector -> shoots;
    lShoot = linqDetector -> iceSpawn;
        
    UserGenerator  ugen;
    DepthGenerator dgen;
    map <XnUserID, int> :: iterator iter;
    XnUserID  player;
    XnSkeletonJointPosition joint;
    XnPoint3D foots[2];

    ugen  = userDetector -> retUserGenerator();
    dgen  = userDetector -> retDepthGenerator();

    for (i = 0; i < fireBalls.size(); i++) {

        for (j = 0; j < zShoot.size(); j++) {
            if (fireBalls[i].isInBoundingBox(zShoot[j].position)) {
                fireBalls[i].extinguish();
                players[zShoot[j].player] += POINTS_PER_HIT;
                zShoot.erase(zShoot.begin() + j);
                j--;
            }
        }

        for (j = 0; j < lShoot.size(); j++) {
            if (fireBalls[i].isInBoundingBox(lShoot[j].position)) {
                fireBalls[i].extinguish();
                players[lShoot[j].player] += POINTS_PER_HIT;
                lShoot.erase(lShoot.begin() + j);
                j--;
            }
        }

        for (iter = players.begin(); iter != players.end(); iter++) {
            player = iter -> first;
            ugen.GetSkeletonCap().GetSkeletonJointPosition(player, 
                                             XN_SKEL_RIGHT_FOOT,
                                             joint);
            foots[0] = joint.position;
            ugen.GetSkeletonCap().GetSkeletonJointPosition(player, 
                                             XN_SKEL_RIGHT_FOOT,
                                             joint);
            foots[1] = joint.position;
            dgen.ConvertRealWorldToProjective(2, foots, foots);
            if (fireBalls[i].isInBoundingBox(foots[0])) {
                fireBalls[i].extinguish();
                players[player] += POINTS_PER_HIT;
                j--;
            }
            if (fireBalls[i].isInBoundingBox(foots[1])) {
                fireBalls[i].extinguish();
                players[player] += POINTS_PER_HIT;
                j--;
            }
        }    

        zamusDetector -> shoots  = zShoot;
        linqDetector -> iceSpawn = lShoot;

        if (fireBalls[i].getZPos() > FIRE_LIMIT) {
            lostGame = true;
            return;
        }
        else {
            fireBalls[i].advance(speedRate);
        }

    }

    if ((counter == spawnRate) &&
        (numFlames < flamesInLevel)){
        x = (float)rand() / (float)RAND_MAX;
//.........这里部分代码省略.........
开发者ID:IAIshFons,项目名称:Super-Fireman-Brothers-Kinect-Game,代码行数:101,代码来源:SuperFiremanBrothers.cpp


示例12: initialize

/**
 * Initialize XN functions
 */
void initialize() 
{
    ImageMetaData imageMD;
    XnStatus status;
    int dummy;
    
    srand ( time(NULL) );

    // Initializing context and checking for enumeration errors
    status = g_Context.InitFromXmlFile(XML_CONFIG_FILE, &g_Error);
    checkEnumError(status, g_Error);

    // Finding nodes and checking for errors
    STATUS_CHECK(g_Context.FindExistingNode(XN_NODE_TYPE_DEPTH, g_DepthGenerator), "Finding depth node");
    STATUS_CHECK(g_Context.FindExistingNode(XN_NODE_TYPE_SCENE, g_SceneAnalyzer), "Finding scene analizer");


    //  Note: when the image generation node is handled the program gets
    //  too slow.

    // STATUS_CHECK(g_Context.FindExistingNode(XN_NODE_TYPE_IMAGE, g_ImageGenerator), "Finding image node");

    // Set view point of Depth generator to the image generator point of
    // view.
    // STATUS_CHECK(g_DepthGenerator.GetAlternativeViewPointCap().SetViewPoint(g_ImageGenerator), "Set View Point");

    STATUS_CHECK(g_Context.FindExistingNode(XN_NODE_TYPE_USER, g_UserGenerator), "Finding user node");
    
    //g_ImageGenerator.GetMetaData(imageMD);
    
    // Checking camera pixel format
    //if (imageMD.PixelFormat() != XN_PIXEL_FORMAT_RGB24) {
    //    reportError("Camera format not supported...!\n");
    //}

    // Checking user generator capabilities
    if(!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_SKELETON)) {
        reportError("Skeleton capability not supported\n");
    }
    
    if(!g_UserGenerator.IsCapabilitySupported(XN_CAPABILITY_POSE_DETECTION)) {
        reportError("Pose detection capability not supported\n");
    }

    printf("Number of players: ");
    dummy = scanf("%d", &g_MaxPlayers);
    printf("\n");

    //Initialize user detector object
    g_UserDetector = UserDetector(g_UserGenerator, g_DepthGenerator);
    g_UserDetector.registerCallbacks();
    
    g_ZamusDetector = new Zamus(&g_UserDetector);
    g_LinqDetector = new Linq(&g_UserDetector);
    g_BusterDetector = new BusterDetector(g_ZamusDetector, &g_UserDetector);
    g_IceRodDetector = new IceRodDetector(g_LinqDetector, &g_UserDetector);

    // Initialize image render object
    g_SceneRenderer = SceneRenderer(&g_ImageGenerator,
                                    &g_DepthGenerator,
                                    &g_SceneAnalyzer,
                                    &g_UserDetector,
                                    g_ZamusDetector,
                                    g_LinqDetector);

    STATUS_CHECK(g_Context.StartGeneratingAll(), "Context generation");

    g_SFBgame = SuperFiremanBrothers(&g_UserDetector, 
                                     &g_SceneAnalyzer, 
                                     g_ZamusDetector, 
                                     g_LinqDetector, 
                                     g_MaxPlayers
                                    );

}
开发者ID:IAIshFons,项目名称:Super-Fireman-Brothers-Kinect-Game,代码行数:78,代码来源:main.cpp


示例13: getJointPosition

	void getJointPosition(XnUserID player, XnSkeletonJoint eJoint1, unsigned char * dest)
	{
		if (!_userGenerator.GetSkeletonCap().IsTracking(player))
		{
			printf("not tracked!\n");
			return;
		}
		
		XnSkeletonJointPosition joint1;
		_userGenerator.GetSkeletonCap().GetSkeletonJointPosition(player, eJoint1, joint1);
	
		if (joint1.fConfidence < 0.5)
		{
			return;
		}
		
		XnPoint3D pt[1];
		pt[0] = joint1.position;
		_depth.ConvertRealWorldToProjective(1, pt, pt);
		
		float _x, _y, _z;
		_x = pt[0].X;
		_y = pt[0].Y;
		_z = pt[0].Z;
		memcpy(dest, &_x, 4);
		memcpy(dest+4, &_y, 4);
		memcpy(dest+8, &_z, 4);
	}
开发者ID:alfiandosengkey,项目名称:as3openni,代码行数:28,代码来源:main.cpp


示例14: isReadyPose

// Detect if hands are forming "Ready Pose"
static bool isReadyPose(){
	XnSkeletonJointPosition torso, leftHip, rightHip;

	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_TORSO, torso);
	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_LEFT_HIP, leftHip);
	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_RIGHT_HIP, rightHip);

	// Return if hands are within hips ad torso
	return IS_BETWEEN(leftHandPosition, leftHip, torso, Y) && IS_BETWEEN(rightHandPosition, rightHip, torso, Y)
		&& IS_BETWEEN(leftHandPosition, leftHip, rightHip, X) && IS_BETWEEN(rightHandPosition, leftHip, rightHip, X);
}
开发者ID:nwoedf,项目名称:Chinese-Sign-Language-Recognition-and-Translation-System,代码行数:12,代码来源:UserRecorderProductor.cpp


示例15: loadCalibration

/*
 *	Function:	loadCalibration
 *
 *	Loads a skeletal calibration from a standard file.
 *	This means that a new user does not need to hold a pose to be tracked.
 *	The CALIBRATION_FILE macro is defined in monitor.h.
 *
 *	Parameters:
 *		XnUserID user	-	The reference to the new user to be calibrated.
 */
void loadCalibration(XnUserID user) {
    if( userGenerator.GetSkeletonCap().IsCalibrated(user) ) return;
    
    // Load file
    XnStatus status = userGenerator.GetSkeletonCap().
        LoadCalibrationDataFromFile(user, CALIBRATION_FILE);
    
    // Start tracking
    if( status == XN_STATUS_OK )
        userGenerator.GetSkeletonCap().StartTracking(user);

}
开发者ID:tlrobrn,项目名称:mdpnp-kinect,代码行数:22,代码来源:monitor.cpp


示例16: prepare

XnStatus prepare(char useScene, char useDepth, char useHistogram)
{
//TODO handle possible failures!
	if (useDepth)
	{
		mDepthGen.GetMetaData(depthMD);
		nXRes = depthMD.XRes();
		nYRes = depthMD.YRes();

		pDepth = depthMD.Data();

		if (useHistogram)
		{
			calcHist();

			// rewind the pointer
			pDepth = depthMD.Data();
		}
	}
	if (useScene) 
	{
		mUserGen.GetUserPixels(0, sceneMD);
		nXRes = sceneMD.XRes();
		nYRes = sceneMD.YRes();

		pLabels = sceneMD.Data();
	}
}
开发者ID:Clebeson,项目名称:OpenNI,代码行数:28,代码来源:org_OpenNI_Samples_Assistant_NativeMethods.cpp


示例17: UserPose_PoseDetected

void XN_CALLBACK_TYPE UserPose_PoseDetected(PoseDetectionCapability& capability, const XnChar* strPose, XnUserID nId, void* pCookie)
{
	if(_printUserTracking) printf("AS3OpenNI :: Pose %s detected for user: %d\n", strPose, nId);
	_userGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
	_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
	
	char cValue[50];
	sprintf(cValue, "user_tracking_pose_detected:%d", nId);
	if(_useSockets) 
	{
		#if (XN_PLATFORM == XN_PLATFORM_WIN32)
			g_AS3Network.sendMessage(1,6,nId);
		#else
			sendToSocket(USER_TRACKING_SOCKET, cValue);
		#endif
	}
}
开发者ID:alfiandosengkey,项目名称:as3openni,代码行数:17,代码来源:main.cpp


示例18: run

/*
 *	Function:	run
 *
 *	Starts and continues generating data from the Kinect.
 *	A loop runs and updates data whenever new data is available from one of the Kinect
 *	devices, and then the data is processed to check for patient movement.
 *	The loop is controlled by the "quit" global boolean, which is set to false by the 
 *	signal handler "stop()"
 */
void KinectMonitor::run() {
  XnStatus status;
  SceneMetaData scene;
	DepthMetaData depth;
    
  // Start the device
  status = context.StartGeneratingAll();

  // Running loop
  while( !quit ) {
    // Wait for any new incoming data
    context.WaitOneUpdateAll(depthGenerator);
    // Mark the new frame
		xnFPSMarkFrame(&xnFPS);
    // Get the depth data from the device
		depthGenerator.GetMetaData(depth);
        
    // Get the recognized users
		XnUInt16 numUsers = 15;
		XnUserID users[numUsers];
		userGenerator.GetUsers(users, numUsers);
		// Only track the patient if they are alone
		if( numUsers != 1) continue;
        
		// Get the user data
		userGenerator.GetUserPixels(users[0], scene);
        
    // Update patient position
    previous = current;
    current = getPosition(users[0]);
        
    // Raise alerts based on the patient's state and position
		if( previous != current ) {
        if( current == TURNED && out == false ) {
					// Patient is turned
					printf("Patient getting out of bed.\n");
				} else if( out && bedSet ) {
					printf("Patient is out of bed.\n");
				}
		}
  }
}
开发者ID:tlrobrn,项目名称:mdpnp-kinect,代码行数:51,代码来源:monitor.cpp


示例19: UserCalibration_CalibrationEnd

void XN_CALLBACK_TYPE UserCalibration_CalibrationEnd(SkeletonCapability& capability, XnUserID nId, XnBool bSuccess, void* pCookie)
{
	if (bSuccess)
	{
		if(_printUserTracking) printf("AS3OpenNI :: Calibration complete, start tracking user: %d\n", nId);
		_userGenerator.GetSkeletonCap().StartTracking(nId);
		
		char cValue[50];
		sprintf(cValue, "user_tracking_user_calibration_complete:%d", nId);
		if(_useSockets) 
		{
			#if (XN_PLATFORM == XN_PLATFORM_WIN32)
				g_AS3Network.sendMessage(1,8,nId);
			#else
				sendToSocket(USER_TRACKING_SOCKET, cValue);
			#endif
		}
	}
	else
	{
		if(_printUserTracking) printf("AS3OpenNI :: Calibration failed for user: %d\n", nId);
		if (_needPose)
		{
			_userGenerator.GetPoseDetectionCap().StartPoseDetection(_strPose, nId);
		}
		else
		{
			_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
		}
		
		char cValue[50];
		sprintf(cValue, "user_tracking_user_calibration_failed:%d", nId);
		if(_useSockets) 
		{
			#if (XN_PLATFORM == XN_PLATFORM_WIN32)
				g_AS3Network.sendMessage(1,9,nId);
			#else
				sendToSocket(USER_TRACKING_SOCKET, cValue);
			#endif
		}
	}
}
开发者ID:alfiandosengkey,项目名称:as3openni,代码行数:42,代码来源:main.cpp


示例20: takeFrame

// Record one frame from data
static void takeFrame(){
	SkeletonRawData rawData;
	XnSkeletonJointPosition pos_left_elbow, pos_right_elbow, pos_left_shoulder, pos_right_shoulder;

	// Capture Data
	xnOSMemCopy(&(rawData.leftHand), &(leftHandPosition.position), sizeof(XnPoint3D));
	xnOSMemCopy(&(rawData.rightHand), &(rightHandPosition.position), sizeof(XnPoint3D));

	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_LEFT_ELBOW, pos_left_elbow);
	xnOSMemCopy(&(rawData.leftElbow), &(pos_left_elbow.position), sizeof(XnPoint3D));
	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_RIGHT_ELBOW, pos_right_elbow);
	xnOSMemCopy(&(rawData.rightElbow), &(pos_right_elbow.position), sizeof(XnPoint3D));

	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_LEFT_SHOULDER, pos_left_shoulder);
	xnOSMemCopy(&(rawData.leftShoulder), &(pos_left_shoulder.position), sizeof(XnPoint3D));
	g_user.GetSkeletonCap().GetSkeletonJointPosition(g_userID, XN_SKEL_RIGHT_SHOULDER, pos_right_shoulder);
	xnOSMemCopy(&(rawData.rightShoulder), &(pos_right_shoulder.position), sizeof(XnPoint3D));

	rawDatas.push_back(rawData);
}
开发者ID:nwoedf,项目名称:Chinese-Sign-Language-Recognition-and-Translation-System,代码行数:21,代码来源:UserRecorderProductor.cpp



注:本文中的UserGenerator类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ UserHeapPtr类代码示例发布时间:2022-05-31
下一篇:
C++ UserDefault类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap