Quellcode durchsuchen

-added palmGrid to palmImage (at the moment 3*4 grid, can be edited in drawing function)

Anton Rohr vor 10 Jahren
Ursprung
Commit
71fc374ef5

+ 2 - 0
bbiwarg/Detectors/Palm/PalmDetector.cs

@@ -271,6 +271,8 @@ namespace bbiwarg.Detectors.Palm
             PointF[] vertices = palmRect.GetVertices();
             for (int i = 0; i < 4; ++i)
                 palmImage.drawLine(new LineSegment2DF(vertices[i], vertices[(i + 1) % 4]), PalmImageState.palmRect);
+
+            palmImage.drawGrid(new Vector2D(vertices[0]),new Vector2D(vertices[1]),new Vector2D(vertices[2]),new Vector2D(vertices[3]));
         }
     }
 }

+ 5 - 0
bbiwarg/Graphics/OutputWindow.cs

@@ -167,6 +167,11 @@ namespace bbiwarg.Graphics
                             green = Int16.MaxValue;
                             blue = red = 0;
                             break;
+                        case PalmImageState.palmGrid:
+                            green = blue = red = Int16.MaxValue;
+                            break;
+                            
+
                     }
 
                     // touch

+ 27 - 1
bbiwarg/Images/PalmImage.cs

@@ -20,7 +20,8 @@ namespace bbiwarg.Images
         palmContour = 1,
         wristLine = 2,
         thumbLine = 3,
-        palmRect = 4
+        palmRect = 4,
+        palmGrid = 5
     }
 
     class PalmImage
@@ -46,5 +47,30 @@ namespace bbiwarg.Images
         {
             image.Draw(line, new Gray((byte)state), 1);
         }
+
+        public void drawGrid(Vector2D a, Vector2D b, Vector2D c, Vector2D d)
+        {
+            int columnCount = 4;
+            int rowCount = 3;
+
+        
+
+            Vector2D bc = c - b;
+            for (int i = 1; i < columnCount; i++)
+            {
+                Vector2D bci = b + (bc * ((float)i/columnCount));
+                Vector2D adi = a + (bc * ((float)i/columnCount));
+                drawLine(new LineSegment2DF(bci, adi), PalmImageState.palmGrid);
+            }
+
+            Vector2D ab = b - a;
+            for (int i = 1; i < rowCount; i++)
+            {
+                Vector2D abi = a + (ab * ((float)i / rowCount));
+                Vector2D dci = d + (ab * ((float)i / rowCount));
+                drawLine(new LineSegment2DF(abi, dci), PalmImageState.palmGrid);
+            }
+
+        }
     }
 }