Example #1
0
 public void process01_calVariable_ver2()
 {
     cur_bendAngle = ThePostureCal.calAngle_3D(
         posture_current.Joints[JointType.Head].Position,
         posture_current.Joints[JointType.Spine].Position, 2);
     facing_Angle = ThePostureCal.calAngle_3D(
         posture_current.Joints[JointType.ShoulderLeft].Position,
         posture_current.Joints[JointType.ShoulderRight].Position, 2);
     diff_bend_Angle = cur_bendAngle - initial_bend_ang;
     diff_sp_Y       = getY(JointType.Spine) - initial_y;
     diff_kneeL_Y    = getY(JointType.KneeLeft) - initial_knee_y;
     diff_kneeR_Y    = getY(JointType.KneeRight) - initial_knee_y;
     //
     diff_hL_sC_X = getX_diff(JointType.HandLeft, JointType.ShoulderCenter);
     diff_hL_sC_Y = getY_diff(JointType.HandLeft, JointType.ShoulderCenter);
     diff_hL_sC_Z = getZ_diff(JointType.HandLeft, JointType.ShoulderCenter);
     diff_hR_sC_X = getX_diff(JointType.HandRight, JointType.ShoulderCenter);
     diff_hR_sC_Y = getY_diff(JointType.HandRight, JointType.ShoulderCenter);
     diff_hR_sC_Z = getZ_diff(JointType.HandRight, JointType.ShoulderCenter);
     //Additional
     diff_fL_kL_Z = getZ_diff(JointType.FootLeft, JointType.KneeLeft);
     diff_fR_kR_Z = getZ_diff(JointType.FootRight, JointType.KneeRight);
     //
     diff_handLR_eu = getDist(JointType.HandLeft, JointType.HandRight);
     diff_footLR_Z  = getZ_diff(JointType.FootLeft, JointType.FootRight);
 }
Example #2
0
        //Modeling transition patterns between events for temporal human action segmentation and classification
        public static List <int[]> extractKeyPose_Angular(Instance inst)
        {
            List <int[]>          list_keyPose    = new List <int[]>();
            List <UKI_DataDouble> list_dataAngles = new List <UKI_DataDouble>();
            List <string>         output_print    = new List <string>();

            foreach (UKI_DataRaw d in inst.getDataRaw(false))
            {
                UKI_DataDouble dataAngles = new UKI_DataDouble();
                dataAngles.id = d.id;
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.Spine, d.ShoulderLeft, d.ElbowLeft));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.ShoulderLeft, d.ElbowLeft, d.WristLeft));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.Spine, d.ShoulderRight, d.ElbowRight));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.ShoulderRight, d.ElbowRight, d.WristRight));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.Spine, d.HipLeft, d.KneeLeft));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.HipLeft, d.KneeLeft, d.AnkleLeft));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.Spine, d.HipRight, d.KneeRight));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.HipLeft, d.KneeLeft, d.AnkleLeft));
                dataAngles.data.Add(ThePostureCal.calAngle_3Points(d.Head, d.ShoulderCenter, d.Spine));
            }
            if (path_saveFolder != "")
            {
                output_print.Add("id,ShouldL,ElbowL,ShouldR,ElbowR,HipL,KneeL,HipR,KneeR,Neck");
                output_print.AddRange(TheUKI.UKI_DataDouble_convertToListString(list_dataAngles));
                TheTool.exportCSV_orTXT(path_saveFolder + @"/" + inst.name + ".csv", output_print, false);
            }
            return(list_keyPose);
        }
Example #3
0
 //use first row
 public void recog_InitialPosture(UKI_DataRaw bp)
 {
     TheInitialPosture.data_raw = bp;
     data.initial_y             = bp.Spine[1];
     data.initial_knee_y        = (bp.KneeLeft[1] + bp.KneeRight[1]) / 2;
     data.initial_bend_ang      = ThePostureCal.calAngle_3D(bp.Head, bp.Spine, 2);
 }
