1 2 Previous Next 21 Replies Latest reply on Feb 1, 2017 3:26 PM by slsuperrabbit

    queryNumJoints() only returns 0

    michael5486

      Hi,

      I am currently working with the Person Tracking Module using an R200. The personTracking module works successfully, and I can successfully query features like centerMass. However, querying skeleton joints has not been working. To start, I queried the number of joints that my module was currently configured to track.

       

      PXCPersonTrackingData::PersonTracking* personTracking = personData->QueryTracking();

       

      PXCPersonTrackingData::PersonJoints * ptj = personData->QuerySkeletonJoints();
      int numJoints = ptj->QueryNumJoints();
      printf("numJoints: %d ", numJoints);


      The above code outputs 0, no matter which tracking area is selected (AREA_FULL_BODY, AREA_FULL_BODY_ROUGH, AREA_UPPER_BODY, and AREA_UPPER_BODY_ROUGH). Has anyone gotten queryNumJoints to successfully return the number of joints being tracked?

       

      Michael

        • 1. Re: queryNumJoints() only returns 0
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hello Michael,

          Thanks for reaching out!

          May I ask, which SDK version are you using? Also, have you already tried running the example found in https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?doc_pt_tracking_joints.html. If so, how did it go? Does it also returns 0?

          Let me know.
          -Peter.

          • 2. Re: queryNumJoints() only returns 0
            michael5486

            Hi Peter,

             

            I am using the 2016 R2 SDK. I tried your link, and am still only getting the function to return 0. I used the example you provided, and ended up with the following code:

             

            /* Enabling skeleton joint tracking */
            PXCPersonTrackingConfiguration* personTrackingConfig = pp->QueryPersonTracking()->QueryConfiguration();
            personTrackingConfig->SetTrackedAngles(PXCPersonTrackingConfiguration::TrackingAngles::TRACKING_ANGLES_ALL);
            PXCPersonTrackingConfiguration::SkeletonJointsConfiguration* skeletonJoints = personTrackingConfig->QuerySkeletonJoints();
            skeletonJoints->Enable();
            printf("is jointTracking Enabled?: %d\n", skeletonJoints->IsEnabled());

            ...

            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* ptj = personData->QuerySkeletonJoints();
            int numJoints = ptj->QueryNumJoints();
            printf("numJoints: %d ", numJoints);
            }

             

            It states that joint tracking is enabled, but continues to loop through and print that there were 0 joints found.

             

            Michael

            • 3. Re: queryNumJoints() only returns 0
              michael5486

              Ok, so I've been experimented with the Person Tracking example included in the SDK example library. I attached a console to the GUI, and have been able to reverse engineer some important details. The example, for starters, has working skeleton tracking with 6 points. I can explain what I have found a little more if anyone needs it, but for now I'll just list the joints I was able to uncover:

                   JOINT_HEAD

                   JOINT_LEFT_SHOULDER

                   JOINT_RIGHT_SHOULDER

                   JOINT_LEFT_HAND

                   JOINT_RIGHT_HAND

                   JOINT_SPINE_MID

               

              While this is nowhere close to the number of points mentioned in the documentation, it should work for my purposes. The example code has a working queryNumJoints function--it returns 6. It also has a working queryJoints function...something that I have so far been unable to port into my own code. In the picture below, you can see that I have been able to access the 6 skeleton joints and their respective members inside the example code.

              jointTypesCoords.png

               

              So, it is nice to see that there is a working evidence of skeleton joints tracking. However, I cannot figure out how to enable it in my own programs and the online documentation frankly sucks. I cannot figure out the right combination/ordering of method required to enable skeletonJoint tracking. The example code bring up another function, setTrackingMode(), that was not even mentioned in the SDK documentation and seems to be necessary to function. Is there anyone on your end that can explain or provide a working piece of code to track these 6 functions and that doesn't come cluttered with a massive GUI?

               

              Thanks,

               

              Michael

              • 4. Re: queryNumJoints() only returns 0
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Michael,

                I understand, this is a strange behavior. Please let me investigate about this and if I'm able to find something useful, I'll make sure to share it with you.

                Nevertheless, I would like to point out that setTrackingMode is actually found on the SDK documentation. It can be found in https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?settrackingmode_pxcfaceconfiguration.html.

                -Peter.

                1 of 2 people found this helpful
                • 5. Re: queryNumJoints() only returns 0
                  michael5486

                  OK, thanks for the help!

                  • 6. Re: queryNumJoints() only returns 0
                    Intel Corporation
                    This message was posted on behalf of Intel Corporation

                    Hi Michael,

                    Thank you for your patience, I understand this could be frustrating. We will try to get a simplified code snippet that works for tracking joints from RealSense developers but I cannot promise if and when we will be able to get the code. 

                    I will get back to you once I have an update.
                    -Peter.

                    • 7. Re: queryNumJoints() only returns 0
                      Srags234

                      Hello Michael and Peter, I am also having this same issue. The example in the SDK is able to identify six of the joints. First, I must say I'm disappointed in the marketing and documentation which led me to believe that the R200 device had greater joint tracking capabilities. The device is impressive nonetheless.

                      With that aside, QueryNumJoints() returns a value of 0 in my program as well. While perusing the SDK source files, I noticed the variable joints is both a member variable of the PersonTrackingRenderer2D class as well as a variable defined separately as:

                       

                      if (!joints)

                        {

                        joints = new PXCPersonTrackingData::PersonJoints::SkeletonPoint[personJoints->QueryNumJoints()];

                        }

                        personJoints->QueryJoints(joints);

                       

                      This variable can be used exclusively to plot the location of the known joints within the DrawSkeleton method of the aforementioned class. Perhaps, Peter, you can clear up this ambiguity to help us out. Furthermore, there is some level of redundancy in accessing joint position data. Do you have suggestions on the best way to access this information?

                       

                      Thank you,

                      Sragvi

                      • 8. Re: queryNumJoints() only returns 0
                        MartyG

                        I remembered that a couple of people on the old RealSense forum had this returning-zero issue, so I dug out the links as a reference source.

                         

                        RealSense R200: How resolve call to QueryJoints (C#) causing exception?

                         

                        Skeleton Joint Data Available?

                         

                        Issue with SkeletonPoint

                        1 of 1 people found this helpful
                        • 9. Re: queryNumJoints() only returns 0
                          Kamalraj

                          Skeleton tracking will work only when tracking mode is set to Interactive (It is not mentioned in the documentation ) and also you must enable skeleton tracking (by default skeleton tracking is disabled)

                          here is my code (tested with R200 and SDK R2)

                           

                          int wmain(int argc,WCHAR* argv[])

                          {

                            PXCSenseManager *sm = PXCSenseManager::CreateInstance();

                            PXCPersonTrackingData::PersonJoints::SkeletonPoint* joints;

                            sm->EnablePersonTracking();

                            PXCPersonTrackingModule *tracker = sm->QueryPersonTracking();

                            sm->Init();

                            PXCPersonTrackingConfiguration *config = tracker->QueryConfiguration();

                            PXCPersonTrackingData *PersonData = tracker->QueryOutput();

                            config->QuerySkeletonJoints()->Enable();

                          config->QueryTracking()->SetTrackingMode(PXCPersonTrackingConfiguration::TrackingConfiguration::TRACKING_MODE_INTERACTIVE);

                            while (sm->AcquireFrame(true) >= PXC_STATUS_NO_ERROR)

                            {

                            pxcI32 npersons = PersonData->QueryNumberOfPeople();

                            for (pxcI32 i = 0; i < npersons; i++)

                            {

                            PXCPersonTrackingData::Person *Person = PersonData->QueryPersonData(PXCPersonTrackingData::ACCESS_ORDER_BY_ID, i);

                            PXCPersonTrackingData::PersonTracking *ptt = Person->QueryTracking();

                            PXCPersonTrackingData::PersonJoints *PersonJoint = Person->QuerySkeletonJoints();

                            pxcI32 numJoints = PersonJoint->QueryNumJoints();

                            joints = new PXCPersonTrackingData::PersonJoints::SkeletonPoint[numJoints];

                            PersonJoint->QueryJoints(joints);

                            wprintf(L"no.of joints : %d", numJoints);

                            }

                            wprintf(L"\nno.of person : %d\n", npersons);

                            sm->ReleaseFrame();

                            }

                            sm->Release();

                              return 0;

                          }

                          3 of 3 people found this helpful
                          • 10. Re: queryNumJoints() only returns 0
                            MartyG

                            Thanks so much for the info, Kamalraj

                            • 11. Re: queryNumJoints() only returns 0
                              slsuperrabbit

                              I found that there is not SetTrackingMode function in C#. Neither in C# project nor in Unity project. Any idea?

                              • 12. Re: queryNumJoints() only returns 0
                                MartyG

                                Whilst there is not a SetTrackingMode function in the RealSense online documentation pages for C# UWP, you can click on the C# tab to get code in ordinary C#.  UWP stands for Universal Windows Platform.  So you only need to use the UWP version instead of ordinary C# if you want to develop a single universal Windows app for all types of Microsoft-supported devices, including phone, Surface tablet, HoloLens headset and Xbox console.

                                 

                                Intel® RealSense™ SDK 2016 R2 Documentation

                                • 13. Re: queryNumJoints() only returns 0
                                  slsuperrabbit

                                  Hi, MartyG, thanks for your reply. I need to make me more clear. I can not find the SetTrackingMode function in the SDK. Such as :

                                                  ptc.QueryTracking().Enable();

                                                  ptc.QueryTracking().SetTrackingMode();

                                  There will be error: PXCMPersonTrackingConfiguration.TrackingConfiguration does not contain a definition for "SetTrackingMode".

                                  I install the RealSense SDK 2016 R2, and import it into Unity 3D, as 8 Steps to Add Intel RealSense Unity Toolkit to your Project | Intel® Software

                                  • 14. Re: queryNumJoints() only returns 0
                                    MartyG

                                    That guide is a couple of years old and the SDK has gone through about 5 different versions since then.  I suspect though that your error may be related to Unity, if you have followed that guide.  Although the procedure for copying RealSense DLL files into a Unity project was correct at the time, things changed when Unity 5 was introduced.

                                     

                                    Up until Unity 4 Pro, Unity was based on 32-bit code.  After Unity 5, Unity switched to 64-bit code and so the 32-bit RealSense library files placed in the Plugins and Plugins. Managed folders by the Unity Toolkit were no longer compatible.  You need to ensure that these folders have the 64-bit versions of the RealSense files, as you cannot rely on the Unity Toolkit to do it properly automatically.

                                     

                                    Go to the Plugins and Plugins.Managed folders in your project and delete their contents (libpxccpp2c.dll and libpxcclr.unity.dll).

                                     

                                    Then go to C:\Program Files (x86)\Intel\RSSDK\bin\x64 (which is the location for the 64-bit version of files) and from this directory, copy libpxccpp2c.dll into Plugins and libpxcclr.unity.dll into Plugins.Managed.  The filenames are the same, they are just the 64-bit version of the files that Unity 5 requires.

                                     

                                    The rest of the Unity Toolkit files do not need to be changed.

                                     

                                    Please comment here again if you still have problems.

                                    1 2 Previous Next