|
@@ -21,12 +21,8 @@ namespace bbiwarg
|
|
|
{
|
|
|
class InputHandler
|
|
|
{
|
|
|
- public OutputImage[] OutputImages { get; private set; }
|
|
|
-
|
|
|
private InputProvider inputProvider;
|
|
|
private InputFrame currentInputFrame;
|
|
|
- private int currentFrameID;
|
|
|
- private int lastFrameID;
|
|
|
|
|
|
private DepthImage depthImage;
|
|
|
private EdgeImage edgeImage;
|
|
@@ -45,11 +41,13 @@ namespace bbiwarg
|
|
|
private TouchEventVisualizer touchEventVisualizer;
|
|
|
private TuioCommunicator tuioCommunicator;
|
|
|
|
|
|
+ public OutputImage[] OutputImages { get; private set; }
|
|
|
+ public int CurrentFrameID { get; private set; }
|
|
|
+
|
|
|
public InputHandler(InputProvider inputProvider)
|
|
|
{
|
|
|
this.inputProvider = inputProvider;
|
|
|
- this.currentFrameID = inputProvider.CurrentFrameID;
|
|
|
- this.lastFrameID = this.currentFrameID - 1;
|
|
|
+ this.CurrentFrameID = inputProvider.CurrentFrameID;
|
|
|
|
|
|
initializeConsistentObjects();
|
|
|
}
|
|
@@ -76,7 +74,7 @@ namespace bbiwarg
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void resetConsistentObjects()
|
|
|
+ public void resetConsistentObjects()
|
|
|
{
|
|
|
touchTracker.reset();
|
|
|
handTracker.reset();
|
|
@@ -92,33 +90,25 @@ namespace bbiwarg
|
|
|
public void updateFrame()
|
|
|
{
|
|
|
Timer.start("updateFrame");
|
|
|
+ beforeUpdateFrame();
|
|
|
|
|
|
- if (currentFrameID != inputProvider.CurrentFrameID)
|
|
|
- {
|
|
|
- beforeUpdateFrame();
|
|
|
+ createConfidenceImage();
|
|
|
+ createDepthImage();
|
|
|
+ createEdgeImage();
|
|
|
|
|
|
- if (lastFrameID - currentFrameID > 20)
|
|
|
- resetConsistentObjects();
|
|
|
+ detectFingers();
|
|
|
+ trackFingers();
|
|
|
|
|
|
- createConfidenceImage();
|
|
|
- createDepthImage();
|
|
|
- createEdgeImage();
|
|
|
+ detectHands();
|
|
|
+ trackHands();
|
|
|
|
|
|
- detectFingers();
|
|
|
- trackFingers();
|
|
|
+ detectPalm();
|
|
|
+ trackPalm();
|
|
|
|
|
|
- detectHands();
|
|
|
- trackHands();
|
|
|
-
|
|
|
- detectPalm();
|
|
|
- trackPalm();
|
|
|
-
|
|
|
- detectTouchEvents();
|
|
|
- trackTouchEvents();
|
|
|
-
|
|
|
- afterUpdateFrame();
|
|
|
- }
|
|
|
+ detectTouchEvents();
|
|
|
+ trackTouchEvents();
|
|
|
|
|
|
+ afterUpdateFrame();
|
|
|
Timer.stop("updateFrame");
|
|
|
}
|
|
|
|
|
@@ -128,9 +118,8 @@ namespace bbiwarg
|
|
|
|
|
|
currentInputFrame = inputProvider.CurrentFrame;
|
|
|
|
|
|
- lastFrameID = currentFrameID;
|
|
|
- currentFrameID = currentInputFrame.FrameID;
|
|
|
- Logger.CurrentFrame = currentFrameID;
|
|
|
+ CurrentFrameID = currentInputFrame.FrameID;
|
|
|
+ Logger.CurrentFrame = CurrentFrameID;
|
|
|
|
|
|
if (Parameters.TuioEnabled)
|
|
|
tuioCommunicator.initFrame();
|
|
@@ -253,8 +242,8 @@ namespace bbiwarg
|
|
|
{
|
|
|
OutputImages[0].fillCircle(tf.TipPointPrediction.IntX, tf.TipPointPrediction.IntY, 3, Parameters.FingerPointsPredictionColor);
|
|
|
OutputImages[0].fillCircle(tf.HandPointPrediction.IntX, tf.HandPointPrediction.IntY, 3, Parameters.FingerPointsPredictionColor);
|
|
|
- Vector2D mid = (tf.TipPointPrediction+tf.HandPointPrediction) /2 ;
|
|
|
- OutputImages[0].drawLineSegment(new Utility.LineSegment2D(mid, mid + Parameters.FingerTrackerNumDirectionsForMeanDirection*tf.MeanDirection), Parameters.FingerMeanDirectionColor);
|
|
|
+ Vector2D mid = (tf.TipPointPrediction + tf.HandPointPrediction) / 2;
|
|
|
+ OutputImages[0].drawLineSegment(new Utility.LineSegment2D(mid, mid + Parameters.FingerTrackerNumDirectionsForMeanDirection * tf.MeanDirection), Parameters.FingerMeanDirectionColor);
|
|
|
}
|
|
|
}
|
|
|
|