|
@@ -99,7 +99,7 @@ namespace bbiwarg.Detectors.FingerDetection
|
|
|
{
|
|
|
trail.Slices.RemoveRange(0, Constants.FingerRemoveNumSlicesForCorrection);
|
|
|
trail.Slices.Reverse();
|
|
|
- trail = expandTrail(trail);
|
|
|
+ trail = expandTrail(trail, true);
|
|
|
trail.Slices.Reverse();
|
|
|
return trail;
|
|
|
}
|
|
@@ -110,7 +110,7 @@ namespace bbiwarg.Detectors.FingerDetection
|
|
|
|
|
|
}
|
|
|
|
|
|
- private FingerSliceTrail expandTrail(FingerSliceTrail trail)
|
|
|
+ private FingerSliceTrail expandTrail(FingerSliceTrail trail, bool reversed = false)
|
|
|
{
|
|
|
int maxX = depthImage.Width - 1;
|
|
|
int maxY = depthImage.Height - 1;
|
|
@@ -126,7 +126,10 @@ namespace bbiwarg.Detectors.FingerDetection
|
|
|
|
|
|
while (currentPosition.isWithin(0, 0, maxX, maxY) && gapCounter <= Math.Min(numSlices, Constants.FingerMaxGapCounter))
|
|
|
{
|
|
|
- nextSlice = findFingerSliceFromMid(currentPosition, currentDirection);
|
|
|
+ if(reversed)
|
|
|
+ nextSlice = findFingerSliceFromMid(currentPosition, currentDirection.getInverse());
|
|
|
+ else
|
|
|
+ nextSlice = findFingerSliceFromMid(currentPosition, currentDirection);
|
|
|
|
|
|
if (nextSlice != null && Math.Abs(nextSlice.Length - lastSlice.Length) <= Constants.FingerMaxSliceDifferencePerStep)
|
|
|
{
|
|
@@ -253,8 +256,7 @@ namespace bbiwarg.Detectors.FingerDetection
|
|
|
drawDetectedFinger(finger);
|
|
|
|
|
|
//remove edges around detected finger to improve performance
|
|
|
- Point[] polygon = finger.getBoundingPolygon();
|
|
|
- edgeImageAdapted.removeEdgesInsidePolygon(polygon);
|
|
|
+ edgeImageAdapted.removeEdgesInsidePolygon(finger.getContour().ToArray());
|
|
|
}
|
|
|
|
|
|
private FingerSlice findOutSlice(Vector2D start, Vector2D direction)
|
|
@@ -311,7 +313,9 @@ namespace bbiwarg.Detectors.FingerDetection
|
|
|
{
|
|
|
outputImage.drawLineSegment(trail.Slices[i].LineSegment, Constants.FingerSliceColor);
|
|
|
}
|
|
|
+ //outputImage.drawPolygon(finger.getBoundingPolygon(), 0);
|
|
|
outputImage.drawLineSegment(finger.LineSegment, Constants.FingerDetectedColor);
|
|
|
+ outputImage.drawContour(finger.getContour(), Color.Red, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|