|
@@ -29,6 +29,7 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
private Kalman2DPositionFilter thumbDefectDepthFilter, thumbDefectStartFilter, thumbDefectEndFilter;
|
|
private Kalman2DPositionFilter thumbDefectDepthFilter, thumbDefectStartFilter, thumbDefectEndFilter;
|
|
private int numFramesNoHandFound;
|
|
private int numFramesNoHandFound;
|
|
private float lastPalmQuadArea;
|
|
private float lastPalmQuadArea;
|
|
|
|
+ private List<Hand> hands;
|
|
|
|
|
|
public Quadrangle PalmQuad { get; private set; }
|
|
public Quadrangle PalmQuad { get; private set; }
|
|
public Hand.HandSide PalmHandSide {get; private set; }
|
|
public Hand.HandSide PalmHandSide {get; private set; }
|
|
@@ -46,6 +47,7 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
public void findPalmQuad(OutputImage outputImage, List<Hand> hands)
|
|
public void findPalmQuad(OutputImage outputImage, List<Hand> hands)
|
|
{
|
|
{
|
|
this.outputImage = outputImage;
|
|
this.outputImage = outputImage;
|
|
|
|
+ this.hands = hands;
|
|
|
|
|
|
if (hands.Count == 1 && hands[0].Fingers.Count == 1)
|
|
if (hands.Count == 1 && hands[0].Fingers.Count == 1)
|
|
{
|
|
{
|
|
@@ -82,7 +84,7 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
findConvexityDefectsSortedByDepth();
|
|
findConvexityDefectsSortedByDepth();
|
|
if (pointingHand != null)
|
|
if (pointingHand != null)
|
|
removeConvexityDefectsCausedByFingers();
|
|
removeConvexityDefectsCausedByFingers();
|
|
- findHandPoints(hands.Count);
|
|
|
|
|
|
+ findHandPoints();
|
|
}
|
|
}
|
|
|
|
|
|
if (hands.Count == 0)
|
|
if (hands.Count == 0)
|
|
@@ -197,7 +199,7 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- private void findHandPoints(int numHands)
|
|
|
|
|
|
+ private void findHandPoints()
|
|
{
|
|
{
|
|
MCvConvexityDefect? thumbDefect = findThumbDefect();
|
|
MCvConvexityDefect? thumbDefect = findThumbDefect();
|
|
|
|
|
|
@@ -229,11 +231,25 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
{
|
|
{
|
|
handLength = startDepth;
|
|
handLength = startDepth;
|
|
longestLineEndpoint = thumbDefectStart;
|
|
longestLineEndpoint = thumbDefectStart;
|
|
|
|
+ if (hands.Count == 1)
|
|
|
|
+ {
|
|
|
|
+ if (thumbDefectStart.X > thumbDefectDepth.X)
|
|
|
|
+ hands[0].Side = Hand.HandSide.Left;
|
|
|
|
+ else
|
|
|
|
+ hands[0].Side = Hand.HandSide.Right;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
handLength = endDepth;
|
|
handLength = endDepth;
|
|
longestLineEndpoint = thumbDefectEnd;
|
|
longestLineEndpoint = thumbDefectEnd;
|
|
|
|
+ if (hands.Count == 1)
|
|
|
|
+ {
|
|
|
|
+ if (thumbDefectEnd.X > thumbDefectDepth.X)
|
|
|
|
+ hands[0].Side = Hand.HandSide.Left;
|
|
|
|
+ else
|
|
|
|
+ hands[0].Side = Hand.HandSide.Right;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (palmHand.Side == Hand.HandSide.Left)
|
|
if (palmHand.Side == Hand.HandSide.Left)
|