Louis DUFOUR 1 year ago
commit 0cf3fc187d

@ -1,4 +1,5 @@
using Lib;
using KinectUtils;
using Lib;
using Microsoft.Kinect;
using MyGesturesBank;
using System;
@ -16,68 +17,10 @@ namespace ConsoleApp
{
static void Main(string[] args)
{
AllGesturesFactory allGesturesFactory = new AllGesturesFactory();
GestureManager.AddGestures(allGesturesFactory);
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
// }
//}
GestureManager.StartAcquiringFrames(kinectManager);
}
}
}

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KinectUtils;
namespace MyGesturesBank
{
public class AllGesturesFactory : IGestureFactory
{
public IEnumerable<BaseGesture> CreateGestures()
{
return new List<BaseGesture>
{
//new SwipeRightHand(),
//new ClapHands()
// Ajoutez d'autres gestes ici
};
}
}
}

@ -22,6 +22,7 @@ namespace KinectUtils
if (TestInitialConditions(body))
{
IsRecognitionRunning = true;
Console.WriteLine(GestureName);
currentFrameCount = 0;
}
}

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;

@ -42,7 +42,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AllGesturesFactory.cs" />
<Compile Include="BaseGesture.cs" />
<Compile Include="BaseMapping.cs" />
<Compile Include="Gesture.cs" />

@ -14,7 +14,11 @@ namespace MyGesturesBank
return new List<BaseGesture>
{
new SwipeRightHand(),
//new ClapHands()
new PostureHandsOnHead(),
new PostureHandUp(),
new RightHandUp(),
new SwipeRightHand(),
new TwoHandsDragon(),
// Ajoutez d'autres gestes ici
};
}

@ -44,6 +44,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AllGesturesFactory.cs" />
<Compile Include="ClapHands.cs" />
<Compile Include="PostureHandsOnHead .cs" />
<Compile Include="PostureHandUp.cs" />

Loading…
Cancel
Save