diff --git a/Sources/KinectUtils/Gesture.cs b/Sources/KinectUtils/Gesture.cs index 9c850d8..34011c8 100644 --- a/Sources/KinectUtils/Gesture.cs +++ b/Sources/KinectUtils/Gesture.cs @@ -9,7 +9,7 @@ namespace KinectUtils { public abstract class Gesture : BaseGesture { - public bool IsRecognitionRunning { get; set; } + public bool IsRecognitionRunning { get; set; } = false; protected int MinNbOfFrames = 10; // Exemple de valeur, ajustez selon le geste protected int MaxNbOfFrames = 50; // Exemple de valeur, ajustez selon le geste @@ -22,7 +22,6 @@ namespace KinectUtils if (TestInitialConditions(body)) { IsRecognitionRunning = true; - Console.WriteLine(GestureName); currentFrameCount = 0; } } @@ -37,6 +36,7 @@ namespace KinectUtils else if (TestEndConditions(body) && currentFrameCount >= MinNbOfFrames) { OnGestureRecognized(body); + Console.WriteLine(GestureName); IsRecognitionRunning = false; } } diff --git a/Sources/LibMyGesturesBank/AllGesturesFactory.cs b/Sources/LibMyGesturesBank/AllGesturesFactory.cs index 5802cfe..dee370c 100644 --- a/Sources/LibMyGesturesBank/AllGesturesFactory.cs +++ b/Sources/LibMyGesturesBank/AllGesturesFactory.cs @@ -18,6 +18,7 @@ namespace MyGesturesBank new PostureHandUp(), new RightHandUp(), new TwoHandsDragon(), + new ClapHands(), // Ajoutez d'autres gestes ici }; } diff --git a/Sources/LibMyGesturesBank/ClapHands.cs b/Sources/LibMyGesturesBank/ClapHands.cs index dc01856..b56ad47 100644 --- a/Sources/LibMyGesturesBank/ClapHands.cs +++ b/Sources/LibMyGesturesBank/ClapHands.cs @@ -3,10 +3,11 @@ using Microsoft.Kinect; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -namespace LibMyGesturesBank +namespace MyGesturesBank { public class ClapHands : Gesture { @@ -22,7 +23,7 @@ namespace LibMyGesturesBank var handLeft = body.Joints[JointType.HandLeft].Position; // Vérifie si les mains sont à une hauteur similaire et devant le corps - return Math.Abs(handRight.Y - handLeft.Y) < 0.1f && handRight.Z < 0.5f && handLeft.Z < 0.5f; + return Math.Abs(handRight.Y - handLeft.Y) < 0.5f && handRight.Z < 0.5f && handLeft.Z < 0.5f; } protected override bool TestRunningGesture(Body body)