Create(Gesture): there are problems with gestures

pull/21/head
Johan LACHENAL 1 year ago
parent 5df113740e
commit 7a0e038241

@ -9,7 +9,7 @@ namespace KinectUtils
{ {
public abstract class Gesture : BaseGesture 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 MinNbOfFrames = 10; // Exemple de valeur, ajustez selon le geste
protected int MaxNbOfFrames = 50; // 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)) if (TestInitialConditions(body))
{ {
IsRecognitionRunning = true; IsRecognitionRunning = true;
Console.WriteLine(GestureName);
currentFrameCount = 0; currentFrameCount = 0;
} }
} }
@ -37,6 +36,7 @@ namespace KinectUtils
else if (TestEndConditions(body) && currentFrameCount >= MinNbOfFrames) else if (TestEndConditions(body) && currentFrameCount >= MinNbOfFrames)
{ {
OnGestureRecognized(body); OnGestureRecognized(body);
Console.WriteLine(GestureName);
IsRecognitionRunning = false; IsRecognitionRunning = false;
} }
} }

@ -18,6 +18,7 @@ namespace MyGesturesBank
new PostureHandUp(), new PostureHandUp(),
new RightHandUp(), new RightHandUp(),
new TwoHandsDragon(), new TwoHandsDragon(),
new ClapHands(),
// Ajoutez d'autres gestes ici // Ajoutez d'autres gestes ici
}; };
} }

@ -3,10 +3,11 @@ using Microsoft.Kinect;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LibMyGesturesBank namespace MyGesturesBank
{ {
public class ClapHands : Gesture public class ClapHands : Gesture
{ {
@ -22,7 +23,7 @@ namespace LibMyGesturesBank
var handLeft = body.Joints[JointType.HandLeft].Position; var handLeft = body.Joints[JointType.HandLeft].Position;
// Vérifie si les mains sont à une hauteur similaire et devant le corps // 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) protected override bool TestRunningGesture(Body body)

Loading…
Cancel
Save