|
@@ -62,24 +62,11 @@ namespace bbiwarg.Recognition.PalmRecognition
|
|
|
|
|
|
public override float calculateSimilarity(Palm detectedPalm)
|
|
public override float calculateSimilarity(Palm detectedPalm)
|
|
{
|
|
{
|
|
- //hand
|
|
|
|
float handSimilarity = (detectedPalm.Hand.TrackID == LastObject.Hand.TrackID) ? 1 : 0;
|
|
float handSimilarity = (detectedPalm.Hand.TrackID == LastObject.Hand.TrackID) ? 1 : 0;
|
|
-
|
|
|
|
- //wristUpper
|
|
|
|
- float wristUpperDistance = WristUpperPrediction.getDistanceTo(detectedPalm.WristUpper);
|
|
|
|
- float wristUpperSimilarity = Math.Max(0, 1 - wristUpperDistance / Parameters.PalmTrackerMaxWristUpperMove);
|
|
|
|
-
|
|
|
|
- //wristLower
|
|
|
|
- float wristLowerDistance = WristLowerPrediction.getDistanceTo(detectedPalm.WristLower);
|
|
|
|
- float wristLowerSimilarity = Math.Max(0, 1 - wristLowerDistance / Parameters.PalmTrackerMaxWristLowerMove);
|
|
|
|
-
|
|
|
|
- //fingersUpper
|
|
|
|
- float fingersUpperDistance = FingersUpperPrediction.getDistanceTo(detectedPalm.FingersUpper);
|
|
|
|
- float fingersUpperSimilarity = Math.Max(0, 1 - fingersUpperDistance / Parameters.PalmTrackerMaxFingersUpperMove);
|
|
|
|
-
|
|
|
|
- //fingersLower
|
|
|
|
- float fingersLowerDistance = FingersLowerPrediction.getDistanceTo(detectedPalm.FingersLower);
|
|
|
|
- float fingersLowerSimilarity = Math.Max(0, 1 - fingersLowerDistance / Parameters.PalmTrackerMaxFingersLowerMove);
|
|
|
|
|
|
+ float wristUpperSimilarity = getPositionSimilarity(WristUpperPrediction, detectedPalm.WristUpper, Parameters.PalmTrackerMaxWristUpperMove);
|
|
|
|
+ float wristLowerSimilarity = getPositionSimilarity(WristLowerPrediction, detectedPalm.WristLower, Parameters.PalmTrackerMaxWristLowerMove);
|
|
|
|
+ float fingersUpperSimilarity = getPositionSimilarity(FingersUpperPrediction, detectedPalm.FingersUpper, Parameters.PalmTrackerMaxFingersUpperMove);
|
|
|
|
+ float fingersLowerSimilarity = getPositionSimilarity(FingersLowerPrediction, detectedPalm.FingersLower, Parameters.PalmTrackerMaxFingersLowerMove);
|
|
|
|
|
|
float similarity = handSimilarity * wristUpperSimilarity * wristLowerSimilarity * fingersUpperSimilarity * fingersLowerSimilarity;
|
|
float similarity = handSimilarity * wristUpperSimilarity * wristLowerSimilarity * fingersUpperSimilarity * fingersLowerSimilarity;
|
|
|
|
|