|
@@ -20,7 +20,7 @@ namespace bbiwarg.Detectors.Touch
|
|
private List<Finger> fingers;
|
|
private List<Finger> fingers;
|
|
private List<TouchEvent> touchEvents;
|
|
private List<TouchEvent> touchEvents;
|
|
|
|
|
|
- public TouchDetector(List<Finger> fingers, DepthImage depthImage, TouchImage touchImage, Palm.PalmRect palm) {
|
|
|
|
|
|
+ public TouchDetector(List<Finger> fingers, DepthImage depthImage, TouchImage touchImage) {
|
|
this.depthImage = depthImage;
|
|
this.depthImage = depthImage;
|
|
this.touchImage = touchImage;
|
|
this.touchImage = touchImage;
|
|
this.fingers = fingers;
|
|
this.fingers = fingers;
|
|
@@ -39,17 +39,10 @@ namespace bbiwarg.Detectors.Touch
|
|
float x = HelperFunctions.thresholdRange<float>(0, depthImage.getWidth() - 1, tipPoint.X + directionFactor * direction.X);
|
|
float x = HelperFunctions.thresholdRange<float>(0, depthImage.getWidth() - 1, tipPoint.X + directionFactor * direction.X);
|
|
float y = HelperFunctions.thresholdRange<float>(0, depthImage.getHeight() - 1, tipPoint.Y + directionFactor * direction.Y);
|
|
float y = HelperFunctions.thresholdRange<float>(0, depthImage.getHeight() - 1, tipPoint.Y + directionFactor * direction.Y);
|
|
Vector2D tep = new Vector2D(x,y);
|
|
Vector2D tep = new Vector2D(x,y);
|
|
- Vector2D relativePosition = palm.getRelativePosition(tep);
|
|
|
|
|
|
|
|
- // detect touch event if positon is in 10% margin of palm rect (threshold coordinates to range [0,1])
|
|
|
|
- if (relativePosition.X >= -0.1 && relativePosition.X <= 1.1 && relativePosition.Y >= -0.1 && relativePosition.Y <= 1.1)
|
|
|
|
- {
|
|
|
|
- relativePosition = new Vector2D(HelperFunctions.thresholdRange<float>(0.0f, 1.0f, relativePosition.X),
|
|
|
|
- HelperFunctions.thresholdRange<float>(0.0f, 1.0f, relativePosition.Y));
|
|
|
|
- touchImage.setTouchAt((int)tep.X, (int)tep.Y, TouchImageState.touchDetected);
|
|
|
|
- TouchEvent touchEvent = new TouchEvent((int)tep.X, (int)tep.Y, relativePosition.X, relativePosition.Y, floodValue, finger);
|
|
|
|
- touchEvents.Add(touchEvent);
|
|
|
|
- }
|
|
|
|
|
|
+ touchImage.setTouchAt((int)tep.X, (int)tep.Y, TouchImageState.touchDetected);
|
|
|
|
+ TouchEvent touchEvent = new TouchEvent(tep, floodValue, finger);
|
|
|
|
+ touchEvents.Add(touchEvent);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|