You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.0 KiB

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
{
internal class Program
{
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())
// {
// 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
// }
//}
}
}
}