|
@@ -226,8 +226,32 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
|
|
|
|
private FingerSliceTrail orderTrailTipToHand(FingerSliceTrail trail)
|
|
private FingerSliceTrail orderTrailTipToHand(FingerSliceTrail trail)
|
|
{
|
|
{
|
|
|
|
+ int numSlices = trail.NumSlices;
|
|
|
|
+ int numSlices_2 = numSlices/2;
|
|
|
|
+ int numAbove = 0;
|
|
|
|
+ int numBelow = 0;
|
|
|
|
+ float sumAbove = 0;
|
|
|
|
+ float sumBelow = 0;
|
|
|
|
+ for (int i = 0; i < numSlices; i++) {
|
|
|
|
+ float length = trail[i].Length;
|
|
|
|
+ if (i < numSlices_2)
|
|
|
|
+ {
|
|
|
|
+ numBelow++;
|
|
|
|
+ sumBelow += length;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ numAbove++;
|
|
|
|
+ sumAbove += length;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ float avergaeAbove = sumAbove / numAbove;
|
|
|
|
+ float averageBelow = sumBelow / numBelow;
|
|
|
|
+
|
|
|
|
+ Console.WriteLine(averageBelow + "\t" + avergaeAbove);
|
|
|
|
+
|
|
//check direction
|
|
//check direction
|
|
- if (trail.StartSlice.Length > trail.EndSlice.Length)
|
|
|
|
|
|
+ if (avergaeAbove < averageBelow)
|
|
trail.reverse();
|
|
trail.reverse();
|
|
|
|
|
|
return trail;
|
|
return trail;
|