Example #1
0
        // get angle from 2 points 3D and a plane XOY, YOZ, XOZ
        public static double getAngle(Point3D A, Point3D B, Constants.planeType _type)
        {
            Line3D line = new Line3D(A, B);
            Plane3D plane = new Plane3D(_type);

            return (180 / 3.14) * Math.Asin((Math.Abs(plane.getA() * line.getL() + plane.getB() * line.getM() + plane.getC() * line.getN()))
                    / (Math.Sqrt(line.getL() * line.getL() + line.getM() * line.getM() + line.getN() * line.getN()) * Math.Sqrt(plane.getA() * plane.getA() + plane.getB() * plane.getB() + plane.getC() * plane.getC())));
        }
Example #2
0
        public Line3D(Point3D A, Point3D B)
        {
            x0 = A.getX();
            l = B.getX() - A.getX();

            y0 = A.getY();
            m = B.getY() - A.getY();

            z0 = A.getZ();
            n = B.getZ() - A.getZ();
        }
Example #3
0
     // get angle from three 3D points
     public static double getAngle(Point3D A, Point3D B, Point3D C) {
     double AB = Math.Sqrt(
                     Math.Pow(B.getX() - A.getX(),2) +
                     Math.Pow(B.getY() - A.getY(),2) + 
                     Math.Pow(B.getZ() - A.getZ(),2));
     
     double BC = Math.Sqrt(
                     Math.Pow(C.getX() - B.getX(),2) +
                     Math.Pow(C.getY() - B.getY(),2) + 
                     Math.Pow(C.getZ() - B.getZ(),2));
     
     double CA = Math.Sqrt(
                     Math.Pow(A.getX() - C.getX(),2) +
                     Math.Pow(A.getY() - C.getY(),2) + 
                     Math.Pow(A.getZ() - C.getZ(),2));
     
     if ((-Math.Pow(CA, 2) + Math.Pow(AB, 2) + Math.Pow(BC, 2)) / ( 2 * AB * BC) < -1 ||
             (-Math.Pow(CA, 2) + Math.Pow(AB, 2) + Math.Pow(BC, 2)) / ( 2 * AB * BC) > 1)
         Console.WriteLine("!!" + (-Math.Pow(CA, 2) + Math.Pow(AB, 2) + Math.Pow(BC, 2)) / ( 2 * AB * BC));
     
     return (180/3.14) * Math.Acos((-Math.Pow(CA, 2) + Math.Pow(AB, 2) + Math.Pow(BC, 2)) / ( 2 * AB * BC) );
     
 }
        private void nui_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {

            SkeletonFrame skeletonFrame = e.SkeletonFrame;
            //tw = new StreamWriter("date.txt", true);
            //KinectSDK TODO: this shouldn't be needed, but if Power is removed from the Kinect, you may still get an event here, but skeletonFrame will be null.
            if (skeletonFrame == null)
            {
                return;
            }

            int iSkeleton = 0;
            Brush[] brushes = new Brush[6];
            brushes[0] = new SolidColorBrush(Color.FromRgb(255, 0, 0));
            brushes[1] = new SolidColorBrush(Color.FromRgb(0, 255, 0));
            brushes[2] = new SolidColorBrush(Color.FromRgb(64, 255, 255));
            brushes[3] = new SolidColorBrush(Color.FromRgb(255, 255, 64));
            brushes[4] = new SolidColorBrush(Color.FromRgb(255, 64, 255));
            brushes[5] = new SolidColorBrush(Color.FromRgb(128, 128, 255));

            skeletonCanvas.Children.Clear();

            foreach (SkeletonData data in skeletonFrame.Skeletons)
            {
                if (SkeletonTrackingState.Tracked == data.TrackingState)
                {
                    // Draw bones
                    Brush brush = brushes[iSkeleton % brushes.Length];
                    skeletonCanvas.Children.Add(getBodySegment(data.Joints, brush, JointID.HipCenter, JointID.Spine, JointID.ShoulderCenter, JointID.Head));
                    skeletonCanvas.Children.Add(getBodySegment(data.Joints, brush, JointID.ShoulderCenter, JointID.ShoulderLeft, JointID.ElbowLeft, JointID.WristLeft, JointID.HandLeft));
                    skeletonCanvas.Children.Add(getBodySegment(data.Joints, brush, JointID.ShoulderCenter, JointID.ShoulderRight, JointID.ElbowRight, JointID.WristRight, JointID.HandRight));
                    skeletonCanvas.Children.Add(getBodySegment(data.Joints, brush, JointID.HipCenter, JointID.HipLeft, JointID.KneeLeft, JointID.AnkleLeft, JointID.FootLeft));
                    skeletonCanvas.Children.Add(getBodySegment(data.Joints, brush, JointID.HipCenter, JointID.HipRight, JointID.KneeRight, JointID.AnkleRight, JointID.FootRight));

                    // Draw joints
                    //tw.WriteLine("");

                    Point3D[] points = new Point3D[20];
                    foreach (Joint joint in data.Joints)
                    {
                        //tw.WriteLine(joint.Position.X + " " + joint.Position.Y + " " + joint.Position.Z);
                        Point jointPos = getDisplayPosition(joint);
                        Line jointLine = new Line();
                        jointLine.X1 = jointPos.X - 3;
                        jointLine.X2 = jointLine.X1 + 6;
                        jointLine.Y1 = jointLine.Y2 = jointPos.Y;
                        jointLine.Stroke = jointColors[joint.ID];
                        jointLine.StrokeThickness = 6;
                        skeletonCanvas.Children.Add(jointLine);
                        points[(int)joint.ID] = new Point3D(joint.Position.X, joint.Position.Y, joint.Position.Z);

                    }

                    if (b1.IsEnabled == false)
                    {
                        // get position for each body part
                        // BODY
                        Example bodyExample = new Example();
                        double angle = GeometryUtils.getAngle(points[2], points[1], points[13]);
                        bodyExample.add("A.2.1.13", angle);
                        angle = GeometryUtils.getAngle(points[2], points[1], points[17]);
                        bodyExample.add("A.2.1.17", angle);
                        angle = GeometryUtils.getAngle(points[1], points[2], Constants.planeType.XOY);
                        bodyExample.add("A.1.2.XoY", angle);
                        angle = GeometryUtils.getAngle(points[1], points[2], Constants.planeType.YOZ);
                        bodyExample.add("A.1.2.YoZ", angle);

                        // LEFT HAND
                        Example leftHandExample = new Example();
                        angle = GeometryUtils.getAngle(points[4], points[5], Constants.planeType.XOY);
                        leftHandExample.add("A.4.5.XoY", angle);
                        angle = GeometryUtils.getAngle(points[4], points[5], Constants.planeType.YOZ);
                        leftHandExample.add("A.4.5.YoZ", angle);
                        angle = points[4].getY() - points[5].getY();
                        leftHandExample.add("D.4y.5y", angle);

                        Example rightHandExample = new Example();
                        angle = GeometryUtils.getAngle(points[8], points[9], Constants.planeType.XOY);
                        rightHandExample.add("A.8.9.XoY", angle);
                        angle = GeometryUtils.getAngle(points[8], points[9], Constants.planeType.YOZ);
                        rightHandExample.add("A.8.9.YoZ", angle);
                        angle = points[8].getY() - points[9].getY();
                        rightHandExample.add("D.8y.9y", angle);

                        Example leftLegExample = new Example();
                        angle = GeometryUtils.getAngle(points[12], points[13], points[14]);
                        leftLegExample.add("A.12.13.14", angle);
                        angle = GeometryUtils.getAngle(points[13], points[14], Constants.planeType.XOY);
                        leftLegExample.add("A.13.14.XoY", angle);
                        angle = GeometryUtils.getAngle(points[13], points[14], Constants.planeType.YOZ);
                        leftLegExample.add("A.13.14.YoZ", angle);

                        Example rightLegExample = new Example();
                        angle = GeometryUtils.getAngle(points[16], points[17], points[18]);
                        rightLegExample.add("A.16.17.18", angle);
                        angle = GeometryUtils.getAngle(points[17], points[18], Constants.planeType.XOY);
                        rightLegExample.add("A.17.18.XoY", angle);
                        angle = GeometryUtils.getAngle(points[17], points[18], Constants.planeType.YOZ);
                        rightLegExample.add("A.17.18.YoZ", angle);
                        rightLegPositionText.Text = DTUtils.findValueInTree(rightLegDT, rightLegExample);

                        String bodyPosition = DTUtils.findValueInTree(bodyDT, bodyExample);
                        String leftHandPosition = DTUtils.findValueInTree(leftHandDT, leftHandExample);
                        String rightHandPosition = DTUtils.findValueInTree(rightHandDT, rightHandExample);
                        String leftLegPosition = DTUtils.findValueInTree(leftLegDT, leftLegExample);
                        String rightLegPosition = DTUtils.findValueInTree(rightLegDT, rightLegExample);

                        if (contor < Constants.SnapshotFrequency)
                        {
                            bodyCommonPosition.Add(bodyPosition);
                            rightHandCommonPosition.Add(rightHandPosition);
                            leftHandCommonPosition.Add(leftHandPosition);
                            rightLegCommonPosition.Add(rightLegPosition);
                            leftLegCommonPosition.Add(leftLegPosition);
                            contor++;
                        }
                        else
                        {
                            if (rightLegPosition.Equals("indoit") && leftLegPosition.Equals("indoit") && bodyPosition.Equals("aplecat frontal"))
                            {
                                bodyPositionText.Text = "spre ghemuire";
                            }
                            else
                            {
                                // get position and motion
                                bodyPositionText.Text = PositionUtils.getCommon(bodyCommonPosition);
                                if (bodyPositionText.Text.Equals("culcat") == true)
                                {
                                    leftHandPositionText.Text = "";
                                    rightHandPositionText.Text = "";
                                    leftLegPositionText.Text = "";
                                    rightLegPositionText.Text = "";

                                    bodyState = motionUtils.getNextBodyState(bodyState.getName(), bodyPositionText.Text);

                                    //bodyMotionText.Text = bodyState.getMotion();
                                    leftHandMotionText.Text = "";
                                    rightHandMotionText.Text = "";
                                    leftLegMotionText.Text = "";
                                    rightLegMotionText.Text = "";

                                    bodyCommonPosition = new List<string>();
                                    leftHandCommonPosition = new List<string>();
                                    rightHandCommonPosition = new List<string>();
                                    leftLegCommonPosition = new List<string>();
                                    rightLegCommonPosition = new List<string>();
                                }
                                else
                                {
                                    leftHandPositionText.Text = PositionUtils.getCommon(leftHandCommonPosition);
                                    rightHandPositionText.Text = PositionUtils.getCommon(rightHandCommonPosition);
                                    leftLegPositionText.Text = PositionUtils.getCommon(leftLegCommonPosition);
                                    rightLegPositionText.Text = PositionUtils.getCommon(rightLegCommonPosition);

                                    bodyState = motionUtils.getNextBodyState(bodyState.getName(), bodyPositionText.Text);
                                    leftHandState = motionUtils.getNextHandState(leftHandState.getName(), leftHandPositionText.Text);
                                    rightHandState = motionUtils.getNextHandState(rightHandState.getName(), rightHandPositionText.Text);
                                    leftLegState = motionUtils.getNextLegState(leftLegState.getName(), leftLegPositionText.Text);
                                    rightLegState = motionUtils.getNextLegState(rightLegState.getName(), rightLegPositionText.Text);

                                    bodyMotionText.Text = bodyState.getMotion();
                                    leftHandMotionText.Text = leftHandState.getMotion();
                                    rightHandMotionText.Text = rightHandState.getMotion();
                                    leftLegMotionText.Text = leftLegState.getMotion();
                                    rightLegMotionText.Text = rightLegState.getMotion();

                                    bodyCommonPosition = new List<string>();
                                    leftHandCommonPosition = new List<string>();
                                    rightHandCommonPosition = new List<string>();
                                    leftLegCommonPosition = new List<string>();
                                    rightLegCommonPosition = new List<string>();
                                }
                                // reset counter
                                contor = 0;
                            }
                        }
                    }
                }
                iSkeleton++;

            } // for each skeleton
            //tw.Close();
        }
