|
@@ -78,13 +78,37 @@ namespace bbiwarg.Detectors.HandDetection
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ float minX = float.MaxValue;
|
|
|
+ foreach (Hand hand in Hands)
|
|
|
+ {
|
|
|
+ if (hand.Centroid.X < minX)
|
|
|
+ minX = hand.Centroid.X;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (Hand hand in Hands)
|
|
|
+ {
|
|
|
+ if (hand.Centroid.X == minX)
|
|
|
+ hand.Side = Hand.HandSide.Left;
|
|
|
+ else
|
|
|
+ hand.Side = Hand.HandSide.Right;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void drawHands() {
|
|
|
- int maxIndex = Math.Min(3, Hands.Count);
|
|
|
- for (int i = 0; i < maxIndex ; i++)
|
|
|
+ if (Hands.Count == 1)
|
|
|
+ {
|
|
|
+ outputImage.Image[0] = outputImage.Image[1] = outputImage.Image[2] = Hands[0].Mask * 255;
|
|
|
+ }
|
|
|
+ else if (Hands.Count > 1)
|
|
|
{
|
|
|
- outputImage.Image[i] = Hands[i].Mask.Mul(255);
|
|
|
+ for (int i = 0; i < 2; ++i)
|
|
|
+ {
|
|
|
+ if (Hands[i].Side == Hand.HandSide.Left)
|
|
|
+ outputImage.Image[0] = outputImage.Image[0] | (255 * Hands[i].Mask);
|
|
|
+ else
|
|
|
+ outputImage.Image[1] = outputImage.Image[1] | (255 * Hands[i].Mask);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|