UPDATE(dev): recognition works

pull/21/head
Johan LACHENAL 1 year ago
parent 854c6edc20
commit 42c338e18c

@ -17,10 +17,18 @@ namespace ConsoleApp
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
// allumer la kinect
KinectManager kinectManager = new KinectManager();
kinectManager.StartSensor();
Console.WriteLine("Kinect démarre");
AllGesturesFactory allGesturesFactory = new AllGesturesFactory(); AllGesturesFactory allGesturesFactory = new AllGesturesFactory();
GestureManager.AddGestures(allGesturesFactory); GestureManager.AddGestures(allGesturesFactory);
KinectManager kinectManager = new KinectManager();
GestureManager.StartAcquiringFrames(kinectManager); GestureManager.StartAcquiringFrames(kinectManager);
while (true)
{
//Thread.Sleep(50);
}
} }
} }
} }

@ -20,11 +20,7 @@ namespace KinectUtils
public static void AddGestures(IGestureFactory factory) public static void AddGestures(IGestureFactory factory)
{ {
var gestures = factory.CreateGestures(); KnownGestures = (List<BaseGesture>)factory.CreateGestures();
foreach (var gesture in gestures)
{
AddGesture(gesture);
}
} }
public static void AddGesture(BaseGesture gesture) public static void AddGesture(BaseGesture gesture)
{ {
@ -55,12 +51,19 @@ namespace KinectUtils
{ {
if (bodyframe != null) if (bodyframe != null)
{ {
if(bodies == null)
{
bodies = new Body[bodyframe.BodyCount];
}
bodyframe.GetAndRefreshBodyData(bodies); bodyframe.GetAndRefreshBodyData(bodies);
if (bodies != null)
{
foreach (var body in bodies) foreach (var body in bodies)
{ {
if (body.IsTracked) if (body.IsTracked)
{ {
foreach(var gesture in KnownGestures) foreach (var gesture in KnownGestures)
{ {
gesture.TestGesture(body); gesture.TestGesture(body);
} }
@ -70,4 +73,5 @@ namespace KinectUtils
} }
} }
} }
} }
}

@ -39,6 +39,7 @@ namespace LibMyGesturesBank
// Le clap est un geste instantané, donc si les conditions sont remplies une fois, le geste est considéré comme terminé // Le clap est un geste instantané, donc si les conditions sont remplies une fois, le geste est considéré comme terminé
return true; return true;
} }
public override string GestureName => "Clap Hands";
} }
} }

@ -13,6 +13,7 @@ namespace MyGesturesBank
return handRight.Y > head.Y || handLeft.Y > head.Y; return handRight.Y > head.Y || handLeft.Y > head.Y;
} }
public override string GestureName => "Posture Hand Up";
} }

@ -17,6 +17,7 @@ namespace MyGesturesBank
return Math.Abs(handRight.Y - head.Y) < threshold && Math.Abs(handLeft.Y - head.Y) < threshold; return Math.Abs(handRight.Y - head.Y) < threshold && Math.Abs(handLeft.Y - head.Y) < threshold;
} }
public override string GestureName => "Posture Hands On Head";
} }

@ -17,6 +17,7 @@ namespace MyGesturesBank
return handRight.Y > head.Y; return handRight.Y > head.Y;
} }
public override string GestureName => "Right Hand Up";
} }
} }

@ -55,6 +55,7 @@ namespace MyGesturesBank
// Condition de fin : la main droite est bien à droite de la base de la colonne vertébrale // Condition de fin : la main droite est bien à droite de la base de la colonne vertébrale
return handRight.X > spineBase.X + 0.5f; // Ajustez cette valeur selon le besoin return handRight.X > spineBase.X + 0.5f; // Ajustez cette valeur selon le besoin
} }
public override string GestureName => "Swipe Right Hand";
} }
} }

@ -18,6 +18,7 @@ namespace MyGesturesBank
return handRight.Y > head.Y && handLeft.Y > head.Y; return handRight.Y > head.Y && handLeft.Y > head.Y;
} }
public override string GestureName => "Two Hands Dragon";
} }
} }

Loading…
Cancel
Save