private static float ChangeInMotion(Dictionary <JointType, Joint> currentJoints, Dictionary <JointType, Joint> prevJoints)
        {
            float totalDistance = 0;

            foreach (JointType type in Enum.GetValues(typeof(JointType)))
            {
                totalDistance += LinearAlgebra.DistanceBetweenTwoPoints(currentJoints[type].Position, prevJoints[type].Position);
            }
            float result = totalDistance / 25;

            return(result);
        }
Пример #2
0
        //public static CameraSpacePoint PointProjectionIntoPlane(CameraSpacePoint point, CameraSpacePoint planeNormal)
        //{
        //    float x = point.X;
        //    float y = point.Y;
        //    float z = point.Z;

        //    float a = planeNormal.X;
        //    float b = planeNormal.Y;
        //    float c = planeNormal.Z;

        //    float t = (a*)
        //}

        public static Planes GetPlanes(Dictionary <JointType, Joint> joints)
        {
            CameraSpacePoint spineBase = joints[JointType.SpineBase].Position;
            CameraSpacePoint spineMid  = joints[JointType.SpineMid].Position;

            CameraSpacePoint horizontalPlane = LinearAlgebra.Sub(spineMid, spineBase);
            CameraSpacePoint hipToHip        = LinearAlgebra.Sub(joints[JointType.HipLeft].Position, joints[JointType.HipRight].Position); // difference between both hips
            CameraSpacePoint sagittalPlane   = LinearAlgebra.CrossProduct(horizontalPlane, hipToHip);
            CameraSpacePoint frontalPlane    = LinearAlgebra.CrossProduct(horizontalPlane, sagittalPlane);


            Planes plane = new Planes(horizontalPlane, sagittalPlane, frontalPlane);

            return(new Planes(horizontalPlane, sagittalPlane, frontalPlane));;
        }
Пример #3
0
        private List <float> GetAnkleDistancesFromEachOther(JointsList jointsList)
        {
            var footDistances = new List <float>();

            foreach (var joints in jointsList)
            {
                CameraSpacePoint leftAnkle  = joints[JointType.AnkleLeft].Position;
                CameraSpacePoint rightAnkle = joints[JointType.AnkleRight].Position;

                float footDist = LinearAlgebra.DistanceBetweenTwoPoints(leftAnkle, rightAnkle);

                footDistances.Add(footDist);
            }

            return(footDistances);
        }
Пример #4
0
        static void WriteCSV(List <CameraSpacePoint> values, string filename = "output")
        {
            List <string> lines = new List <string>();
            int           i     = 0;

            foreach (CameraSpacePoint value in values)
            {
                CameraSpacePoint pos = LinearAlgebra.Scale(value, 1);
                string           x   = pos.X.ToString().Replace(',', '.');
                string           y   = pos.Y.ToString().Replace(',', '.');
                string           z   = pos.Z.ToString().Replace(',', '.');
                lines.Add(String.Format("{0},{1},{2}", x, y, z));
                i += 1;
            }

            File.WriteAllLines(filename + ".csv", lines);
        }
Пример #5
0
        public static float GetDistanceFromPlane(CameraSpacePoint point, CameraSpacePoint planePos, CameraSpacePoint normal)
        {
            float dist = LinearAlgebra.DotProduct(normal, (LinearAlgebra.Sub(point, planePos)));

            return(dist);
        }