Forráskód Böngészése

fixed bug in fingerDetection

Alexander Hendrich 11 éve
szülő
commit
469e994621

+ 2 - 2
bbiwarg/Detectors/Fingers/FingerDetector.cs

@@ -81,7 +81,7 @@ namespace bbiwarg.Detectors.Fingers
         private FingerSliceTrail findFingerSliceTrail(FingerSlice startSlice, Vector2D startDirection)
         {
             int minNumSlicesForCorrection = 15;
-            int numRemoveForCorrection = 3;
+            int numRemoveForCorrection = 5;
 
             int maxX = depthImage.Width - 1;
             int maxY = depthImage.Height - 1;
@@ -101,8 +101,8 @@ namespace bbiwarg.Detectors.Fingers
 
                     if (trail.NumSlices > minNumSlicesForCorrection)
                     {
-                        trail.Slices.Reverse();
                         trail.Slices.RemoveRange(0, numRemoveForCorrection);
+                        trail.Slices.Reverse();
                         trail = expandTrail(trail);
                         trail.Slices.Reverse();
                         return trail;

+ 2 - 2
bbiwarg/Graphics/OutputImage.cs

@@ -55,9 +55,9 @@ namespace bbiwarg.Graphics
             Image.Draw(new CircleF(new PointF(x, y), radius), new Rgb(color), 0);
         }
 
-        public void drawRectangle(int x, int y, int width, int height, byte r, byte g, byte b, int thichness = 0)
+        public void drawRectangle(int x, int y, int width, int height, Color color, int thichness = 0)
         {
-            Image.Draw(new Rectangle(x, y, width, height), new Rgb(r, g, b), thichness);
+            Image.Draw(new Rectangle(x, y, width, height), new Rgb(color), thichness);
         }
     }
 }

+ 1 - 1
bbiwarg/Graphics/OutputWindow.cs

@@ -165,7 +165,7 @@ namespace bbiwarg.Graphics
 
             Timer.stop("onRenderFrame");
             
-            //Timer.outputAll();
+            Timer.outputAll();
         }
 
     }

+ 1 - 1
bbiwarg/Graphics/TouchEventVisualizer.cs

@@ -73,7 +73,7 @@ namespace bbiwarg.Graphics
             OutputImage = new OutputImage(width, height);            
             
             int size = Math.Min(width, height);
-            OutputImage.drawRectangle(0, 0, size - 1, size - 1, 255, 255, 255);
+            OutputImage.drawRectangle(0, 0, size - 1, size - 1, Color.White);
 
             foreach (List<Vector2D> positions in touchPositions)
             {

+ 3 - 2
bbiwarg/VideoHandle.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
@@ -185,8 +186,8 @@ namespace bbiwarg
             }
 
             // add borders
-            edgeFingerOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, 255, 255, 255);
-            depthPalmTouchOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, 255, 255, 255);
+            edgeFingerOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, Color.White);
+            depthPalmTouchOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, Color.White);
             OutputImages = new OutputImage[] { edgeFingerOutputImage, depthPalmTouchOutputImage, touchEventVisualizer.OutputImage};
             Timer.stop("processFrameUpdate");
         }