|
@@ -78,35 +78,12 @@ namespace bbiwarg.Test
|
|
|
|
|
|
for (int i = 0; i < pixel.Count; i++)
|
|
|
{
|
|
|
- pixel[i].depth = 300;// imageData.getDepth(pixel[i].x, pixel[i].y);
|
|
|
+ pixel[i].depth = imageData.getDepth(pixel[i].x, pixel[i].y);
|
|
|
pixel[i].color = imageData.getColor(pixel[i].x, pixel[i].y);
|
|
|
pixel[i].draw();
|
|
|
}
|
|
|
|
|
|
|
|
|
- /*
|
|
|
- Vector palmPixel = source.getPalmPosition2D(1);
|
|
|
- Vector palmVertex = source.getPalmPosition3D(1);
|
|
|
-
|
|
|
- float palmXn = palmVertex[0];
|
|
|
- float palmYn = palmVertex[2];
|
|
|
- float palmZn = palmVertex[1];
|
|
|
-
|
|
|
- float alphaX = source.getHFOV();
|
|
|
- float alphaY = source.getVFOV();
|
|
|
-
|
|
|
- double maxXn = Math.Tan(alphaX/2) / palmZn;
|
|
|
- double maxYn = Math.Tan(alphaY/2) / palmZn;
|
|
|
-
|
|
|
- double u = 0.5f + palmXn / maxXn;
|
|
|
- double v = 0.5f + palmYn / maxYn;
|
|
|
-
|
|
|
- Console.WriteLine("u:" + u + " v:" + v);
|
|
|
-
|
|
|
- int palmX = (int)(u * depthImage.getWidth());
|
|
|
- int palmY = (int)(1 - v) * depthImage.getHeight());
|
|
|
- */
|
|
|
-
|
|
|
Vector palm = source.getPalmPosition2D(1);
|
|
|
Vector[] fingers = source.getFingerTipPositions2D(1);
|
|
|
|
|
@@ -114,55 +91,25 @@ namespace bbiwarg.Test
|
|
|
|
|
|
Pixel3D palmPosition = new Pixel3D((int)palm[0], (int)palm[1], width, height);
|
|
|
Pixel3D finger1Position = new Pixel3D((int)fingers[0][0], (int)fingers[0][1], width, height);
|
|
|
- palmPosition.depth = 300;// depthImage.getDepth((int)palmPixel[0], (int)palmPixel[1]);// (short)(palmVertex[1] * 1000);
|
|
|
- finger1Position.depth = 300;// depthImage.getDepth((int)palmPixel[0], (int)palmPixel[1]);// (short)(palmVertex[1] * 1000);
|
|
|
+ palmPosition.depth = depthImage.getDepth((int)palm[0], (int)palm[1]);
|
|
|
palmPosition.color = Color.Red;
|
|
|
- finger1Position.color = Color.Red;
|
|
|
palmPosition.size = 3;
|
|
|
- finger1Position.size = 3;
|
|
|
palmPosition.draw();
|
|
|
+ finger1Position.depth = depthImage.getDepth((int)fingers[0][0], (int)fingers[0][1]);
|
|
|
+ finger1Position.color = Color.Red;
|
|
|
+ finger1Position.size = 3;
|
|
|
finger1Position.draw();
|
|
|
|
|
|
for (int i = 0; i < triangles.Count; i++)
|
|
|
{
|
|
|
triangles[i].draw();
|
|
|
}
|
|
|
-
|
|
|
- /*
|
|
|
- GL.Begin(BeginMode.Triangles);
|
|
|
- GL.Vertex3(0.0f, 0.0f, -4.0f);
|
|
|
- GL.Vertex3(2.0f, 0.0f, -4.0f);
|
|
|
- GL.Vertex3(0.0f, 1.0f, -4.0f);
|
|
|
- GL.End();
|
|
|
- */
|
|
|
SwapBuffers();
|
|
|
|
|
|
if (isActive)
|
|
|
{
|
|
|
source.releaseFrame();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /*
|
|
|
- GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
|
|
-
|
|
|
- Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);
|
|
|
- GL.MatrixMode(MatrixMode.Modelview);
|
|
|
- GL.LoadMatrix(ref modelview);
|
|
|
-
|
|
|
- // triangle
|
|
|
- GL.Begin(BeginMode.Triangles);
|
|
|
-
|
|
|
- float x = palmPosition.Value._X;
|
|
|
- float y = palmPosition.Value._Y;
|
|
|
- float z = palmPosition.Value._Z;
|
|
|
-
|
|
|
- GL.Vertex3(-1.0f + x, -1.0f + z, 4.0f - 10 * y);
|
|
|
- GL.Vertex3(1.0f, -1.0f, 4.0f);
|
|
|
- GL.Vertex3(0.0f, 1.0f, 4.0f);
|
|
|
- GL.End();
|
|
|
-
|
|
|
- SwapBuffers();*/
|
|
|
}
|
|
|
|
|
|
protected override void OnResize(EventArgs e)
|