UPDATE(KinectUtils)

pull/19/head
Johan LACHENAL 1 year ago
parent beff9b5954
commit 77f04c9162

@ -10,7 +10,10 @@ namespace KinectUtils
{
public IEnumerable<BaseGesture> CreateGestures()
{
throw new NotImplementedException();
return new List<BaseGesture>
{
new PostureHandsOnHead()
};
}
}
}

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

@ -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<BaseGesture> 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)
{
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))
{
throw new NotImplementedException();
}
}
}
}
}
}
}
}
}

Loading…
Cancel
Save