Closed michael5486 closed 7 years ago
Output from example program that shows the info gathered from my joints in the live feed. So it works, but I haven't been able to get it to work in my own project. Something has to be wrong with the initialization or skeleton joint tracking, but still working on it.
/* Enabling skeleton joint tracking */
PXCPersonTrackingModule* personModule = pp->QueryPersonTracking();
PXCPersonTrackingConfiguration* personTrackingConfig = personModule->QueryConfiguration();
// personTrackingConfig->SetTrackedAngles(PXCPersonTrackingConfiguration::TrackingAngles::TRACKING_ANGLES_ALL);
personTrackingConfig->QueryTracking()->SetTrackingMode(PXCPersonTrackingConfiguration::TrackingConfiguration::TRACKING_MODE_INTERACTIVE);
PXCPersonTrackingConfiguration::SkeletonJointsConfiguration* skeletonJoints = personTrackingConfig->QuerySkeletonJoints();
skeletonJoints->Enable();
printf("is jointTracking Enabled?: %d\n", skeletonJoints->IsEnabled());
printf("Initializing stream...");
/* Stream Data */
while (true) {
/* Waits until new frame is available and locks it for application processing */
sts = pp->AcquireFrame(false);
/* Render streams*/
PXCCapture::Sample *sample = pp->QuerySample();
//PXCCapture::Sample *sample = pp->QueryPersonTrackingSample();
if (sample) {
//printf("running");
PXCPersonTrackingModule* personModule = pp->QueryPersonTracking();
/* If no persons are visible, renders and releases current frame */
if (personModule == NULL) {
if (sample->depth && !renderd.RenderFrame(sample->depth)) break;
if (sample->color && !renderc.RenderFrame(sample->color)) break;
pp->ReleaseFrame();
continue;
}
int numPeople = personModule->QueryOutput()->QueryNumberOfPeople();
/* Found a person */
if (numPeople != 0) {
printf("Number of people: %d\n", numPeople);
PXCPersonTrackingData::Person* personData = personModule->QueryOutput()->QueryPersonData(PXCPersonTrackingData::ACCESS_ORDER_BY_ID, 0);
assert(personData != NULL);
PXCPersonTrackingData::PersonJoints* personJoints = personData->QuerySkeletonJoints();
//numJoints = ptj->QueryNumJoints();
pxcI32 numPoints = personJoints->QueryNumJoints();
int n = numPoints;
printf("numJoints: 0x%08x ", n);
PXCPersonTrackingData::PersonJoints::SkeletonPoint* jointPoints = new PXCPersonTrackingData::PersonJoints::SkeletonPoint[6];
// printf(" Type: %d, confidenceImage:%d\n", jointPoints[0].jointType, jointPoints[0].confidenceImage);
personJoints->QueryJoints(jointPoints);
printf(" Type: %d, confidenceImage:%d x: %f y: %f\n", jointPoints[0].jointType, jointPoints[0].confidenceImage, jointPoints[0].image.x, jointPoints[0].image.y);
delete[] jointPoints;
}
}
(I've been playing with markdown formatting, sorry)
Skeleton Joint tracking works now
Next step is getting joint tracking to work with the SDK. So far, two functions, queryNumJoints() and queryJoints(), are not working right. They are supposed to return joint information gathered by the SDK. They are only spitting out gibberish. However, I have an example project that does have working joint tracking, and I can access the individual joint member variables like x, y, z and confidence values...just haven't figured out how to do that yet.