|
|
|
@ -1,11 +1,14 @@
|
|
|
|
|
using Lib;
|
|
|
|
|
using Microsoft.Kinect;
|
|
|
|
|
using MyGesturesBank;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleApp
|
|
|
|
|
{
|
|
|
|
@ -13,6 +16,32 @@ namespace ConsoleApp
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
KinectManager kinectManager = new KinectManager();
|
|
|
|
|
Canvas skeletonCanvas = null;
|
|
|
|
|
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())
|
|
|
|
|
// {
|
|
|
|
@ -38,7 +67,7 @@ namespace ConsoleApp
|
|
|
|
|
// // Boucle pour tester les postures
|
|
|
|
|
// while (true)
|
|
|
|
|
// {
|
|
|
|
|
// Body body = kinectManager.GetNextBody(); // Méthode fictive pour obtenir les données du corps
|
|
|
|
|
// Body body = kinecManager.GetNextBody(); // Méthode fictive pour obtenir les données du corps
|
|
|
|
|
// if (body != null)
|
|
|
|
|
// {
|
|
|
|
|
// handUpPosture.TestGesture(body);
|
|
|
|
@ -47,7 +76,8 @@ namespace ConsoleApp
|
|
|
|
|
|
|
|
|
|
// Thread.Sleep(50); // Une petite pause pour ne pas surcharger le CPU
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|