Преглед изворни кода

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/etri-smartspaces

Alexander Hendrich пре 11 година
родитељ
комит
3a2412ea4d
2 измењених фајлова са 20 додато и 17 уклоњено
  1. 20 16
      bbiwarg/Detectors/PalmDetection/PalmDetector.cs
  2. 0 1
      bbiwarg/Images/ConfidenceImage.cs

+ 20 - 16
bbiwarg/Detectors/PalmDetection/PalmDetector.cs

@@ -208,28 +208,32 @@ namespace bbiwarg.Detectors.PalmDetection
 
                 lastThumbDefectDepth = thumbDefectDepth;
 
-                Vector2D handLength, handWidth, topLeft, bottomLeft, bottomRight, topRight;
-                if (palmHand.Side == Hand.HandSide.Left)
+                Vector2D handLength, handWidth, longestLineEndpoint, topLeft, bottomLeft, bottomRight, topRight;
+
+                Vector2D startDepth = thumbDefectStart - thumbDefectDepth;
+                Vector2D endDepth = thumbDefectEnd - thumbDefectDepth;
+
+                if (startDepth.Length > endDepth.Length)
                 {
-                    //left hand
-                    handLength = thumbDefectStart - thumbDefectDepth;
-                    handWidth = 0.85f * new Vector2D(-handLength.Y, handLength.X);
-                    topLeft = thumbDefectStart+0.15f*handLength;
-                    bottomLeft = thumbDefectDepth - 0.4f * handLength;
-                    bottomRight = bottomLeft + handWidth;
-                    topRight = bottomRight + 1.2f * handLength - 0.3f * handWidth;
+                    handLength = startDepth;
+                    longestLineEndpoint = thumbDefectStart;
                 }
                 else
                 {
-                    //right hand
-                    handLength = thumbDefectEnd - thumbDefectDepth;
-                    handWidth = 0.85f * new Vector2D(handLength.Y, -handLength.X);
-                    topRight = thumbDefectEnd+0.15f*handLength;
-                    bottomRight = thumbDefectDepth - 0.4f * handLength;
-                    bottomLeft = bottomRight + handWidth;
-                    topLeft = bottomLeft + 1.15f * handLength - 0.35f * handWidth;
+                    handLength = endDepth;
+                    longestLineEndpoint = thumbDefectEnd;
                 }
 
+                if (palmHand.Side == Hand.HandSide.Left)
+                    handWidth = 0.85f * new Vector2D(-handLength.Y, handLength.X);
+                else
+                    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.15f * handLength - 0.35f * handWidth;
+
                 PalmQuad = new Quadrangle(bottomLeft, topLeft, topRight, bottomRight);
             }
         }

+ 0 - 1
bbiwarg/Images/ConfidenceImage.cs

@@ -14,7 +14,6 @@ namespace bbiwarg.Images
     {
         public Image<Gray, Int16> Image { get; private set; }
         public Image<Gray, byte> Mask { get; private set; }
-        private OutputImage outputImage;
 
         public ConfidenceImage(Image<Gray, Int16> image)
         {