From beff9b59540b437262a6f109496772aeafe75929 Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Sat, 3 Feb 2024 12:26:21 +0100 Subject: [PATCH 1/5] Add gestures to the test methods --- Sources/ConsoleApp/ConsoleApp.csproj | 9 +++++ Sources/ConsoleApp/Program.cs | 34 +++++++++++++++++-- Sources/KinectUtils/GestureManager.cs | 4 +++ Sources/Lib/BodyImageStream.cs | 18 +++++----- .../LibMyGesturesBank/MyGesturesBank.csproj | 2 -- .../LibMyGesturesBank/PostureHandsOnHead .cs | 5 +-- Sources/LibMyGesturesBank/RightHandUp.cs | 12 ------- Sources/LibMyGesturesBank/TwoHandsDragon.cs | 12 ------- 8 files changed, 58 insertions(+), 38 deletions(-) delete mode 100644 Sources/LibMyGesturesBank/RightHandUp.cs delete mode 100644 Sources/LibMyGesturesBank/TwoHandsDragon.cs diff --git a/Sources/ConsoleApp/ConsoleApp.csproj b/Sources/ConsoleApp/ConsoleApp.csproj index 11b775b..4d45df5 100644 --- a/Sources/ConsoleApp/ConsoleApp.csproj +++ b/Sources/ConsoleApp/ConsoleApp.csproj @@ -36,6 +36,7 @@ ..\packages\Microsoft.Kinect.2.0.1410.19000\lib\net45\Microsoft.Kinect.dll + @@ -54,6 +55,14 @@ + + {2d44487e-f514-4063-9494-2af1e8c9e9c8} + KinectUtils + + + {2496DFB1-EB55-47A1-A780-211E079B289D} + MyGesturesBank + {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/ConsoleApp/Program.cs b/Sources/ConsoleApp/Program.cs index fb7ff8d..b8f5ea7 100644 --- a/Sources/ConsoleApp/Program.cs +++ b/Sources/ConsoleApp/Program.cs @@ -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 // } - } + //} + } } } diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs index d9e08a5..339375f 100644 --- a/Sources/KinectUtils/GestureManager.cs +++ b/Sources/KinectUtils/GestureManager.cs @@ -32,5 +32,9 @@ namespace KinectUtils { throw new NotImplementedException(); } + static public void StopAcquiringFrames() + { + throw new NotImplementedException(); + } } } diff --git a/Sources/Lib/BodyImageStream.cs b/Sources/Lib/BodyImageStream.cs index 8b7b9bc..eea0d35 100644 --- a/Sources/Lib/BodyImageStream.cs +++ b/Sources/Lib/BodyImageStream.cs @@ -153,20 +153,22 @@ namespace Lib if (bodyframe != null) { bodyframe.GetAndRefreshBodyData(this.bodies); - - Canvas.Children.Clear(); // nettoyer le Canvas avant de dessiner - - foreach (var body in this.bodies) + // nettoyer le Canvas avant de dessiner + if (Canvas != null) { - if (body.IsTracked) + Canvas.Children.Clear(); + foreach (var body in this.bodies) { - // dessiner le squelette - drawskeleton(body); + if (body.IsTracked) + { + // dessiner le squelette + drawskeleton(body); + } } } } } } } -} + } diff --git a/Sources/LibMyGesturesBank/MyGesturesBank.csproj b/Sources/LibMyGesturesBank/MyGesturesBank.csproj index 7a43ab1..aedd2ed 100644 --- a/Sources/LibMyGesturesBank/MyGesturesBank.csproj +++ b/Sources/LibMyGesturesBank/MyGesturesBank.csproj @@ -47,8 +47,6 @@ - - diff --git a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs index 7ad19b9..4b8df45 100644 --- a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs +++ b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs @@ -20,10 +20,11 @@ namespace MyGesturesBank private bool IsHandNearHead(Joint hand, Joint head) { // Exemple de condition : la main est à moins de 30 cm de la tête - return Math.Sqrt( + double distance = Math.Sqrt( Math.Pow(hand.Position.X - head.Position.X, 2) + Math.Pow(hand.Position.Y - head.Position.Y, 2) + - Math.Pow(hand.Position.Z - head.Position.Z, 2)) < 0.3; + Math.Pow(hand.Position.Z - head.Position.Z, 2)); + return distance < 0.3 && distance > 0; } public override string GestureName => "Hands On Head"; diff --git a/Sources/LibMyGesturesBank/RightHandUp.cs b/Sources/LibMyGesturesBank/RightHandUp.cs deleted file mode 100644 index 259d3a5..0000000 --- a/Sources/LibMyGesturesBank/RightHandUp.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LibMyGesturesBank -{ - internal class RightHandUp - { - } -} diff --git a/Sources/LibMyGesturesBank/TwoHandsDragon.cs b/Sources/LibMyGesturesBank/TwoHandsDragon.cs deleted file mode 100644 index a5e9d5f..0000000 --- a/Sources/LibMyGesturesBank/TwoHandsDragon.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace LibMyGesturesBank -{ - internal class TwoHandsDragon - { - } -} From 0857ab536a5bb68317b315c6b3be232c4a0b8d36 Mon Sep 17 00:00:00 2001 From: "louis.dufour" Date: Wed, 7 Feb 2024 08:37:38 +0100 Subject: [PATCH 2/5] Add(CreateGestures): gesture and posture --- Sources/LibMyGesturesBank/ClapHands.cs | 44 +++++++++++++++++++ .../LibMyGesturesBank/MyGesturesBank.csproj | 5 +++ Sources/LibMyGesturesBank/PostureHandUp.cs | 10 +++-- .../LibMyGesturesBank/PostureHandsOnHead .cs | 24 +++------- Sources/LibMyGesturesBank/RightHandUp.cs | 14 +++++- Sources/LibMyGesturesBank/SwipeRightHand.cs | 36 ++++++++++++--- Sources/LibMyGesturesBank/TwoHandsDragon.cs | 15 ++++++- 7 files changed, 115 insertions(+), 33 deletions(-) create mode 100644 Sources/LibMyGesturesBank/ClapHands.cs diff --git a/Sources/LibMyGesturesBank/ClapHands.cs b/Sources/LibMyGesturesBank/ClapHands.cs new file mode 100644 index 0000000..c1b6e81 --- /dev/null +++ b/Sources/LibMyGesturesBank/ClapHands.cs @@ -0,0 +1,44 @@ +using KinectUtils; +using Microsoft.Kinect; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibMyGesturesBank +{ + public class ClapHands : Gesture + { + protected override bool TestInitialConditions(Body body) + { + // Les conditions initiales ne sont pas strictes pour un clap, on commence donc directement avec TestPosture et TestRunningGesture + return true; + } + + protected override bool TestPosture(Body body) + { + var handRight = body.Joints[JointType.HandRight].Position; + var handLeft = body.Joints[JointType.HandLeft].Position; + + // Vérifie si les mains sont à une hauteur similaire et devant le corps + return Math.Abs(handRight.Y - handLeft.Y) < 0.1f && handRight.Z < 0.5f && handLeft.Z < 0.5f; + } + + protected override bool TestRunningGesture(Body body) + { + var handRight = body.Joints[JointType.HandRight].Position; + var handLeft = body.Joints[JointType.HandLeft].Position; + + // Vérifie si les mains se sont rencontrées au centre + return Math.Abs(handRight.X - handLeft.X) < 0.1f; + } + + protected override bool TestEndConditions(Body body) + { + // Le clap est un geste instantané, donc si les conditions sont remplies une fois, le geste est considéré comme terminé + return true; + } + } + +} diff --git a/Sources/LibMyGesturesBank/MyGesturesBank.csproj b/Sources/LibMyGesturesBank/MyGesturesBank.csproj index 0601293..562b0da 100644 --- a/Sources/LibMyGesturesBank/MyGesturesBank.csproj +++ b/Sources/LibMyGesturesBank/MyGesturesBank.csproj @@ -44,6 +44,7 @@ + @@ -52,6 +53,10 @@ + + {2d44487e-f514-4063-9494-2af1e8c9e9c8} + KinectUtils + {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/LibMyGesturesBank/PostureHandUp.cs b/Sources/LibMyGesturesBank/PostureHandUp.cs index 54b1a6e..38f5861 100644 --- a/Sources/LibMyGesturesBank/PostureHandUp.cs +++ b/Sources/LibMyGesturesBank/PostureHandUp.cs @@ -7,11 +7,13 @@ namespace MyGesturesBank { protected override bool TestPosture(Body body) { - // Exemple de condition : la main droite est plus haute que l'épaule droite - return body.Joints[JointType.HandRight].Position.Y > body.Joints[JointType.ShoulderRight].Position.Y; - } + var handRight = body.Joints[JointType.HandRight].Position; + var handLeft = body.Joints[JointType.HandLeft].Position; + var head = body.Joints[JointType.Head].Position; - public override string GestureName => "Hand Up"; + return handRight.Y > head.Y || handLeft.Y > head.Y; + } } + } diff --git a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs index 4b8df45..239eee1 100644 --- a/Sources/LibMyGesturesBank/PostureHandsOnHead .cs +++ b/Sources/LibMyGesturesBank/PostureHandsOnHead .cs @@ -8,27 +8,15 @@ namespace MyGesturesBank { protected override bool TestPosture(Body body) { - // Condition pour la main droite proche de la tête - bool rightHandNearHead = IsHandNearHead(body.Joints[JointType.HandRight], body.Joints[JointType.Head]); + var handRight = body.Joints[JointType.HandRight].Position; + var handLeft = body.Joints[JointType.HandLeft].Position; + var head = body.Joints[JointType.Head].Position; - // Condition pour la main gauche proche de la tête - bool leftHandNearHead = IsHandNearHead(body.Joints[JointType.HandLeft], body.Joints[JointType.Head]); + // Ajustez les seuils selon la précision souhaitée + var threshold = 0.1f; // Seuil pour ajuster la précision de la détection - return rightHandNearHead && leftHandNearHead; + return Math.Abs(handRight.Y - head.Y) < threshold && Math.Abs(handLeft.Y - head.Y) < threshold; } - - private bool IsHandNearHead(Joint hand, Joint head) - { - // Exemple de condition : la main est à moins de 30 cm de la tête - double distance = Math.Sqrt( - Math.Pow(hand.Position.X - head.Position.X, 2) + - Math.Pow(hand.Position.Y - head.Position.Y, 2) + - Math.Pow(hand.Position.Z - head.Position.Z, 2)); - return distance < 0.3 && distance > 0; - } - - public override string GestureName => "Hands On Head"; - } diff --git a/Sources/LibMyGesturesBank/RightHandUp.cs b/Sources/LibMyGesturesBank/RightHandUp.cs index 1c6734a..8de2ef5 100644 --- a/Sources/LibMyGesturesBank/RightHandUp.cs +++ b/Sources/LibMyGesturesBank/RightHandUp.cs @@ -1,4 +1,6 @@ -using System; +using KinectUtils; +using Microsoft.Kinect; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +8,15 @@ using System.Threading.Tasks; namespace MyGesturesBank { - internal class RightHandUp + public class RightHandUp : Posture { + protected override bool TestPosture(Body body) + { + var handRight = body.Joints[JointType.HandRight].Position; + var head = body.Joints[JointType.Head].Position; + + return handRight.Y > head.Y; + } } + } diff --git a/Sources/LibMyGesturesBank/SwipeRightHand.cs b/Sources/LibMyGesturesBank/SwipeRightHand.cs index d58ddd0..c4c8eeb 100644 --- a/Sources/LibMyGesturesBank/SwipeRightHand.cs +++ b/Sources/LibMyGesturesBank/SwipeRightHand.cs @@ -10,28 +10,50 @@ namespace MyGesturesBank { public class SwipeRightHand : Gesture { + + private float previousX = float.NaN; + protected override bool TestInitialConditions(Body body) { - // Implémentez la logique pour vérifier les conditions initiales du balayage à droite - return false; + var handRight = body.Joints[JointType.HandRight].Position; + var shoulderRight = body.Joints[JointType.ShoulderRight].Position; + + // Conditions initiales : main droite au niveau ou à droite de l'épaule droite, mais pas trop éloignée + return handRight.X >= shoulderRight.X && handRight.X - shoulderRight.X < 0.5f; } protected override bool TestPosture(Body body) { - // Implémentez la vérification de la posture pour le balayage à droite - return false; + var handRight = body.Joints[JointType.HandRight].Position; + var head = body.Joints[JointType.Head].Position; + + // La main droite ne doit pas être plus haute que la tête + return handRight.Y <= head.Y; } protected override bool TestRunningGesture(Body body) { - // Implémentez la dynamique du geste de balayage à droite + var handRight = body.Joints[JointType.HandRight].Position.X; + + if (!float.IsNaN(previousX)) + { + // Vérifie si la main droite se déplace vers la droite + bool isMovingRight = handRight > previousX; + previousX = handRight; + return isMovingRight; + } + + previousX = handRight; return false; } protected override bool TestEndConditions(Body body) { - // Vérifiez si les conditions de fin du geste de balayage à droite sont remplies - return false; + var handRight = body.Joints[JointType.HandRight].Position; + var spineBase = body.Joints[JointType.SpineBase].Position; + + // Condition de fin : la main droite est bien à droite de la base de la colonne vertébrale + return handRight.X > spineBase.X + 0.5f; // Ajustez cette valeur selon le besoin } } diff --git a/Sources/LibMyGesturesBank/TwoHandsDragon.cs b/Sources/LibMyGesturesBank/TwoHandsDragon.cs index 6cafd63..db3a161 100644 --- a/Sources/LibMyGesturesBank/TwoHandsDragon.cs +++ b/Sources/LibMyGesturesBank/TwoHandsDragon.cs @@ -1,4 +1,6 @@ -using System; +using KinectUtils; +using Microsoft.Kinect; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +8,16 @@ using System.Threading.Tasks; namespace MyGesturesBank { - internal class TwoHandsDragon + public class TwoHandsDragon : Posture { + protected override bool TestPosture(Body body) + { + var handRight = body.Joints[JointType.HandRight].Position; + var handLeft = body.Joints[JointType.HandLeft].Position; + var head = body.Joints[JointType.Head].Position; + + return handRight.Y > head.Y && handLeft.Y > head.Y; + } } + } From 77f04c9162e3475777fbb6ce191814781b12e74f Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Wed, 7 Feb 2024 09:01:35 +0100 Subject: [PATCH 3/5] UPDATE(KinectUtils) --- Sources/KinectUtils/AllGesturesFactory.cs | 5 +++- Sources/KinectUtils/Gesture.cs | 7 +++-- Sources/KinectUtils/GestureManager.cs | 31 ++++++++++++++++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Sources/KinectUtils/AllGesturesFactory.cs b/Sources/KinectUtils/AllGesturesFactory.cs index 970478a..7ef77ae 100644 --- a/Sources/KinectUtils/AllGesturesFactory.cs +++ b/Sources/KinectUtils/AllGesturesFactory.cs @@ -10,7 +10,10 @@ namespace KinectUtils { public IEnumerable CreateGestures() { - throw new NotImplementedException(); + return new List + { + new PostureHandsOnHead() + }; } } } diff --git a/Sources/KinectUtils/Gesture.cs b/Sources/KinectUtils/Gesture.cs index f1140b3..42dd8ad 100644 --- a/Sources/KinectUtils/Gesture.cs +++ b/Sources/KinectUtils/Gesture.cs @@ -22,9 +22,12 @@ namespace KinectUtils get { return _maxNbOfFrames; } private set { _maxNbOfFrames = value; } } - public override void TestGesture(Body body) + public bool TestGesture(Body body) { - + TestInitialConditions(body); + TestPosture(body); + TestRunningGesture(body); + TestEndConditions(body); } abstract protected bool TestInitialConditions(Body body); abstract protected bool TestPosture(Body body); diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs index 339375f..b1e2cce 100644 --- a/Sources/KinectUtils/GestureManager.cs +++ b/Sources/KinectUtils/GestureManager.cs @@ -1,14 +1,18 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading.Tasks; using Lib; +using Microsoft.Kinect; namespace KinectUtils { static class GestureManager { + static private BodyFrameReader bodyFrameReader; + static private Body[] bodies; static event EventHandler GestureRecognized; static KinectManager KinectManager { get; set; } static List KnownGestures { get; set; } @@ -30,11 +34,32 @@ namespace KinectUtils } static public void StartAcquiringFrames(KinectManager kinectManager) { - throw new NotImplementedException(); + bodyFrameReader = kinectManager.Sensor.BodyFrameSource.OpenReader(); + bodyFrameReader.FrameArrived += Reader_BodyFrameArrived; } - static public void StopAcquiringFrames() + + static private void Reader_BodyFrameArrived(object sender, BodyFrameArrivedEventArgs e) { - throw new NotImplementedException(); + using (var bodyframe = e.FrameReference.AcquireFrame()) + { + if (bodyframe != null) + { + bodyframe.GetAndRefreshBodyData(bodies); + foreach (var body in bodies) + { + if (body.IsTracked) + { + foreach(var gesture in KnownGestures) + { + if (gesture.TestGesture(body)) + { + + } + } + } + } + } + } } } } From e33c10ed5b33309c12accfb06fe9a60fd731f2e6 Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Wed, 7 Feb 2024 09:16:09 +0100 Subject: [PATCH 4/5] UPDATE(KinectUtils) --- Sources/KinectUtils/GestureManager.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/KinectUtils/GestureManager.cs b/Sources/KinectUtils/GestureManager.cs index b1e2cce..8d703c9 100644 --- a/Sources/KinectUtils/GestureManager.cs +++ b/Sources/KinectUtils/GestureManager.cs @@ -25,7 +25,10 @@ namespace KinectUtils { foreach (var gesture in gestures) { - KnownGestures.Add(gesture); + if (!gestures.Contains(gesture)) + { + KnownGestures.Add(gesture); + } } } static public void RemoveGesture(BaseGesture gesture) @@ -51,10 +54,7 @@ namespace KinectUtils { foreach(var gesture in KnownGestures) { - if (gesture.TestGesture(body)) - { - - } + gesture.TestGesture(body); } } } From 6a1611d5113842a71b09b78f350d54814ca2ce52 Mon Sep 17 00:00:00 2001 From: "johan.lachenal" Date: Wed, 7 Feb 2024 09:37:40 +0100 Subject: [PATCH 5/5] UPDATE(KinectUtils): ADD several changed to make the gestureManager work but still some development to do to test --- Sources/KinectUtils/AllGesturesFactory.cs | 8 +++---- Sources/KinectUtils/BaseGesture.cs | 2 +- Sources/KinectUtils/Gesture.cs | 2 +- Sources/KinectUtils/IGestureFactory.cs | 2 +- Sources/KinectUtils/KinectUtils.csproj | 4 ---- Sources/KinectUtils/Posture.cs | 2 +- .../LibMyGesturesBank/AllGesturesFactory.cs | 22 +++++++++++++++++++ 7 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 Sources/LibMyGesturesBank/AllGesturesFactory.cs diff --git a/Sources/KinectUtils/AllGesturesFactory.cs b/Sources/KinectUtils/AllGesturesFactory.cs index 719a15e..7305108 100644 --- a/Sources/KinectUtils/AllGesturesFactory.cs +++ b/Sources/KinectUtils/AllGesturesFactory.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using MyGesturesBank; +using KinectUtils; -namespace KinectUtils +namespace MyGesturesBank { public class AllGesturesFactory : IGestureFactory { @@ -13,8 +13,8 @@ namespace KinectUtils { return new List { - new SwipeRightHand(), - new ClapHands() + //new SwipeRightHand(), + //new ClapHands() // Ajoutez d'autres gestes ici }; } diff --git a/Sources/KinectUtils/BaseGesture.cs b/Sources/KinectUtils/BaseGesture.cs index c414db6..5b69899 100644 --- a/Sources/KinectUtils/BaseGesture.cs +++ b/Sources/KinectUtils/BaseGesture.cs @@ -9,7 +9,7 @@ namespace KinectUtils public event EventHandler GestureRecognized; // Nom du geste - marqué comme virtual pour permettre la substitution - public string GestureName { get; protected set; } + public virtual string GestureName { get; protected set; } // Méthode abstraite pour tester le geste public abstract void TestGesture(Body body); diff --git a/Sources/KinectUtils/Gesture.cs b/Sources/KinectUtils/Gesture.cs index b05249e..d6dc9d1 100644 --- a/Sources/KinectUtils/Gesture.cs +++ b/Sources/KinectUtils/Gesture.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace KinectUtils { - abstract class Gesture : BaseGesture + public abstract class Gesture : BaseGesture { public bool IsRecognitionRunning { get; set; } diff --git a/Sources/KinectUtils/IGestureFactory.cs b/Sources/KinectUtils/IGestureFactory.cs index f78c453..b01155f 100644 --- a/Sources/KinectUtils/IGestureFactory.cs +++ b/Sources/KinectUtils/IGestureFactory.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace KinectUtils { - interface IGestureFactory + public interface IGestureFactory { IEnumerable CreateGestures(); } diff --git a/Sources/KinectUtils/KinectUtils.csproj b/Sources/KinectUtils/KinectUtils.csproj index 8343b15..c64f282 100644 --- a/Sources/KinectUtils/KinectUtils.csproj +++ b/Sources/KinectUtils/KinectUtils.csproj @@ -52,10 +52,6 @@ - - {2496dfb1-eb55-47a1-a780-211e079b289d} - MyGesturesBank - {0751c83e-7845-4e5f-a5d3-e11aba393aca} Lib diff --git a/Sources/KinectUtils/Posture.cs b/Sources/KinectUtils/Posture.cs index a95b2c6..d64b672 100644 --- a/Sources/KinectUtils/Posture.cs +++ b/Sources/KinectUtils/Posture.cs @@ -16,7 +16,7 @@ namespace KinectUtils if (TestPosture(body)) { // Posture is recognized - OnGestureRecognized(); + OnGestureRecognized(body); } } diff --git a/Sources/LibMyGesturesBank/AllGesturesFactory.cs b/Sources/LibMyGesturesBank/AllGesturesFactory.cs new file mode 100644 index 0000000..8b62daa --- /dev/null +++ b/Sources/LibMyGesturesBank/AllGesturesFactory.cs @@ -0,0 +1,22 @@ +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 CreateGestures() + { + return new List + { + new SwipeRightHand(), + //new ClapHands() + // Ajoutez d'autres gestes ici + }; + } + } +}