|
@@ -8,20 +8,25 @@ using MathNet.Numerics.LinearAlgebra.Single;
|
|
|
using bbiwarg.Images;
|
|
|
using bbiwarg.InputProviders;
|
|
|
using bbiwarg.Detectors;
|
|
|
+using bbiwarg.Helpers;
|
|
|
|
|
|
namespace bbiwarg.VideoHandles
|
|
|
{
|
|
|
class VideoHandle : IVideoHandle
|
|
|
{
|
|
|
+ private IInputProvider inputProvider;
|
|
|
+
|
|
|
private ForeFingerDetection foreFingerDetection;
|
|
|
private PalmDetection palmDetection;
|
|
|
|
|
|
- private IInputProvider inputProvider;
|
|
|
private DepthImage depthImage;
|
|
|
private ConfidenceImage confidenceImage;
|
|
|
private UVImage uvImage;
|
|
|
private ColorImage colorImage;
|
|
|
|
|
|
+ private DepthImage hand1Image;
|
|
|
+ private DepthImage hand2Image;
|
|
|
+
|
|
|
private float maxU;
|
|
|
private float maxV;
|
|
|
|
|
@@ -72,6 +77,36 @@ namespace bbiwarg.VideoHandles
|
|
|
confidenceImage = inputProvider.getConfidenceImage();
|
|
|
uvImage = inputProvider.getUVImage();
|
|
|
colorImage = inputProvider.getColorImage();
|
|
|
+
|
|
|
+ hand1Image = inputProvider.getDepthImage();
|
|
|
+ hand2Image = inputProvider.getDepthImage();
|
|
|
+
|
|
|
+ int maxHandSize = 150; // mm Wieviel Pixel sind das?
|
|
|
+
|
|
|
+ //hand1
|
|
|
+ Vector palm1Origin = inputProvider.getPalmPosition2D(1);
|
|
|
+ int palmX = (int)palm1Origin.x();
|
|
|
+ int palmY = (int)palm1Origin.y();
|
|
|
+ int palmDepth = depthImage.getDepth(palmX, palmY);
|
|
|
+
|
|
|
+ if (palmX != 0 && palmY != 0)
|
|
|
+ {
|
|
|
+ //hand1Image.floodFill(palmX, palmY);
|
|
|
+ hand1Image.thresholdDepth(palmDepth - 10, palmDepth + 30);
|
|
|
+ hand1Image.thresholdPosition(palmX - maxHandSize / 2, palmX + maxHandSize / 2, palmY - maxHandSize / 2, palmY + maxHandSize / 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ //hand2
|
|
|
+ Vector palm2Origin = inputProvider.getPalmPosition2D(2);
|
|
|
+ palmX = (int)palm2Origin.x();
|
|
|
+ palmY = (int)palm2Origin.y();
|
|
|
+ palmDepth = depthImage.getDepth(palmX, palmY);
|
|
|
+
|
|
|
+ if (palmX != 0 && palmY != 0)
|
|
|
+ {
|
|
|
+ hand2Image.thresholdDepth(palmDepth - 10, palmDepth + 30);
|
|
|
+ hand2Image.thresholdPosition(palmX - maxHandSize / 2, palmX + maxHandSize / 2, palmY - maxHandSize / 2, palmY + maxHandSize / 2);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public short getDepth(int x, int y)
|
|
@@ -100,6 +135,16 @@ namespace bbiwarg.VideoHandles
|
|
|
return colorImage.getColor(xInColorImage, yInColorImage);
|
|
|
}
|
|
|
|
|
|
+ public DepthImage getHand1Image()
|
|
|
+ {
|
|
|
+ return hand1Image;
|
|
|
+ }
|
|
|
+
|
|
|
+ public DepthImage getHand2Image()
|
|
|
+ {
|
|
|
+ return hand2Image;
|
|
|
+ }
|
|
|
+
|
|
|
public DetectionStatus[] getFingerStatus(uint handIndex)
|
|
|
{
|
|
|
return inputProvider.getFingerStatus(handIndex);
|