Beispiel #1
0
        public static MyPostureTraining createPostureTraining(String trainingName)
        {
            Service.Service service       = new Service.Service();
            PostureLoader   postureLoader = new PostureLoader();

            MyPostureTraining training     = new MyPostureTraining();
            JSONObject        trainingData = service.queryTraining(trainingName);

            if (trainingData == null)
            {
                LogUtil.log("查询不到名称为[" + trainingName + "]的姿势训练.");
                return(training);
            }

            String postures = trainingData.GetString("postures");

            int[] postureIds = Utils.CommonUtil.stringToIntArray1(postures);

            for (int i = 0; i < postureIds.Length; i++)
            {
                training.PostureList.Add(postureLoader.Load(postureIds[i]));
            }

            return(training);
        }
Beispiel #2
0
        public static MyPostureTraining create1()
        {
            MyPostureTraining training = new MyPostureTraining();

            using (StreamReader sr = new StreamReader(Constant.BASE_PATH + "/data/data1/data.txt"))
            {
                for (int i = 1; i <= 9; i++)
                {
                    Posture           pos            = new Posture(PostureType.Both);
                    List <VectorType> vectorTypeList = PostureRecognition.getVectorTypeList(PostureType.Both);
                    pos.setPic(Constant.BASE_PATH + "/data/data1/" + i + "_color.jpg");

                    foreach (VectorType type in vectorTypeList)
                    {
                        string[] lineData = sr.ReadLine().Split(',');
                        pos.setVector(type, new Vector(double.Parse(lineData[0]), double.Parse(lineData[1]), double.Parse(lineData[2])));
                    }
                    sr.ReadLine();
                    training.PostureList.Add(pos);
                }
            }

            return(training);
        }