|
|
@ -1,14 +1,18 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Runtime.Remoting.Messaging;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Lib;
|
|
|
|
using Lib;
|
|
|
|
|
|
|
|
using Microsoft.Kinect;
|
|
|
|
|
|
|
|
|
|
|
|
namespace KinectUtils
|
|
|
|
namespace KinectUtils
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static class GestureManager
|
|
|
|
static class GestureManager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
static private BodyFrameReader bodyFrameReader;
|
|
|
|
|
|
|
|
static private Body[] bodies;
|
|
|
|
static event EventHandler GestureRecognized;
|
|
|
|
static event EventHandler GestureRecognized;
|
|
|
|
static KinectManager KinectManager { get; set; }
|
|
|
|
static KinectManager KinectManager { get; set; }
|
|
|
|
static List<BaseGesture> KnownGestures { get; set; }
|
|
|
|
static List<BaseGesture> KnownGestures { get; set; }
|
|
|
@ -30,11 +34,32 @@ namespace KinectUtils
|
|
|
|
}
|
|
|
|
}
|
|
|
|
static public void StartAcquiringFrames(KinectManager kinectManager)
|
|
|
|
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))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|