示例#1
0
        public void updateData(PXCMHandData.IHand handData)
        {
            this.handJoint = new PXCMHandData.JointData[22];



            var jointTypes = Enum.GetValues(typeof(PXCMHandData.JointType)).Cast <PXCMHandData.JointType>();

            int index = 0;

            foreach (var jtmp in jointTypes)
            {
                PXCMHandData.JointData jdata = null;
                handData.QueryTrackedJoint(jtmp, out jdata);
                handJoint[index] = jdata;
                index++;
            }

            index = 0;

            this.handFinger = new PXCMHandData.FingerData[5];
            var fingerTypes = Enum.GetValues(typeof(PXCMHandData.FingerType)).Cast <PXCMHandData.FingerType>();

            foreach (var fmp in fingerTypes)
            {
                PXCMHandData.FingerData fdata = null;
                handData.QueryFingerData(fmp, out fdata);
                handFinger[index] = fdata;
                index++;
            }

            this.handContourInner = new List <PXCMPointI32[]>();
            this.handContourOuter = new List <PXCMPointI32[]>();
            int contourNumber = handData.QueryNumberOfContours();

            if (contourNumber > 0)
            {
                PXCMPointI32[] pointOuter;
                PXCMPointI32[] pointInner;
                for (int k = 0; k < contourNumber; ++k)
                {
                    PXCMHandData.IContour contour;
                    pxcmStatus            sts = handData.QueryContour(k, out contour);
                    if (sts == pxcmStatus.PXCM_STATUS_NO_ERROR)
                    {
                        if (contour.IsOuter() == true)
                        {
                            contour.QueryPoints(out pointOuter);
                            handContourOuter.Add(pointOuter);
                        }
                        else
                        {
                            contour.QueryPoints(out pointInner);
                            handContourInner.Add(pointInner);
                        }
                    }
                }
            }
        }