|
|
@ -1,4 +1,5 @@
|
|
|
|
using Lib;
|
|
|
|
using KinectUtils;
|
|
|
|
|
|
|
|
using Lib;
|
|
|
|
using Microsoft.Kinect;
|
|
|
|
using Microsoft.Kinect;
|
|
|
|
using MyGesturesBank;
|
|
|
|
using MyGesturesBank;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
@ -16,68 +17,10 @@ namespace ConsoleApp
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static void Main(string[] args)
|
|
|
|
static void Main(string[] args)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
AllGesturesFactory allGesturesFactory = new AllGesturesFactory();
|
|
|
|
|
|
|
|
GestureManager.AddGestures(allGesturesFactory);
|
|
|
|
KinectManager kinectManager = new KinectManager();
|
|
|
|
KinectManager kinectManager = new KinectManager();
|
|
|
|
Canvas skeletonCanvas = null;
|
|
|
|
GestureManager.StartAcquiringFrames(kinectManager);
|
|
|
|
KinectStreamsFactory Factory = new KinectStreamsFactory(kinectManager, skeletonCanvas);
|
|
|
|
|
|
|
|
BodyImageStream CurrentKinectStream = (BodyImageStream)Factory[KinectStreams.Body];
|
|
|
|
|
|
|
|
CurrentKinectStream.Start();
|
|
|
|
|
|
|
|
PostureHandUp handUpPosture = new PostureHandUp();
|
|
|
|
|
|
|
|
PostureHandsOnHead handsOnHeadPosture = new PostureHandsOnHead();
|
|
|
|
|
|
|
|
handUpPosture.GestureRecognized += (sender, e) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine("Posture Hand Up reconnue !");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
handsOnHeadPosture.GestureRecognized += (sender, e) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Console.WriteLine("Posture Hands On Head reconnue !");
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Body body = null;
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
body = CurrentKinectStream.Bodies.FirstOrDefault();
|
|
|
|
|
|
|
|
if (body != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
handUpPosture.TestGesture(body);
|
|
|
|
|
|
|
|
handsOnHeadPosture.TestGesture(body);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Thread.Sleep(50);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// KinectManager kinectManager = new KinectManager();
|
|
|
|
|
|
|
|
// if (kinectManager.StartSensor())
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// Console.WriteLine("Kinect n'est pas connecté ou non reconnu.");
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // Créez les instances de vos postures
|
|
|
|
|
|
|
|
// PostureHandUp handUpPosture = new PostureHandUp();
|
|
|
|
|
|
|
|
// PostureHandsOnHead handsOnHeadPosture = new PostureHandsOnHead();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // Abonnez-vous aux événements de reconnaissance de posture
|
|
|
|
|
|
|
|
// handUpPosture.GestureRecognized += (sender, e) =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// Console.WriteLine("Posture Hand Up reconnue !");
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// handsOnHeadPosture.GestureRecognized += (sender, e) =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// Console.WriteLine("Posture Hands On Head reconnue !");
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // Boucle pour tester les postures
|
|
|
|
|
|
|
|
// while (true)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// Body body = kinecManager.GetNextBody(); // Méthode fictive pour obtenir les données du corps
|
|
|
|
|
|
|
|
// if (body != null)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// handUpPosture.TestGesture(body);
|
|
|
|
|
|
|
|
// handsOnHeadPosture.TestGesture(body);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Thread.Sleep(50); // Une petite pause pour ne pas surcharger le CPU
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|