Browse Source

Fixed TouchEventVisualizer y coordinate.
Added borders to output images.

Daniel Kauth 11 years ago
parent
commit
c260b33ee0

+ 5 - 0
bbiwarg/Graphics/OutputImage.cs

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

+ 2 - 2
bbiwarg/Graphics/TouchEventVisualizer.cs

@@ -54,7 +54,7 @@ namespace bbiwarg.Graphics
                 pos = currentFilter.getCorrectedPosition(e.RelativePalmPosition);
             }
 
-            currentList.Add(new Vector2D((int)(pos.X * width), (int)(pos.Y * height)));
+            currentList.Add(new Vector2D((int)(pos.X * width), (int)(height - pos.Y * height)));
             if (addList)
             {
                 touchPositions.Add(currentList);
@@ -67,7 +67,7 @@ namespace bbiwarg.Graphics
         public void updateImage()
         {
             OutputImage = new OutputImage(width, height);
-
+            
             foreach (List<Vector2D> positions in touchPositions)
             {
                 for (int i = 1; i < positions.Count; ++i)

+ 4 - 1
bbiwarg/VideoHandle.cs

@@ -181,7 +181,10 @@ namespace bbiwarg
             }
             touchEventVisualizer.updateImage();
 
-            // output images
+            // add borders
+            edgeFingerOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, 255, 255, 255);
+            depthPalmTouchOutputImage.drawRectangle(0, 0, Width - 1, Height - 1, 255, 255, 255);
+            touchEventVisualizer.OutputImage.drawRectangle(0, 0, Width - 1, Height - 1, 255, 255, 255);
             OutputImages = new OutputImage[] { edgeFingerOutputImage, depthPalmTouchOutputImage, touchEventVisualizer.OutputImage};
 
             Timer.stop("processFrameUpdate");