/// <summary> /// Método para comprar o esqueleto corrente com a subpose enviada por parâmetro /// </summary> /// <param name="userSkeleton">Esqueleto do usuário em tempo de execução</param> /// <param name="subPoseForTest">SubPose para comparar</param> /// <param name="recognitionType">Indica o algortimo que será utilizado para comparação</param> /// <returns>Retorna true caso a subpose seja reconhecida, caso contrário retorna false</returns> private bool SubPoseTest(SubPose subPoseForTest, Skeleton userSkeleton, PoseRecognitionType recognitionType) { Joint centerJoint = userSkeleton.Joints[subPoseForTest.CenterJoint.JointType]; Joint auxiliaryJoint1 = userSkeleton.Joints[subPoseForTest.AuxiliaryJoint1.JointType]; Joint auxiliaryJoint2 = userSkeleton.Joints[subPoseForTest.AuxiliaryJoint2.JointType]; SubPose userSubPose = new SubPose(centerJoint, auxiliaryJoint1, auxiliaryJoint2); bool returnValue = true; if (recognitionType == PoseRecognitionType.scalarProduct) { double scalarProductResult = MathFunctionsManager.ScalarProductCalculation(userSubPose); returnValue = MathFunctionsManager.ComparisonWithErrorMargin(scalarProductResult, subPoseForTest.Angle.ScalarProductResult, subPoseForTest.AngleMarginError); } else { LawOfCosinesResult lawOfCosinesResult = MathFunctionsManager.LawOfCosinesCalculation(userSubPose); returnValue &= MathFunctionsManager.ComparisonWithErrorMargin(subPoseForTest.Angle.LawOfCosinesResult.PlanXY, lawOfCosinesResult.PlanXY, subPoseForTest.AngleMarginError); returnValue &= MathFunctionsManager.ComparisonWithErrorMargin(subPoseForTest.Angle.LawOfCosinesResult.PlanXZ, lawOfCosinesResult.PlanXZ, subPoseForTest.AngleMarginError); returnValue &= MathFunctionsManager.ComparisonWithErrorMargin(subPoseForTest.Angle.LawOfCosinesResult.PlanYZ, lawOfCosinesResult.PlanYZ, subPoseForTest.AngleMarginError); } return returnValue; }
public PoseRecognitionEngine(PoseRecognitionType recognitionType) { _recognitionType = recognitionType; this.Poses = new List<Pose>(); }
/// <summary> /// Método para comprar o esqueleto corrente com a pose enviada por parâmetro /// </summary> /// <param name="userSkeleton">Esqueleto do usuário em tempo de execução</param> /// <param name="poseForTest">Pose para comparar</param> /// <param name="recognitionType">Indica o algortimo que será utilizado para comparação</param> /// <returns>Retorna true caso a pose seja reconhecida, caso contrário retorna false</returns> private bool PoseTest(Skeleton userSkeleton, Pose poseForTest, PoseRecognitionType recognitionType) { bool returnValue = true; foreach (SubPose subPose in poseForTest.SubPoses) { returnValue &= SubPoseTest(subPose, userSkeleton, recognitionType); if (!returnValue) break; } return returnValue; }