示例#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 getCurrentSkeletonJointOrientation(UInt32 userID, FubiUtils.SkeletonJoint joint, float[] mat, out float confidence, out double timeStamp)
        {
            IntPtr info = FubiInternal.getCurrentTrackingData(userID);

            if (info.ToInt32() != 0)
            {
                FubiInternal.getSkeletonJointOrientation(info, joint, mat, out confidence, out timeStamp);
            }
            else
            {
                mat        = new float[] { 1, 0, 0, 0, 1, 0, 0, 0, 1 };
                confidence = 0;
                timeStamp  = 0;
            }
        }