You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
using Microsoft.Kinect;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace KinectUtils
|
|
{
|
|
abstract class Gesture : BaseGesture
|
|
{
|
|
public bool IsTesting { get; protected set; }
|
|
protected int MinNbOfFrames = 10; // Exemple de valeur, ajustez selon le geste
|
|
protected int MaxNbOfFrames = 50; // Exemple de valeur, ajustez selon le geste
|
|
private int mCurrentFrameCount = 0;
|
|
// public bool isRecognitionRunning { get; set; }
|
|
|
|
public override void TestGesture(Body body)
|
|
{
|
|
if (!IsTesting)
|
|
{
|
|
if (TestInitialConditions(body))
|
|
{
|
|
IsTesting = true;
|
|
mCurrentFrameCount = 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mCurrentFrameCount++;
|
|
|
|
if (!TestPosture(body) || !TestRunningGesture(body) || mCurrentFrameCount > MaxNbOfFrames)
|
|
{
|
|
IsTesting = false;
|
|
}
|
|
else if (TestEndConditions(body) && mCurrentFrameCount >= MinNbOfFrames)
|
|
{
|
|
OnGestureRecognized(body);
|
|
IsTesting = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
abstract protected bool TestInitialConditions(Body body);
|
|
abstract protected bool TestPosture(Body body);
|
|
abstract protected bool TestRunningGesture(Body body);
|
|
abstract protected bool TestEndConditions(Body body);
|
|
}
|
|
}
|