Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/etri-smartspaces

Conflicts:
	bbiwarg/DataSource/ColorImage.cs
Daniel Kauth 11 years ago
parent
commit
6fc6c3fc4d
3 changed files with 22 additions and 12 deletions
  1. 7 2
      bbiwarg/DataSource/ColorImage.cs
  2. 1 1
      bbiwarg/Test/OutputTest.cs
  3. 14 9
      bbiwarg/Test/Triangle.cs

+ 7 - 2
bbiwarg/DataSource/ColorImage.cs

@@ -31,8 +31,13 @@ namespace bbiwarg.DataSource
 
         public Color getColor(int x, int y)
         {
-            return Color.FromArgb(data[4 * (y * width + x) + 3], data[4 * (y * width + x) + 2],
-                                  data[4 * (y * width + x) + 0], data[4 * (y * width + x) + 1]);
+            int offset = 4 * (y * width + x);
+            byte alpha = data[offset + 3];
+            byte red = data[offset + 0];
+            byte green = data[offset + 1];
+            byte blue = data[offset + 2];
+
+            return Color.FromArgb(alpha, red, green, blue);
         }
     }
 }

+ 1 - 1
bbiwarg/Test/OutputTest.cs

@@ -92,7 +92,7 @@ namespace bbiwarg.Test
             palmPosition.draw();
             //Console.WriteLine(palmPosition.toString());
 
-            Console.WriteLine("Palm Position: x: " + (int)palmPixel[0] + " y: " + (int)palmPixel[1] + " 3DDepth: " + palmPosition.depth + " ImageDepth: " + imageData.getDepth((int)palmPixel[0], (int)palmPixel[1]));
+            //Console.WriteLine("Palm Position: x: " + (int)palmPixel[0] + " y: " + (int)palmPixel[1] + " 3DDepth: " + palmPosition.depth + " ImageDepth: " + imageData.getDepth((int)palmPixel[0], (int)palmPixel[1]));
 
             for (int i = 0; i < triangles.Count; i++)
             {

+ 14 - 9
bbiwarg/Test/Triangle.cs

@@ -12,11 +12,12 @@ namespace bbiwarg.Test
 {
     class Triangle
     {
-        public Vector a;
-        public Vector b;
-        public Vector c;
+        public Pixel3D a;
+        public Pixel3D b;
+        public Pixel3D c;
+        public Color color = Color.Red;
 
-        public Triangle(Vector a, Vector b, Vector c)
+        public Triangle(Pixel3D a, Pixel3D b, Pixel3D c)
 	    {
             this.a = a;
             this.b = b;
@@ -25,16 +26,20 @@ namespace bbiwarg.Test
 
         public void draw()
         {
-            GL.Color3(1.0f,0.0f,0.0f);
+            a.draw();
+            b.draw();
+            c.draw();
+
+            GL.Color3(color);
 
             GL.Begin(BeginMode.Triangles);
-            GL.Vertex3(a[0], a[1], a[2]);
-            GL.Vertex3(b[0], b[1], b[2]);
-            GL.Vertex3(c[0], c[1], c[2]);
+            GL.Vertex3(a.x, a.y, a.depth);
+            GL.Vertex3(b.x, b.y, b.depth);
+            GL.Vertex3(c.x, c.y, c.depth);
             GL.End();
         }
 
-        public void setVectors(Vector a, Vector b, Vector c)
+        public void setPixel(Pixel3D a, Pixel3D b, Pixel3D c)
         {
             this.a = a;
             this.b = b;