How to lock in a single skeleton in Microsoft Kinect SDK v 1.7 using vc++?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: How to lock in a single skeleton in Microsoft Kinect SDK v 1.7 using vc++?

  1. #1
    Join Date
    Apr 2011
    Posts
    29

    How to lock in a single skeleton in Microsoft Kinect SDK v 1.7 using vc++?

    Hi,
    I m trying to lock a single skeleton using Microsoft Kinect SDK v 1.7 . My requirements are
    • First lock a single skeleton.
    • Check the tracking state of the of the locked skeleton.
    • If the tracking state of the locked skeleton is NOT Tracked,then
    • ----->check for the next closest skeleton
    • ----->lock this skeleton.
    How do I do this using vc++2010. The code which i tried is given below.


    Code:
    TrackSingleSkeleton(NUI_SKELETON_FRAME* pSkeletonFrame)
    {
    	DWORD dwTrackingIDs[NUI_SKELETON_MAX_TRACKED_COUNT]={0, 0};
    	m_pNuiSensor->NuiSkeletonTrackingEnable(m_hNextSkeletonEvent,NUI_SKELETON_TRACKING_FLAG_TITLE_SETS_TRACKED_SKELETONS);
    	 for (int i = 0; i < NUI_SKELETON_COUNT; i++)
    	 {
    		const NUI_SKELETON_DATA & skeleton = pSkeletonFrame->SkeletonData[i];
    		if (skeleton.eTrackingState == NUI_SKELETON_TRACKED)
    	      {	
    			dwTrackingIDs[0] = skeleton.dwTrackingID;
    			dwTrackingIDs[1] = 0; // or 0, if you want to track only one
    			
    		 }
    
    		 else if(skeleton.eTrackingState == NUI_SKELETON_POSITION_ONLY)
    		 {			 
    			dwTrackingIDs[0] = skeleton.dwTrackingID;
    			dwTrackingIDs[1] = 0;
    		 }
    		 if (dwTrackingIDs[0] > 0)
    		 {
    			m_pNuiSensor->NuiSkeletonSetTrackedSkeletons(dwTrackingIDs); // Track this skeleton
    		 }
    	 }
    	//m_pNuiSensor->NuiSkeletonSetTrackedSkeletons(dwTrackingIDs);
    
    	 
    }
    But here i m not able to lock the skeleton.Help pls...

    Regards,
    Sandhya.
    Last edited by Arjay; March 25th, 2013 at 01:10 PM. Reason: Changed code tags to use brackets instead of arrows

  2. #2
    Arjay's Avatar
    Arjay is online now Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,479

    Re: How to lock in a single skeleton in Microsoft Kinect SDK v 1.7 using vc++?

    Two things to try (not an expert in this area):
    1) Create an array with std::vector and dynamically pass in valid id values. Your approach creates a fixed array which contains some zero values (which may be okay).
    2) Check the return value from NuiSkeletonSetTrackedSkeletons and see if the method returns an error.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center