Pārlūkot izejas kodu

improved finger direction detection

Alexander Hendrich 11 gadi atpakaļ
vecāks
revīzija
839ca31e08
1 mainītis faili ar 4 papildinājumiem un 4 dzēšanām
  1. 4 4
      bbiwarg/Detectors/FingerDetection/FingerDetector.cs

+ 4 - 4
bbiwarg/Detectors/FingerDetection/FingerDetector.cs

@@ -280,8 +280,8 @@ namespace bbiwarg.Detectors.FingerDetection
 
         private FingerSliceTrail orderTrailTipToHand(FingerSliceTrail trail)
         {
-            int maxX = depthImage.Width - 1;
-            int maxY = depthImage.Height - 1;
+            int maxX = depthImage.Width - 2;
+            int maxY = depthImage.Height - 2;
 
             FingerSlice start = trail.Start;
             FingerSlice end = trail.End;
@@ -294,10 +294,10 @@ namespace bbiwarg.Detectors.FingerDetection
             float startOutLength = float.MaxValue;
             float endOutLength = float.MaxValue;
 
-            if (startOutSlice.Start.isWithin(0, 0, maxX, maxY) && startOutSlice.End.isWithin(0, 0, maxX, maxY))
+            if (startOutSlice.Start.isWithin(1, 1, maxX, maxY) && startOutSlice.End.isWithin(1, 1, maxX, maxY))
                 startOutLength = startOutSlice.Length;
 
-            if (endOutSlice.Start.isWithin(0, 0, maxX, maxY) && endOutSlice.End.isWithin(0, 0, maxX, maxY))
+            if (endOutSlice.Start.isWithin(1, 1, maxX, maxY) && endOutSlice.End.isWithin(1, 1, maxX, maxY))
                 endOutLength = endOutSlice.Length;
 
             if (startOutLength <= endOutLength)