Example #4
0
 public void process01_calVariable_ver1_optional(UKI_DataRaw current_data)
 {
     cur_bendAngle   = ThePostureCal.calAngle_3D(current_data.Head, current_data.Spine, 2);
     facing_Angle    = ThePostureCal.calAngle_3D(current_data.ShoulderLeft, current_data.ShoulderRight, 2);
     diff_bend_Angle = cur_bendAngle - initial_bend_ang;
     diff_kneeL_Y    = current_data.KneeLeft[1] - initial_knee_y;
     diff_kneeR_Y    = current_data.KneeRight[1] - initial_knee_y;
     //
     diff_hL_sC_X = current_data.HandLeft[0] - current_data.ShoulderCenter[0];
     diff_hL_sC_Y = current_data.HandLeft[1] - current_data.ShoulderCenter[1];
     diff_hL_sC_Z = current_data.HandLeft[2] - current_data.ShoulderCenter[2];
     diff_hR_sC_X = current_data.HandRight[0] - current_data.ShoulderCenter[0];
     diff_hR_sC_Y = current_data.HandRight[1] - current_data.ShoulderCenter[1];
     diff_hR_sC_Z = current_data.HandRight[2] - current_data.ShoulderCenter[2];
     //Additional
     diff_fL_kL_Z = current_data.FootLeft[2] - current_data.KneeLeft[2];
     diff_fR_kR_Z = current_data.FootRight[2] - current_data.KneeRight[2];
     //
     diff_handLR_eu = TheUKI.getDist(current_data.HandLeft, current_data.HandRight);
     diff_footLR_Z  = current_data.FootLeft[2] - current_data.FootRight[2];
 }
Example #5
0
        // 1 data - 1 rule
        public static Boolean testRule(UKI_Data_AnalysisForm data, m_If rule)
        {
            Boolean pass = false;

            if (rule.type == TheMapData.if_type_2Joint)
            {
                double diff = 0;
                if (rule.axis == "X" || rule.axis == "Y" || rule.axis == "Z")
                {
                    double v1 = getJointAxis(data.raw, rule.v, rule.axis);
                    double v2 = getJointAxis(data.raw, rule.v2, rule.axis);
                    diff = v1 - v2;
                }
                else
                {
                    diff = TheTool.calEuclidian(getJoint(data.raw, rule.v), getJoint(data.raw, rule.v2));
                }
                pass = TheTool.checkOpt(diff, rule.opt, rule.value_d);
            }
            else if (rule.type == TheMapData.if_type_BasicPose)
            {
                pass = UKI_DataBasicPose_checkBasicPosture(rule, data.bp);
            }
            else if (rule.type == TheMapData.if_type_Change)
            {
                double v1         = getJointAxis(data.raw, rule.v, rule.axis);
                double v2         = getJointAxis(TheInitialPosture.data_raw, rule.v2, rule.axis);
                double test_value = v1 - v2;
                pass = TheTool.checkOpt(test_value, rule.opt, rule.value_d);
                //TheSys.showError(v1 + " - " + v2 + " = " + test_value + rule.opt + rule.value_d);
            }
            else if (rule.type == TheMapData.if_type_SphereAngle)
            {
                Boolean azimuth = false;
                if (rule.value == TheMapData.then_SphereAngle_Azimuth)
                {
                    azimuth = true;
                }
                double testValue = TheTool.calSpherical(getJoint(data.raw, rule.v), getJoint(data.raw, rule.v2), azimuth);
                pass = TheTool.checkOpt(testValue, rule.opt, rule.value_d);
            }
            else if (rule.type == TheMapData.if_type_FlexionAngle)
            {
                double testValue = 0;
                if (rule.v == "ElbowL")
                {
                    testValue = ThePostureCal.calAngle_3Points(data.raw.ShoulderLeft, data.raw.ElbowLeft, data.raw.WristLeft);
                }
                else if (rule.v == "ElbowR")
                {
                    testValue = ThePostureCal.calAngle_3Points(data.raw.ShoulderRight, data.raw.ElbowRight, data.raw.WristRight);
                }
                else if (rule.v == "KneeL")
                {
                    testValue = ThePostureCal.calAngle_3Points(data.raw.HipLeft, data.raw.KneeLeft, data.raw.AnkleLeft);
                }
                else if (rule.v == "KneeR")
                {
                    testValue = ThePostureCal.calAngle_3Points(data.raw.HipRight, data.raw.KneeRight, data.raw.AnkleRight);
                }
                pass = TheTool.checkOpt(testValue, rule.opt, rule.value_d);
            }
            return(pass);
        }