Example #5
0
        public static List<Example> readRightHandTS() {
         // TRAIN RIGHT HAND PART...
        if (Constants.DEBUG) {
            // Attributes: A.8.9.XOY, A.8.9.YOZ, D.8y.9y
            Console.WriteLine("\n=====\tMANA DREAPTA =====");  
            Console.WriteLine("\tLanga corp");
        }
        StreamReader sr;
        String strLine;
        List<Example> rightHandTS = new List<Example>();
        
        double maxim1 = 0.0;
        double minim1 = 180.0;
        double average1 = 0.0;

        double maxim2 = 0.0;
        double minim2 = 180.0;
        double average2 = 0.0;

        double maxim3 = 0.0;
        double minim3 = 180.0;
        double average3 = 0.0;
        
        try {
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\msd\\langa corp.txt");
            double fileSize = 22323;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right  
                string[] words = strLine.Split(' ');
                Point3D P8 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 9:elbow right
                words = strLine.Split(' ');
                Point3D P9 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left                
                strLine = sr.ReadLine(); // 13:knee left
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.XOY);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.8.9.XoY", angle);
                
                angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.YOZ);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.8.9.YoZ", angle);
                
                angle = P8.getY() - P9.getY();
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("D.8y.9y", angle);
                
                example.setResult("langa corp");
                rightHandTS.Add(example);
            }    
            if (Constants.DEBUG) {
                Console.WriteLine("A.8.9.XOY:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.8.9.YOZ:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("D.8y.9y:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }
            
            //RIDICAT LATERAL
            if (Constants.DEBUG) {
                Console.WriteLine("\tRidicat lateral");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\msd\\ridicat lateral.txt");
            fileSize = 24444;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right  
                string[] words = strLine.Split(' ');
                Point3D P8 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 9:elbow right
                words = strLine.Split(' ');
                Point3D P9 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left                
                strLine = sr.ReadLine(); // 13:knee left
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.XOY);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.8.9.XoY", angle);
                
                angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.YOZ);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.8.9.YoZ", angle);
                
                angle = P8.getY() - P9.getY();
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("D.8y.9y", angle);
                
                example.setResult("ridicat lateral");
                rightHandTS.Add(example);
            }  
            if (Constants.DEBUG) {
                Console.WriteLine("A.8.9.XOY:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.8.9.YOZ:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("D.8y.9y:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }
            
            // RIDICAT SUS
            if (Constants.DEBUG) {
                Console.WriteLine("\tRidicat sus");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\msd\\ridicat sus.txt");
            fileSize = 14469;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right  
                string[] words = strLine.Split(' ');
                Point3D P8 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 9:elbow right
                words = strLine.Split(' ');
                Point3D P9 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left                
                strLine = sr.ReadLine(); // 13:knee left
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.XOY);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.8.9.XoY", angle);
                
                angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.YOZ);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.8.9.YoZ", angle);
                
                angle = P8.getY() - P9.getY();
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("D.8y.9y", angle);
                
                example.setResult("ridicat sus");
                rightHandTS.Add(example);
            }     
            if (Constants.DEBUG) {
                Console.WriteLine("A.8.9.XOY:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.8.9.YOZ:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("D.8y.9y:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }
            
            // RIDICAT FRONTAL
            if (Constants.DEBUG) {
                Console.WriteLine("\tRidicat frontal");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\msd\\ridicat frontal.txt");
            fileSize = 21567;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right  
                string[] words = strLine.Split(' ');
                Point3D P8 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 9:elbow right
                words = strLine.Split(' ');
                Point3D P9 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left                
                strLine = sr.ReadLine(); // 13:knee left
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.XOY);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.8.9.XoY", angle);
                
                angle = GeometryUtils.getAngle(P8,P9,Constants.planeType.YOZ);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.8.9.YoZ", angle);
                
                angle = P8.getY() - P9.getY();
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("D.8y.9y", angle);
                
                example.setResult("ridicat frontal");
                rightHandTS.Add(example);
            }       
            if (Constants.DEBUG) {
                Console.WriteLine("A.8.9.XOY:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.8.9.YOZ:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("D.8y.9y:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }
        }
        catch (Exception e) {Console.WriteLine(e);}
        
        return rightHandTS;
     }
