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.
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.