|
|
@ -9,23 +9,38 @@ namespace KinectUtils
|
|
|
|
{
|
|
|
|
{
|
|
|
|
abstract class Gesture : BaseGesture
|
|
|
|
abstract class Gesture : BaseGesture
|
|
|
|
{
|
|
|
|
{
|
|
|
|
protected int _maxNbOfFrames;
|
|
|
|
public bool IsTesting { get; protected set; }
|
|
|
|
protected int _minNbOfFrames;
|
|
|
|
protected int MinNbOfFrames = 10; // Exemple de valeur, ajustez selon le geste
|
|
|
|
private int currentFrameCount;
|
|
|
|
protected int MaxNbOfFrames = 50; // Exemple de valeur, ajustez selon le geste
|
|
|
|
public bool isRecognitionRunning { get; set; }
|
|
|
|
private int mCurrentFrameCount = 0;
|
|
|
|
public int MinNbOfFrames {
|
|
|
|
// public bool isRecognitionRunning { get; set; }
|
|
|
|
get { return _minNbOfFrames; }
|
|
|
|
|
|
|
|
private set { _minNbOfFrames = value; }
|
|
|
|
public override void TestGesture(Body body)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
public int MaxNbOfFrames
|
|
|
|
if (!IsTesting)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
get { return _maxNbOfFrames; }
|
|
|
|
if (TestInitialConditions(body))
|
|
|
|
private set { _maxNbOfFrames = value; }
|
|
|
|
{
|
|
|
|
|
|
|
|
IsTesting = true;
|
|
|
|
|
|
|
|
mCurrentFrameCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public override void TestGesture(Body body)
|
|
|
|
}
|
|
|
|
|
|
|
|
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 TestInitialConditions(Body body);
|
|
|
|
abstract protected bool TestPosture(Body body);
|
|
|
|
abstract protected bool TestPosture(Body body);
|
|
|
|
abstract protected bool TestRunningGesture(Body body);
|
|
|
|
abstract protected bool TestRunningGesture(Body body);
|
|
|
|