|
@@ -40,6 +40,7 @@ namespace bbiwarg
|
|
|
return videoFrame;
|
|
|
}
|
|
|
}
|
|
|
+ private int lastFrame = int.MaxValue;
|
|
|
|
|
|
public OutputImage[] OutputImages { get; private set; }
|
|
|
|
|
@@ -58,7 +59,7 @@ namespace bbiwarg
|
|
|
|
|
|
private TouchEventVisualizer touchEventVisualizer;
|
|
|
|
|
|
- private int videoFrame = 1;
|
|
|
+ private int videoFrame = 0;
|
|
|
|
|
|
public VideoHandle(IInputProvider inputProvider)
|
|
|
{
|
|
@@ -124,9 +125,10 @@ namespace bbiwarg
|
|
|
|
|
|
private void processFrameUpdate()
|
|
|
{
|
|
|
+ bool newStarted = (lastFrame > CurrentFrame);
|
|
|
Timer.start("processFrameUpdate");
|
|
|
|
|
|
- if (CurrentFrame == 1) {
|
|
|
+ if (newStarted) {
|
|
|
//initialize trackers
|
|
|
touchTracker = new TouchTracker();
|
|
|
fingerTracker = new FingerTracker();
|
|
@@ -190,7 +192,7 @@ namespace bbiwarg
|
|
|
|
|
|
//detect palm
|
|
|
Timer.start("palmDetection");
|
|
|
- if (CurrentFrame == 1)
|
|
|
+ if (newStarted)
|
|
|
palmDetector.reset();
|
|
|
palmDetector.findPalmQuad(OutputImages[3], handDetector.Hands);
|
|
|
Timer.stop("palmDetection");
|
|
@@ -234,7 +236,7 @@ namespace bbiwarg
|
|
|
// touch event visualizer
|
|
|
if (touchEventVisualizer == null)
|
|
|
touchEventVisualizer = new TouchEventVisualizer(Width, Height);
|
|
|
- if (CurrentFrame == 1)
|
|
|
+ if (newStarted)
|
|
|
touchEventVisualizer.Reset();
|
|
|
if (palmTouchDetector != null)
|
|
|
{
|
|
@@ -254,6 +256,7 @@ namespace bbiwarg
|
|
|
}
|
|
|
|
|
|
Timer.stop("processFrameUpdate");
|
|
|
+ lastFrame = CurrentFrame;
|
|
|
}
|
|
|
}
|
|
|
}
|