|
@@ -18,6 +18,7 @@ namespace bbiwarg.Graphics
|
|
private Point[,] depthPixels = new Point[320,240];
|
|
private Point[,] depthPixels = new Point[320,240];
|
|
private List<IGraphicElement> graphicElements = new List<IGraphicElement>();
|
|
private List<IGraphicElement> graphicElements = new List<IGraphicElement>();
|
|
private Point palmPixel;
|
|
private Point palmPixel;
|
|
|
|
+ private Point[] fingerPixel = new Point[5];
|
|
|
|
|
|
public Output(IVideoDataSource source)
|
|
public Output(IVideoDataSource source)
|
|
{
|
|
{
|
|
@@ -51,6 +52,13 @@ namespace bbiwarg.Graphics
|
|
palmPixel = new Point(palmVertex, palmColor, palmSize);
|
|
palmPixel = new Point(palmVertex, palmColor, palmSize);
|
|
graphicElements.Add(palmPixel);
|
|
graphicElements.Add(palmPixel);
|
|
|
|
|
|
|
|
+ for (int i = 0; i < 5; i++) {
|
|
|
|
+ Vertex vertex = new Vertex(0.0f, 0.0f, 0.0f);
|
|
|
|
+
|
|
|
|
+ fingerPixel[i] = new Point(vertex, palmColor, palmSize);
|
|
|
|
+ graphicElements.Add(fingerPixel[i]);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnRenderFrame(FrameEventArgs e)
|
|
protected override void OnRenderFrame(FrameEventArgs e)
|
|
@@ -77,14 +85,33 @@ namespace bbiwarg.Graphics
|
|
}
|
|
}
|
|
|
|
|
|
Vector palmPosition2D = source.getPalmPosition2D(1);
|
|
Vector palmPosition2D = source.getPalmPosition2D(1);
|
|
- palmPixel.position.x = (int)palmPosition2D[0];
|
|
|
|
- palmPixel.position.y = (int)palmPosition2D[1];
|
|
|
|
|
|
+ palmPixel.position.x = palmPosition2D[0];
|
|
|
|
+ palmPixel.position.y = palmPosition2D[1];
|
|
palmPixel.position.z = image.getDepth((int)palmPosition2D[0], (int)palmPosition2D[1]);
|
|
palmPixel.position.z = image.getDepth((int)palmPosition2D[0], (int)palmPosition2D[1]);
|
|
-
|
|
|
|
- foreach(IGraphicElement graphicElement in graphicElements) {
|
|
|
|
- graphicElement.draw(width, height);
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < 5; i++) {
|
|
|
|
+ DetectionStatus[] fingerStatus = source.getFingerStatus(1);
|
|
|
|
+ Vector[] fingerPositions = source.getFingerTipPositions2D(1);
|
|
|
|
+ if (fingerStatus[i] == DetectionStatus.Tracked)
|
|
|
|
+ {
|
|
|
|
+ fingerPixel[i].position.x = fingerPositions[i][0];
|
|
|
|
+ fingerPixel[i].position.y = fingerPositions[i][1];
|
|
|
|
+ fingerPixel[i].position.z = image.getDepth((int)fingerPositions[i][0], (int)fingerPositions[i][1]);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ fingerPixel[i].position.x = 0;
|
|
|
|
+ fingerPixel[i].position.y = 0;
|
|
|
|
+ fingerPixel[i].position.z = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ foreach (IGraphicElement graphicElement in graphicElements)
|
|
|
|
+ {
|
|
|
|
+ graphicElement.draw(width, height);
|
|
|
|
+ }
|
|
|
|
+
|
|
SwapBuffers();
|
|
SwapBuffers();
|
|
source.releaseFrame();
|
|
source.releaseFrame();
|
|
}
|
|
}
|