Explorar el Código

Merge branch 'test'

Daniel Kauth hace 10 años
padre
commit
3c60bee98b
Se han modificado 4 ficheros con 69 adiciones y 0 borrados
  1. 5 0
      bbiwarg/Images/EdgeImage.cs
  2. 56 0
      bbiwarg/Images/PalmImage.cs
  3. 7 0
      bbiwarg/VideoHandle.cs
  4. 1 0
      bbiwarg/bbiwarg.csproj

+ 5 - 0
bbiwarg/Images/EdgeImage.cs

@@ -23,5 +23,10 @@ namespace bbiwarg.Images
         public bool isEdgeAt(int x, int y) {
             return (image.Data[y,x,0] > 0);
         }
+
+        public Image<Gray, Byte> getImage()
+        {
+            return image;
+        }
     }
 }

+ 56 - 0
bbiwarg/Images/PalmImage.cs

@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Emgu.CV;
+using Emgu.CV.Structure;
+using System.Drawing;
+
+namespace bbiwarg.Images
+{
+    class PalmImage
+    {
+        private Image<Gray, Byte> image;
+        private int width, height;
+
+        public PalmImage(EdgeImage edgeImage)
+        {
+            image = edgeImage.getImage().Clone();
+            width = image.Width;
+            height = image.Height;
+
+            findContours();
+        }
+
+        private void findContours()
+        {
+            Image<Gray, Byte> storage = image.Clone();
+
+            MCvContour countour = new MCvContour();
+
+            CvInvoke.cvFindContours(image.Ptr, storage.Ptr, 
+        }
+
+        public bool belongsToPalm(int x, int y)
+        {
+            return false;
+        }
+
+        private Point getPointWithDepth(Int16 depth)
+        {
+            for (int x = 0; x < width; ++x)
+            {
+                for (int y = 0; y < height; ++y)
+                {
+                    if (image.Data[y, x, 0] == depth)
+                        return new Point(x, y);
+                }
+            }
+            return new Point(0, 0);
+        }
+
+
+    }
+}

+ 7 - 0
bbiwarg/VideoHandle.cs

@@ -23,6 +23,7 @@ namespace bbiwarg
         private DepthImage depthImage;
         private EdgeImage edgeImage;
         private TouchImage touchImage;
+        private PalmImage palmImage;
         private FingerImage fingerImage;
 
         private FingerDetector fingerDetector;
@@ -90,6 +91,10 @@ namespace bbiwarg
             return fingerImage.getStateAt(x, y);
         }
 
+        public bool isPalmPointAt(int x, int y) {
+            return palmImage.belongsToPalm(x, y);
+        }
+
         public TouchImageState getTouchImageStateAt(int x, int y) {
             return touchImage.getStateAt(x, y);
         }
@@ -122,6 +127,8 @@ namespace bbiwarg
             //detect+track touchEvents
             touchDetector = new TouchDetector(fingerTracker.getFingers(), depthImage, touchImage);
             touchTracker.setDetectedTouchEventsThisFrame(touchDetector.getTouchEvents(), touchImage);
+
+            palmImage = new PalmImage(edgeImage);
         }
     }
 }

+ 1 - 0
bbiwarg/bbiwarg.csproj

@@ -77,6 +77,7 @@
     <Compile Include="Images\FingerImage.cs" />
     <Compile Include="Images\DepthImage.cs" />
     <Compile Include="Images\EdgeImage.cs" />
+    <Compile Include="Images\PalmImage.cs" />
     <Compile Include="Images\TouchImage.cs" />
     <Compile Include="InputProvider\InputFrame.cs" />
     <Compile Include="InputProvider\IInputProvider.cs" />