|
@@ -33,16 +33,15 @@ namespace bbiwarg.Detectors.Touch
|
|
{
|
|
{
|
|
Vector2D tipPoint = finger.Tip;
|
|
Vector2D tipPoint = finger.Tip;
|
|
|
|
|
|
|
|
+ outputImage.fillCircle(tipPoint.IntX, tipPoint.IntY, 3, Constants.TouchEventTipColor);
|
|
|
|
+
|
|
float floodValue = getFloodValue(tipPoint);
|
|
float floodValue = getFloodValue(tipPoint);
|
|
if (floodValue > floodValueThreshold)
|
|
if (floodValue > floodValueThreshold)
|
|
{
|
|
{
|
|
//correct touchEvent position
|
|
//correct touchEvent position
|
|
Vector2D direction = finger.LineSegment.Line.Direction;
|
|
Vector2D direction = finger.LineSegment.Line.Direction;
|
|
- float directionFactor = 10;
|
|
|
|
- float x = HelperFunctions.thresholdRange<float>(0, depthImage.Width - 1, tipPoint.X + directionFactor * direction.X);
|
|
|
|
- float y = HelperFunctions.thresholdRange<float>(0, depthImage.Height - 1, tipPoint.Y + directionFactor * direction.Y);
|
|
|
|
- Vector2D tep = new Vector2D(x, y);
|
|
|
|
-
|
|
|
|
|
|
+ Vector2D tep = (tipPoint + 5 * direction).moveInBound(0,0,depthImage.Width-1,depthImage.Height-1);
|
|
|
|
+
|
|
outputImage.fillCircle(tep.IntX, tep.IntY, 5, Constants.TouchEventDetectedColor);
|
|
outputImage.fillCircle(tep.IntX, tep.IntY, 5, Constants.TouchEventDetectedColor);
|
|
TouchEvent touchEvent = new TouchEvent(tep, floodValue, finger);
|
|
TouchEvent touchEvent = new TouchEvent(tep, floodValue, finger);
|
|
TouchEvents.Add(touchEvent);
|
|
TouchEvents.Add(touchEvent);
|