浏览代码

Changed Kalman Touch Constants.
Fixed relative touch position calculation for right hand.

Daniel Kauth 11 年之前
父节点
当前提交
44ea6bdff3
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 3 3
      bbiwarg/Constants.cs
  2. 4 4
      bbiwarg/Recognition/PalmRecognition/PalmDetector.cs

+ 3 - 3
bbiwarg/Constants.cs

@@ -99,15 +99,15 @@ namespace bbiwarg
         public static readonly int TouchEventFloodfillHighDiff = 3;
         public static readonly int TouchEventTipInsideFactor = 2;
         public static readonly int TouchEventTipOutsideFactor = 7;
-        public static readonly float TouchmXX = 0.0016f;
-        public static readonly float TouchmXY = 0.0f;
-        public static readonly float TouchmYY = 0.0016f;
         public static readonly float TouchProcessNoise = 3.0e-4f;
 
         // touch tracking
         public static readonly int TouchEventNumFramesDetectedUntilTracked = 1;
         public static readonly int TouchEventNumFramesLostUntilDeleted = 5;
         public static readonly float TouchEventMinSimilarityForTracking = 0.7f;
+        public static readonly float TouchmXX = 0.0065f;
+        public static readonly float TouchmXY = 0.0f;
+        public static readonly float TouchmYY = 0.0065f;
 
         // touchEventVisualizer
         public static readonly int TouchEventVisualizerFadeOutTime = 1500;

+ 4 - 4
bbiwarg/Recognition/PalmRecognition/PalmDetector.cs

@@ -259,13 +259,15 @@ namespace bbiwarg.Recognition.PalmRecognition
                     }
                 }
 
+                Quadrangle quad;
                 if (palmHand.Side == Hand.HandSide.Left)
                 {
-                    handWidth = 0.85f * new Vector2D(-handLength.Y, handLength.X);
+                handWidth = 0.85f * new Vector2D(-handLength.Y, handLength.X);
                     topLeft = longestLineEndpoint + 0.15f * handLength;
                     bottomLeft = ThumbDefectDepth - 0.4f * handLength;
                     bottomRight = bottomLeft + handWidth;
                     topRight = bottomRight + 1.2f * handLength - 0.3f * handWidth;
+                    quad = new Quadrangle(bottomLeft, topLeft, topRight, bottomRight, foregroundMask.Width, foregroundMask.Height);
                 }
                 else
                 {
@@ -274,11 +276,9 @@ namespace bbiwarg.Recognition.PalmRecognition
                     bottomRight = ThumbDefectDepth - 0.4f * handLength;
                     bottomLeft = bottomRight + handWidth;
                     topLeft = bottomLeft + 1.2f * handLength - 0.3f * handWidth;
+                    quad = new Quadrangle(topRight, bottomRight, bottomLeft, topLeft, foregroundMask.Width, foregroundMask.Height);
                 }
 
-
-                Quadrangle quad = new Quadrangle(bottomLeft, topLeft, topRight, bottomRight, foregroundMask.Width, foregroundMask.Height);
-
                 if ((lastPalmQuad == null ||
                     (quad.Area / lastPalmQuad.Area >= Constants.PalmMinAreaQuotient && quad.Area / lastPalmQuad.Area <= Constants.PalmMaxAreaQuotient)) &&
                     getForegroundPixelPercentage(quad, foregroundMask) >= Constants.PalmMinPrecentageQuadForeground)