示例#1
0
        public static FubiUtils.RecognitionResult getCombinationRecognitionProgressOn(string recognizerName, UInt32 userID, out FubiTrackingData[] userStates, bool restart = true)
        {
            IntPtr vec     = FubiInternal.createTrackingDataVector();
            IntPtr namePtr = Marshal.StringToHGlobalAnsi(recognizerName);

            FubiUtils.RecognitionResult recognized = FubiInternal.getCombinationRecognitionProgressOn(namePtr, userID, vec, restart);
            Marshal.FreeHGlobal(namePtr);
            if (recognized == FubiUtils.RecognitionResult.RECOGNIZED)
            {
                UInt32 size = FubiInternal.getTrackingDataVectorSize(vec);
                userStates = new FubiTrackingData[size];
                for (UInt32 i = 0; i < size; i++)
                {
                    IntPtr           tInfo = FubiInternal.getTrackingData(vec, i);
                    FubiTrackingData info  = new FubiTrackingData();
                    for (UInt32 j = 0; j < (uint)FubiUtils.SkeletonJoint.NUM_JOINTS; ++j)
                    {
                        FubiInternal.getSkeletonJointPosition(tInfo, (FubiUtils.SkeletonJoint)j, out info.jointPositions[j].x, out info.jointPositions[j].y, out info.jointPositions[j].z, out info.jointPositions[j].confidence, out info.timeStamp);
                        double timeStamp = 0;
                        FubiInternal.getSkeletonJointOrientation(tInfo, (FubiUtils.SkeletonJoint)j, info.jointOrientations[j].rotMat, out info.jointPositions[j].confidence, out timeStamp);
                        info.timeStamp = Math.Max(timeStamp, info.timeStamp);
                    }
                    userStates[i] = info;
                }
            }
            else
            {
                userStates = null;
            }

            FubiInternal.releaseTrackingDataVector(vec);
            return(recognized);
        }
示例#2
0
        public static void getCurrentSkeletonJointPosition(UInt32 userID, FubiUtils.SkeletonJoint joint, out float x, out float y, out float z, out float confidence, out double timeStamp, bool useLocalPositions = false)
        {
            IntPtr info = FubiInternal.getCurrentTrackingData(userID);

            FubiInternal.getSkeletonJointPosition(info, joint, out x, out y, out z, out confidence, out timeStamp, useLocalPositions);
        }