UPDATE(dev): add test in program

pull/21/head
Johan LACHENAL 1 year ago
parent 53f080b7cf
commit 1ac8d06ad5

@ -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
// }
//}
} }
} }
} }

@ -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
};
}
}
}

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

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

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

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

Loading…
Cancel
Save