|
@@ -30,6 +30,8 @@ namespace bbiwarg.Detectors.Palm
|
|
|
private Contour<Point> palmContour;
|
|
|
private List<MCvConvexityDefect> convexityDefects;
|
|
|
|
|
|
+ private static Kalman2DPositionFilter thumbDefactFilter;
|
|
|
+
|
|
|
private bool valid = false;
|
|
|
private Vector2D topLeft;
|
|
|
private Vector2D topRight;
|
|
@@ -70,6 +72,11 @@ namespace bbiwarg.Detectors.Palm
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static void resetFilter()
|
|
|
+ {
|
|
|
+ thumbDefactFilter = null;
|
|
|
+ }
|
|
|
+
|
|
|
private List<Finger> getFingersWithoutThumb(List<Finger> detectedFingers)
|
|
|
{
|
|
|
Finger leftMost = null;
|
|
@@ -204,7 +211,18 @@ namespace bbiwarg.Detectors.Palm
|
|
|
if (convexityDefects.Count > 0)
|
|
|
{
|
|
|
MCvConvexityDefect thumbDefect = convexityDefects[0];
|
|
|
- Vector2D thumb = new Vector2D(thumbDefect.DepthPoint);
|
|
|
+
|
|
|
+ Vector2D thumb;
|
|
|
+ if (thumbDefactFilter == null)
|
|
|
+ {
|
|
|
+ thumb = new Vector2D(thumbDefect.DepthPoint);
|
|
|
+ thumbDefactFilter = new Kalman2DPositionFilter(thumb, 1.0e-2f, 1.0e-2f);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ thumb = thumbDefactFilter.getCorrectedPosition(new Vector2D(thumbDefect.DepthPoint));
|
|
|
+ }
|
|
|
+
|
|
|
Vector2D thumbDefectStart = new Vector2D(thumbDefect.StartPoint);
|
|
|
Vector2D thumbDefectEnd = new Vector2D(thumbDefect.EndPoint);
|
|
|
|