/// <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; }
/// <summary> /// Incrementa o "Current frame" da pose hipotética e dispara o evento de pose reconhecida caso o Waiting time seja alcançado. /// </summary> /// <param name="hypotheticalPose">Pose hipotética</param> private void TestPoseInProgress(Pose hypotheticalPose) { hypotheticalPose.CurrentFrame += 1; if (hypotheticalPose.WaitingTime == hypotheticalPose.CurrentFrame) { hypotheticalPose.Status = PoseStatus.accepted; CallPoseEvents(hypotheticalPose, PoseEventStatus.recognized); } }
/// <summary> /// Dispara o evento de reconhecimento de pose /// </summary> /// <param name="pose">Pose que teve o estado alterado</param> /// <param name="status">Estado da pose</param> private void CallPoseEvents(Pose pose, PoseEventStatus status) { if (PoseStatusChanged != null) PoseStatusChanged(pose, status); switch (status) { case PoseEventStatus.recognized: if (PoseRecognized != null) PoseRecognized(pose); break; case PoseEventStatus.interrupted: if (PoseInterrupted != null) PoseInterrupted(pose); break; case PoseEventStatus.in_progress: if (PoseInProgress != null) PoseInProgress(pose); break; } }
/// <summary> /// Reinicia o current frame da pose hipotética e marca o estado como "not_started" /// </summary> /// <param name="hypotheticalPose">Hypothetical pose</param> private void RestartHypotheticalPoseTracking(Pose hypotheticalPose) { hypotheticalPose.CurrentFrame = 0; hypotheticalPose.Status = PoseStatus.not_started; CallPoseEvents(hypotheticalPose, PoseEventStatus.interrupted); }