Example #6
0
        public static List<Example> readRightLegTS() {
            if (Constants.DEBUG) {
                Console.WriteLine("\n=====\tPICIOR DREPT  =====");   
                // DREPT
                Console.WriteLine("\tDrept");
            }
            
            List<Example> rightLegTS = new List<Example>();
            StreamReader sr;
            String strLine;

            double maxim1 = 0.0;
            double minim1 = 180.0;
            double average1 = 0.0;

            double maxim2 = 0.0;
            double minim2 = 180.0;
            double average2 = 0.0;

            double maxim3 = 0.0;
            double minim3 = 180.0;
            double average3 = 0.0;

            double fileSize = 14133;
            try {
                sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mid\\drept.txt");

                for (int i=0; i<fileSize; i+=21) {  
                    strLine = sr.ReadLine(); // blank                
                    strLine = sr.ReadLine(); // 0:hipcenter   
                    strLine = sr.ReadLine(); // 1:spine
                    strLine = sr.ReadLine(); // 2:shoulder center
                    strLine = sr.ReadLine(); // 3:head                 
                    strLine = sr.ReadLine(); // 4:shoulder left                              
                    strLine = sr.ReadLine(); // 5:elbow left                
                    strLine = sr.ReadLine(); // 6:wrist left 
                    strLine = sr.ReadLine(); // 7:hand left
                    strLine = sr.ReadLine(); // 8:shoulder right               
                    strLine = sr.ReadLine(); // 9:elbow right
                    strLine = sr.ReadLine(); // 10:wrist right
                    strLine = sr.ReadLine(); // 11:hand right
                    strLine = sr.ReadLine(); // 12:hip left                
                    strLine = sr.ReadLine(); // 13:knee left
                    strLine = sr.ReadLine(); // 14:ankle left
                    strLine = sr.ReadLine(); // 15:foot left
                    strLine = sr.ReadLine(); // 16:hip right
                    string[] words = strLine.Split(' ');
                    Point3D P16 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 17:knee right   
                    words = strLine.Split(' ');
                    Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 18:ankle right
                    words = strLine.Split(' ');
                    Point3D P18 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 19:foot right

                    Example example = new Example();
                    
                    double angle = GeometryUtils.getAngle(P16,P17,P18);
                    if (maxim1 < angle)
                        maxim1 = angle;
                    if (minim1 > angle)
                        minim1 = angle;  
                    average1 += angle;  
                    example.add("A.16.17.18", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.XOY);
                    if (maxim2 < angle)
                        maxim2 = angle;
                    if (minim2 > angle)
                        minim2 = angle;  
                    average2 += angle;
                    example.add("A.17.18.XoY", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.YOZ);
                    if (maxim3 < angle)
                        maxim3 = angle;
                    if (minim3 > angle)
                        minim3 = angle;  
                    average3 += angle;
                    example.add("A.17.18.YoZ", angle);
                    
                    example.setResult("drept");
                    rightLegTS.Add(example);
                }   
                if (Constants.DEBUG) {
                    Console.WriteLine("A.16.17.18:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                    Console.WriteLine("A.17.18.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                    Console.WriteLine("A.17.18.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
                }
                
                // RIDICAT LATERAL
                if (Constants.DEBUG) {
                    Console.WriteLine("\tRidicat lateral");
                }
                sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mid\\ridicat lateral.txt");
                fileSize = 5859;

                maxim1 = 0.0;
                minim1 = 180.0;
                average1 = 0.0;

                maxim2 = 0.0;
                minim2 = 180.0;
                average2 = 0.0;

                maxim3 = 0.0;
                minim3 = 180.0;
                average3 = 0.0;

                for (int i=0; i<fileSize; i+=21) {  
                    strLine = sr.ReadLine(); // blank                
                    strLine = sr.ReadLine(); // 0:hipcenter   
                    strLine = sr.ReadLine(); // 1:spine
                    strLine = sr.ReadLine(); // 2:shoulder center
                    strLine = sr.ReadLine(); // 3:head                 
                    strLine = sr.ReadLine(); // 4:shoulder left                              
                    strLine = sr.ReadLine(); // 5:elbow left                
                    strLine = sr.ReadLine(); // 6:wrist left 
                    strLine = sr.ReadLine(); // 7:hand left
                    strLine = sr.ReadLine(); // 8:shoulder right               
                    strLine = sr.ReadLine(); // 9:elbow right
                    strLine = sr.ReadLine(); // 10:wrist right
                    strLine = sr.ReadLine(); // 11:hand right
                    strLine = sr.ReadLine(); // 12:hip left                
                    strLine = sr.ReadLine(); // 13:knee left
                    strLine = sr.ReadLine(); // 14:ankle left
                    strLine = sr.ReadLine(); // 15:foot left
                    strLine = sr.ReadLine(); // 16:hip right
                    string[] words = strLine.Split(' ');
                    Point3D P16 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 17:knee right   
                    words = strLine.Split(' ');
                    Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 18:ankle right
                    words = strLine.Split(' ');
                    Point3D P18 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 19:foot right

                    Example example = new Example();
                    
                    double angle = GeometryUtils.getAngle(P16,P17,P18);
                    if (maxim1 < angle)
                        maxim1 = angle;
                    if (minim1 > angle)
                        minim1 = angle;  
                    average1 += angle;  
                    example.add("A.16.17.18", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.XOY);
                    if (maxim2 < angle)
                        maxim2 = angle;
                    if (minim2 > angle)
                        minim2 = angle;  
                    average2 += angle;
                    example.add("A.17.18.XoY", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.YOZ);
                    if (maxim3 < angle)
                        maxim3 = angle;
                    if (minim3 > angle)
                        minim3 = angle;  
                    average3 += angle;
                    example.add("A.17.18.YoZ", angle);
                    
                    example.setResult("ridicat lateral");
                    rightLegTS.Add(example);
                }  
                if (Constants.DEBUG) {
                    Console.WriteLine("A.16.17.18:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                    Console.WriteLine("A.17.18.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                    Console.WriteLine("A.17.18.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
                }

                // RIDICAT FRONTAL
                if (Constants.DEBUG) {
                    Console.WriteLine("\tRidicat frontal");
                }
                sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mid\\ridicat frontal.txt");
                fileSize = 9870;

                maxim1 = 0.0;
                minim1 = 180.0;
                average1 = 0.0;

                maxim2 = 0.0;
                minim2 = 180.0;
                average2 = 0.0;

                maxim3 = 0.0;
                minim3 = 180.0;
                average3 = 0.0;

                for (int i=0; i<fileSize; i+=21) {  
                    strLine = sr.ReadLine(); // blank                
                    strLine = sr.ReadLine(); // 0:hipcenter   
                    strLine = sr.ReadLine(); // 1:spine
                    strLine = sr.ReadLine(); // 2:shoulder center
                    strLine = sr.ReadLine(); // 3:head                 
                    strLine = sr.ReadLine(); // 4:shoulder left                              
                    strLine = sr.ReadLine(); // 5:elbow left                
                    strLine = sr.ReadLine(); // 6:wrist left 
                    strLine = sr.ReadLine(); // 7:hand left
                    strLine = sr.ReadLine(); // 8:shoulder right               
                    strLine = sr.ReadLine(); // 9:elbow right
                    strLine = sr.ReadLine(); // 10:wrist right
                    strLine = sr.ReadLine(); // 11:hand right
                    strLine = sr.ReadLine(); // 12:hip left                
                    strLine = sr.ReadLine(); // 13:knee left
                    strLine = sr.ReadLine(); // 14:ankle left
                    strLine = sr.ReadLine(); // 15:foot left
                    strLine = sr.ReadLine(); // 16:hip right
                    string[] words = strLine.Split(' ');
                    Point3D P16 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 17:knee right   
                    words = strLine.Split(' ');
                    Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 18:ankle right
                    words = strLine.Split(' ');
                    Point3D P18 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 19:foot right

                    Example example = new Example();
                    
                    double angle = GeometryUtils.getAngle(P16,P17,P18);
                    if (maxim1 < angle)
                        maxim1 = angle;
                    if (minim1 > angle)
                        minim1 = angle;  
                    average1 += angle;  
                    example.add("A.16.17.18", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.XOY);
                    if (maxim2 < angle)
                        maxim2 = angle;
                    if (minim2 > angle)
                        minim2 = angle;  
                    average2 += angle;
                    example.add("A.17.18.XoY", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.YOZ);
                    if (maxim3 < angle)
                        maxim3 = angle;
                    if (minim3 > angle)
                        minim3 = angle;  
                    average3 += angle;
                    example.add("A.17.18.YoZ", angle);
                    
                    example.setResult("ridicat frontal");
                    rightLegTS.Add(example);
                }    
                if (Constants.DEBUG) {
                    Console.WriteLine("A.16.17.18:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                    Console.WriteLine("A.17.18.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                    Console.WriteLine("A.17.18.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
                }

                // INDOIT
                if (Constants.DEBUG) {
                    Console.WriteLine("\tIndoit");
                }
                sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mid\\indoit.txt");
                fileSize = 28791;

                maxim1 = 0.0;
                minim1 = 180.0;
                average1 = 0.0;

                maxim2 = 0.0;
                minim2 = 180.0;
                average2 = 0.0;

                maxim3 = 0.0;
                minim3 = 180.0;
                average3 = 0.0;

                for (int i=0; i<fileSize; i+=21) {  
                    strLine = sr.ReadLine(); // blank                
                    strLine = sr.ReadLine(); // 0:hipcenter   
                    strLine = sr.ReadLine(); // 1:spine
                    strLine = sr.ReadLine(); // 2:shoulder center
                    strLine = sr.ReadLine(); // 3:head                 
                    strLine = sr.ReadLine(); // 4:shoulder left                              
                    strLine = sr.ReadLine(); // 5:elbow left                
                    strLine = sr.ReadLine(); // 6:wrist left 
                    strLine = sr.ReadLine(); // 7:hand left
                    strLine = sr.ReadLine(); // 8:shoulder right               
                    strLine = sr.ReadLine(); // 9:elbow right
                    strLine = sr.ReadLine(); // 10:wrist right
                    strLine = sr.ReadLine(); // 11:hand right
                    strLine = sr.ReadLine(); // 12:hip left                
                    strLine = sr.ReadLine(); // 13:knee left
                    strLine = sr.ReadLine(); // 14:ankle left
                    strLine = sr.ReadLine(); // 15:foot left
                    strLine = sr.ReadLine(); // 16:hip right
                    string[] words = strLine.Split(' ');
                    Point3D P16 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 17:knee right   
                    words = strLine.Split(' ');
                    Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 18:ankle right
                    words = strLine.Split(' ');
                    Point3D P18 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                    strLine = sr.ReadLine(); // 19:foot right

                    Example example = new Example();
                    
                    double angle = GeometryUtils.getAngle(P16,P17,P18);
                    if (maxim1 < angle)
                        maxim1 = angle;
                    if (minim1 > angle)
                        minim1 = angle;  
                    average1 += angle;  
                    example.add("A.16.17.18", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.XOY);
                    if (maxim2 < angle)
                        maxim2 = angle;
                    if (minim2 > angle)
                        minim2 = angle;  
                    average2 += angle;
                    example.add("A.17.18.XoY", angle);
                    
                    angle = GeometryUtils.getAngle(P17,P18,Constants.planeType.YOZ);
                    if (maxim3 < angle)
                        maxim3 = angle;
                    if (minim3 > angle)
                        minim3 = angle;  
                    average3 += angle;
                    example.add("A.17.18.YoZ", angle);
                    
                    example.setResult("indoit");
                    rightLegTS.Add(example);
                }    
                if (Constants.DEBUG) {
                    Console.WriteLine("A.16.17.18:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                    Console.WriteLine("A.17.18.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                    Console.WriteLine("A.17.18.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
                }
        }
        catch (Exception e) {Console.WriteLine(e);}
            
        return rightLegTS;
     }
Example #7
0
        public static List<Example> readLeftLegTS() {
         // TRAIN LEFT LEG PART...
         if (Constants.DEBUG) {
            // Attributes: A.12.13.14, A.13.14.XOY, A.13.14.YOZ
            Console.WriteLine("\n=====\tPICIOR STANG  =====");
            Console.WriteLine("\tDrept");
         }

        StreamReader sr;
        String strLine;
        List<Example> leftLegTS = new List<Example>();

        double maxim1 = 0.0;
        double minim1 = 180.0;
        double average1 = 0.0;

        double maxim2 = 0.0;
        double minim2 = 180.0;
        double average2 = 0.0;

        double maxim3 = 0.0;
        double minim3 = 180.0;
        double average3 = 0.0;

        double fileSize = 25242;

        try {
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mis\\drept.txt");

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right               
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                string[] words = strLine.Split(' ');
                Point3D P12 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 13:knee left
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                words = strLine.Split(' ');
                Point3D P14 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();

                double angle = GeometryUtils.getAngle(P12,P13,P14);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.12.13.14", angle);
                
                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.XOY);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.13.14.XoY", angle);

                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.YOZ);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("A.13.14.YoZ", angle);

                example.setResult("drept");
                leftLegTS.Add(example);
            }   
            if (Constants.DEBUG) {
                Console.WriteLine("A.12.13.14:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.13.14.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("A.13.14.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }

            // RIDICAT LATERAL
            if (Constants.DEBUG) {
                Console.WriteLine("\tRidicat lateral");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mis\\ridicat lateral.txt");
            fileSize = 3444;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right               
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                string[] words = strLine.Split(' ');
                Point3D P12 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 13:knee left
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                words = strLine.Split(' ');
                Point3D P14 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();

                double angle = GeometryUtils.getAngle(P12,P13,P14);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.12.13.14", angle);
                                
                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.XOY);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.13.14.XoY", angle);

                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.YOZ);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("A.13.14.YoZ", angle);

                example.setResult("ridicat lateral");
                leftLegTS.Add(example);
            }   
            if (Constants.DEBUG) {
                Console.WriteLine("A.12.13.14:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.13.14.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("A.13.14.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }

            // RIDICAT FRONTAL
            if (Constants.DEBUG) {
                Console.WriteLine("\tRidicat frontal");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mis\\ridicat frontal.txt");
            fileSize = 12432;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right               
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                string[] words = strLine.Split(' ');
                Point3D P12 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 13:knee left
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                words = strLine.Split(' ');
                Point3D P14 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();

                double angle = GeometryUtils.getAngle(P12,P13,P14);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.12.13.14", angle);
                
                
                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.XOY);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.13.14.XoY", angle);

                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.YOZ);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("A.13.14.YoZ", angle);

                example.setResult("ridicat frontal");
                leftLegTS.Add(example);
            }   
            if (Constants.DEBUG) {
                Console.WriteLine("A.12.13.14:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.13.14.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("A.13.14.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }

            // INDOIT
            if (Constants.DEBUG) {
                Console.WriteLine("\tIndoit");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\mis\\indoit.txt");
            fileSize = 10584;

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            for (int i=0; i<fileSize; i+=21) {  
                strLine = sr.ReadLine(); // blank                
                strLine = sr.ReadLine(); // 0:hipcenter   
                strLine = sr.ReadLine(); // 1:spine
                strLine = sr.ReadLine(); // 2:shoulder center
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left                              
                strLine = sr.ReadLine(); // 5:elbow left                
                strLine = sr.ReadLine(); // 6:wrist left 
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right               
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                string[] words = strLine.Split(' ');
                Point3D P12 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 13:knee left
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                words = strLine.Split(' ');
                Point3D P14 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right       
                strLine = sr.ReadLine(); // 17:knee right                
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right

                Example example = new Example();

                double angle = GeometryUtils.getAngle(P12,P13,P14);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;  
                average1 += angle;  
                example.add("A.12.13.14", angle);
                
                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.XOY);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;  
                average2 += angle;
                example.add("A.13.14.XoY", angle);

                angle = GeometryUtils.getAngle(P13,P14,Constants.planeType.YOZ);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;  
                average3 += angle;
                example.add("A.13.14.YoZ", angle);

                example.setResult("indoit");
                leftLegTS.Add(example);
            }    
            if (Constants.DEBUG) {
                Console.WriteLine("A.12.13.14:\t(" + (int)minim1 + ", " + (int)maxim1 + "), " + ((int)average1/fileSize*21));
                Console.WriteLine("A.13.14.XOY:\t(" + (int)minim2 + ", " + (int)maxim2 + "), " + ((int)average2/fileSize*21));
                Console.WriteLine("A.13.14.YOZ:\t(" + (int)minim3 + ", " + (int)maxim3 + "), " + ((int)average3/fileSize*21));
            }
        }
        catch (Exception e) {Console.WriteLine(e);} 

        return leftLegTS;
     }
Example #8
0
        public static List<Example> readBodyTS() {
        // TRAIN BODY PART ...
        List<Example> bodyTS = new List<Example>();
        StreamReader sr;
        String strLine;
        
        if (Constants.DEBUG) {
            Console.WriteLine("\n=====\tTRUNCHI\t=====");
            // Attributes: A.2.1.13, A.2.1.17, A.1.2.XOY, A.1.2.YOZ
            Console.WriteLine("\tDrept");
        }
        double maxim1 = 0.0;
        double minim1 = 180.0;
        double average1 = 0.0;

        double maxim2 = 0.0;
        double minim2 = 180.0;
        double average2 = 0.0;

        double maxim3 = 0.0;
        double minim3 = 180.0;
        double average3 = 0.0;

        double maxim4 = 0.0;
        double minim4 = 180.0;
        double average4 = 0.0;

        double fileSize = 5838;
        
        try {
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\trunchi\\drept.txt");

            for (int i=0; i<fileSize; i+=21) {
                strLine = sr.ReadLine(); // blank
                strLine = sr.ReadLine(); // 0:hipcenter
                strLine = sr.ReadLine(); // 1:spine
                string[] words = strLine.Split(' ');
                Point3D P1 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 2:shoulder center
                words = strLine.Split(' ');
                Point3D P2 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left
                strLine = sr.ReadLine(); // 5:elbow left
                strLine = sr.ReadLine(); // 6:wrist left
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                strLine = sr.ReadLine(); // 13:knee left                
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right
                strLine = sr.ReadLine(); // 17:knee right
                words = strLine.Split(' ');
                Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right
                
                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P2,P1,P13);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;
                average1 += angle;
                example.add("A.2.1.13", angle);
                
                angle = GeometryUtils.getAngle(P2,P1,P17);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;
                average2 += angle;
                example.add("A.2.1.17", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.XOY);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;
                average3 += angle;
                example.add("A.1.2.XoY", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.YOZ);
                if (maxim4 < angle)
                    maxim4 = angle;
                if (minim4 > angle)
                    minim4 = angle;
                average4 += angle;
                example.add("A.1.2.YoZ", angle);
                
                example.setResult("drept");
                bodyTS.Add(example);
            }
            if (Constants.DEBUG) {
                Console.WriteLine("A.2.1.13:(" + (int)minim1 + ", " + (int)maxim1 + "), " + (int)(average1/fileSize*21));
                Console.WriteLine("A.2.1.17:(" + (int)minim2 + ", " + (int)maxim2 + "), " + (int)(average2/fileSize*21));
                Console.WriteLine("A.1.2.XOY:(" + (int)minim3 + ", " + (int)maxim3 + "), " + (int)(average3/fileSize*21));
                Console.WriteLine("A.1.2.YOZ:(" + (int)minim4 + ", " + (int)maxim4 + "), " + (int)(average4/fileSize*21));
            }
            
            
            if (Constants.DEBUG) {
                Console.WriteLine("\tAplecat frontal");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\trunchi\\aplecat frontal.txt");

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            maxim4 = 0.0;
            minim4 = 180.0;
            average4 = 0.0;

            fileSize = 10605;
            for (int i=0; i<fileSize; i+=21) {                   
                strLine = sr.ReadLine(); // blank
                strLine = sr.ReadLine(); // 0:hipcenter
                strLine = sr.ReadLine(); // 1:spine
                string[] words = strLine.Split(' ');
                Point3D P1 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 2:shoulder center
                words = strLine.Split(' ');
                Point3D P2 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left
                strLine = sr.ReadLine(); // 5:elbow left
                strLine = sr.ReadLine(); // 6:wrist left
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                strLine = sr.ReadLine(); // 13:knee left                
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right
                strLine = sr.ReadLine(); // 17:knee right
                words = strLine.Split(' ');
                Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right
                
                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P2,P1,P13);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;
                average1 += angle;
                example.add("A.2.1.13", angle);
                
                angle = GeometryUtils.getAngle(P2,P1,P17);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;
                average2 += angle;
                example.add("A.2.1.17", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.XOY);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;
                average3 += angle;
                example.add("A.1.2.XoY", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.YOZ);
                if (maxim4 < angle)
                    maxim4 = angle;
                if (minim4 > angle)
                    minim4 = angle;
                average4 += angle;
                example.add("A.1.2.YoZ", angle);
                
                example.setResult("aplecat frontal");
                bodyTS.Add(example);
            }
            if (Constants.DEBUG) {
                Console.WriteLine("A.2.1.13:(" + (int)minim1 + ", " + (int)maxim1 + "), " + (int)(average1/fileSize*21));
                Console.WriteLine("A.2.1.17:(" + (int)minim2 + ", " + (int)maxim2 + "), " + (int)(average2/fileSize*21));
                Console.WriteLine("A.1.2.XOY:(" + (int)minim3 + ", " + (int)maxim3 + "), " + (int)(average3/fileSize*21));
                Console.WriteLine("A.1.2.YOZ:(" + (int)minim4 + ", " + (int)maxim4 + "), " + (int)(average4/fileSize*21));
            }

            if (Constants.DEBUG) {
                Console.WriteLine("\tAplecat lateral");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\trunchi\\aplecat lateral.txt");

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            maxim4 = 0.0;
            minim4 = 180.0;
            average4 = 0.0;

            fileSize = 9786;
            
            for (int i=0; i<fileSize; i+=21) {
                strLine = sr.ReadLine(); // blank
                strLine = sr.ReadLine(); // 0:hipcenter
                strLine = sr.ReadLine(); // 1:spine
                string[] words = strLine.Split(' ');
                Point3D P1 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 2:shoulder center
                words = strLine.Split(' ');
                Point3D P2 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left
                strLine = sr.ReadLine(); // 5:elbow left
                strLine = sr.ReadLine(); // 6:wrist left
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                strLine = sr.ReadLine(); // 13:knee left                
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right
                strLine = sr.ReadLine(); // 17:knee right
                words = strLine.Split(' ');
                Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right
                
                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P2,P1,P13);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;
                average1 += angle;
                example.add("A.2.1.13", angle);
                
                angle = GeometryUtils.getAngle(P2,P1,P17);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;
                average2 += angle;
                example.add("A.2.1.17", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.XOY);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;
                average3 += angle;
                example.add("A.1.2.XoY", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.YOZ);
                if (maxim4 < angle)
                    maxim4 = angle;
                if (minim4 > angle)
                    minim4 = angle;
                average4 += angle;
                example.add("A.1.2.YoZ", angle);
                
                example.setResult("aplecat lateral");
                bodyTS.Add(example);
            }
            if (Constants.DEBUG) {
                Console.WriteLine("A.2.1.13:(" + (int)minim1 + ", " + (int)maxim1 + "), " + (int)(average1/fileSize*21));
                Console.WriteLine("A.2.1.17:(" + (int)minim2 + ", " + (int)maxim2 + "), " + (int)(average2/fileSize*21));
                Console.WriteLine("A.1.2.XOY:(" + (int)minim3 + ", " + (int)maxim3 + "), " + (int)(average3/fileSize*21));
                Console.WriteLine("A.1.2.YOZ:(" + (int)minim4 + ", " + (int)maxim4 + "), " + (int)(average4/fileSize*21));
            }

            if (Constants.DEBUG) {
                Console.WriteLine("\tAsezat");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\trunchi\\asezat.txt");

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            maxim4 = 0.0;
            minim4 = 180.0;
            average4 = 0.0;

            fileSize = 6237;
            
            for (int i=0; i<fileSize; i+=21) {                
                strLine = sr.ReadLine(); // blank
                strLine = sr.ReadLine(); // 0:hipcenter
                strLine = sr.ReadLine(); // 1:spine
                string[] words = strLine.Split(' ');
                Point3D P1 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 2:shoulder center
                words = strLine.Split(' ');
                Point3D P2 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left
                strLine = sr.ReadLine(); // 5:elbow left
                strLine = sr.ReadLine(); // 6:wrist left
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                strLine = sr.ReadLine(); // 13:knee left                
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right
                strLine = sr.ReadLine(); // 17:knee right
                words = strLine.Split(' ');
                Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right
                
                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P2,P1,P13);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;
                average1 += angle;
                example.add("A.2.1.13", angle);
                
                angle = GeometryUtils.getAngle(P2,P1,P17);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;
                average2 += angle;
                example.add("A.2.1.17", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.XOY);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;
                average3 += angle;
                example.add("A.1.2.XoY", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.YOZ);
                if (maxim4 < angle)
                    maxim4 = angle;
                if (minim4 > angle)
                    minim4 = angle;
                average4 += angle;
                example.add("A.1.2.YoZ", angle);
                
                example.setResult("asezat");
                bodyTS.Add(example);
            }
            if (Constants.DEBUG) {
                Console.WriteLine("A.2.1.13:(" + (int)minim1 + ", " + (int)maxim1 + "), " + (int)(average1/fileSize*21));
                Console.WriteLine("A.2.1.17:(" + (int)minim2 + ", " + (int)maxim2 + "), " + (int)(average2/fileSize*21));
                Console.WriteLine("A.1.2.XOY:(" + (int)minim3 + ", " + (int)maxim3 + "), " + (int)(average3/fileSize*21));
                Console.WriteLine("A.1.2.YOZ:(" + (int)minim4 + ", " + (int)maxim4 + "), " + (int)(average4/fileSize*21));
            }
            
            if (Constants.DEBUG) {
                Console.WriteLine("\tCulcat");
            }
            sr = new StreamReader("D:\\LICENTA\\Pose Recognition\\input_antrenare_3\\trunchi\\culcat.txt");

            maxim1 = 0.0;
            minim1 = 180.0;
            average1 = 0.0;

            maxim2 = 0.0;
            minim2 = 180.0;
            average2 = 0.0;

            maxim3 = 0.0;
            minim3 = 180.0;
            average3 = 0.0;

            maxim4 = 0.0;
            minim4 = 180.0;
            average4 = 0.0;
            
            fileSize = 2604;
            
            for (int i=0; i<fileSize; i+=21) {
                strLine = sr.ReadLine(); // blank
                strLine = sr.ReadLine(); // 0:hipcenter
                strLine = sr.ReadLine(); // 1:spine
                string[] words = strLine.Split(' ');
                Point3D P1 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 2:shoulder center
                words = strLine.Split(' ');
                Point3D P2 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 3:head                 
                strLine = sr.ReadLine(); // 4:shoulder left
                strLine = sr.ReadLine(); // 5:elbow left
                strLine = sr.ReadLine(); // 6:wrist left
                strLine = sr.ReadLine(); // 7:hand left
                strLine = sr.ReadLine(); // 8:shoulder right
                strLine = sr.ReadLine(); // 9:elbow right
                strLine = sr.ReadLine(); // 10:wrist right
                strLine = sr.ReadLine(); // 11:hand right
                strLine = sr.ReadLine(); // 12:hip left
                strLine = sr.ReadLine(); // 13:knee left                
                words = strLine.Split(' ');
                Point3D P13 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 14:ankle left
                strLine = sr.ReadLine(); // 15:foot left
                strLine = sr.ReadLine(); // 16:hip right
                strLine = sr.ReadLine(); // 17:knee right
                words = strLine.Split(' ');
                Point3D P17 = new Point3D(Double.Parse(words[0]), 
                        Double.Parse(words[1]), 
                        Double.Parse(words[2]));
                strLine = sr.ReadLine(); // 18:ankle right
                strLine = sr.ReadLine(); // 19:foot right
                
                Example example = new Example();
                
                double angle = GeometryUtils.getAngle(P2,P1,P13);
                if (maxim1 < angle)
                    maxim1 = angle;
                if (minim1 > angle)
                    minim1 = angle;
                average1 += angle;
                example.add("A.2.1.13", angle);
                
                angle = GeometryUtils.getAngle(P2,P1,P17);
                if (maxim2 < angle)
                    maxim2 = angle;
                if (minim2 > angle)
                    minim2 = angle;
                average2 += angle;
                example.add("A.2.1.17", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.XOY);
                if (maxim3 < angle)
                    maxim3 = angle;
                if (minim3 > angle)
                    minim3 = angle;
                average3 += angle;
                example.add("A.1.2.XoY", angle);
                
                angle = GeometryUtils.getAngle(P1,P2,Constants.planeType.YOZ);
                if (maxim4 < angle)
                    maxim4 = angle;
                if (minim4 > angle)
                    minim4 = angle;
                average4 += angle;
                example.add("A.1.2.YoZ", angle);
                
                example.setResult("culcat");
                bodyTS.Add(example);
            }
            if (Constants.DEBUG) {
                Console.WriteLine("A.2.1.13:(" + (int)minim1 + ", " + (int)maxim1 + "), " + (int)(average1/fileSize*21));
                Console.WriteLine("A.2.1.17:(" + (int)minim2 + ", " + (int)maxim2 + "), " + (int)(average2/fileSize*21));
                Console.WriteLine("A.1.2.XOY:(" + (int)minim3 + ", " + (int)maxim3 + "), " + (int)(average3/fileSize*21));
                Console.WriteLine("A.1.2.YOZ:(" + (int)minim4 + ", " + (int)maxim4 + "), " + (int)(average4/fileSize*21));
            }
          
        }
        catch (Exception e) {Console.WriteLine(e);}
        
        return bodyTS;
    }