コード例 #1
0
        /// <summary>
        /// 搜集抬脚高度
        /// </summary>
        /// <param name="body">当前身体</param>
        /// <param name="bf">当前骨骼帧</param>
        public static void CollectFootHeight(Body body, BodyFrame bf)
        {
            //收集左脚与右脚点数
            IReadOnlyDictionary <JointType, Joint> joints = body.Joints;
            CameraSpacePoint LeftFoot  = joints[JointType.AnkleLeft].Position;
            CameraSpacePoint RightFoot = joints[JointType.AnkleRight].Position;

            //计算离地高度添加到队列
            LeftFootHeight.Add(BuTai.distancetoFloor(LeftFoot, bf));
            RightFootHeight.Add(BuTai.distancetoFloor(RightFoot, bf));
        }
コード例 #2
0
        ///<summary>
        ///collect the height of NSU
        ///<param name = "body"/>current body</param>
        ///<param neme = "bf"/>current skeleton</param>
        ///</summary>
        public static void CollectNSUheight(Body body, BodyFrame bf)
        {
            //whether it is the first time
            d1 = DateTime.Now;

            IReadOnlyDictionary <JointType, Joint> joints = body.Joints;
            CameraSpacePoint Neck = joints[JointType.Neck].Position;

            //calculate the height of Neck and add it to the queue
            NSUheight.Add(BuTai.distancetoFloor(Neck, bf));
            NSUtime.Add(d1);
        }
コード例 #3
0
        /// <summary>
        /// 实时显示步态参数
        /// </summary>
        /// <param name="body">当前人体</param>
        /// <param name="fe">当前骨骼帧</param>
        public void changBuTaiLabels(Body body, BodyFrame fe)
        {
            //取得6个骨骼点坐标和时间
            Queue <Object>   e          = butai.getBuTaiData(body);
            CameraSpacePoint bonePoint1 = (CameraSpacePoint)e.Dequeue();
            CameraSpacePoint bonePoint2 = (CameraSpacePoint)e.Dequeue();
            CameraSpacePoint bonePoint3 = (CameraSpacePoint)e.Dequeue();
            CameraSpacePoint bonePoint4 = (CameraSpacePoint)e.Dequeue();
            CameraSpacePoint bonePoint5 = (CameraSpacePoint)e.Dequeue();
            CameraSpacePoint bonePoint6 = (CameraSpacePoint)e.Dequeue();
            DateTime         dt         = (DateTime)e.Dequeue();
            TimeSpan         tp         = (TimeSpan)e.Dequeue();

            //显示实时左步长和右步长
            double StepLength      = bonePoint1.Z - bonePoint2.Z;
            double leftstepLength  = 0;
            double rightstepLength = 0;

            if (StepLength > 0)
            {
                this.RightStepLengthLabel.Content = "右步长:" + Math.Round(Math.Abs(StepLength), 4);
                rightstepLength = StepLength;
                leftstepLength  = 0;
            }
            else
            {
                this.LeftStepLengthLabel.Content = "左步长:" + Math.Round(Math.Abs(StepLength), 4);
                leftstepLength  = StepLength;
                rightstepLength = 0;
            }

            //实时显示左步高和右步高
            double leftstepHeight  = BuTai.distancetoFloor(bonePoint3, fe);
            double rightstepHeight = BuTai.distancetoFloor(bonePoint4, fe);

            this.LeftStepHeightLabel.Content  = "左步高:" + Math.Round(leftstepHeight, 4);
            this.RightStepHeightLabel.Content = "右步高:" + Math.Round(rightstepHeight, 4);

            //实时显示步宽
            double stepwidth = Math.Sqrt(Math.Abs(bonePoint1.X - bonePoint2.X));

            this.StepWidthLabel.Content = "步宽:" + Math.Round(stepwidth, 4);

            //将结果储存起来
            butai.setResultData(stepwidth, leftstepLength, rightstepLength, leftstepHeight, rightstepHeight, dt);
            butai.setElementData(bonePoint1, bonePoint2, bonePoint3, bonePoint4, bonePoint5, bonePoint6);
        }