|
@@ -26,7 +26,6 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
{
|
|
{
|
|
FingerHistories = new List<FingerHistory>();
|
|
FingerHistories = new List<FingerHistory>();
|
|
Fingers = new List<Finger>();
|
|
Fingers = new List<Finger>();
|
|
- FingerHistory.resetNextID();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public void updateTrackedFingers(List<Finger> detectedFingers, OutputImage outputImage)
|
|
public void updateTrackedFingers(List<Finger> detectedFingers, OutputImage outputImage)
|
|
@@ -47,12 +46,7 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
}
|
|
}
|
|
|
|
|
|
drawFingers(outputImage);
|
|
drawFingers(outputImage);
|
|
- foreach (FingerHistory fh in FingerHistories) {
|
|
|
|
- if (fh.CurrentFinger != null) {
|
|
|
|
- Finger f = fh.CurrentFinger;
|
|
|
|
- outputImage.drawText(f.HandPoint.IntX, f.HandPoint.IntY, "#" + fh.ID, Color.Red);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ drawFingerIDs(outputImage);
|
|
}
|
|
}
|
|
|
|
|
|
private void updateHistories(List<Finger> detectedFingers)
|
|
private void updateHistories(List<Finger> detectedFingers)
|
|
@@ -93,6 +87,7 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
//add null finger to TrackedFingers that haven't found a match in this frame (status tracked->lost)
|
|
//add null finger to TrackedFingers that haven't found a match in this frame (status tracked->lost)
|
|
foreach (FingerHistory fh in unasignedFingerHistories)
|
|
foreach (FingerHistory fh in unasignedFingerHistories)
|
|
{
|
|
{
|
|
|
|
+ if (Constants.VerboseFingerTracker && fh.CurrentState != TrackingState.Lost) Console.WriteLine("Finger #" + fh.ID + " lost");
|
|
fh.addFinger(null);
|
|
fh.addFinger(null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -148,7 +143,7 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
if (fh.CurrentState == TrackingState.Lost && fh.getNumFramesInCurrentState() >= Constants.FingerNumFramesUntilLost)
|
|
if (fh.CurrentState == TrackingState.Lost && fh.getNumFramesInCurrentState() >= Constants.FingerNumFramesUntilLost)
|
|
{
|
|
{
|
|
FingerHistories.RemoveAt(i);
|
|
FingerHistories.RemoveAt(i);
|
|
- if (Constants.VerboseFingerTracker) Console.WriteLine("Finger #" + fh.ID + " lost");
|
|
|
|
|
|
+ if (Constants.VerboseFingerTracker) Console.WriteLine("Finger #" + fh.ID + " deleted");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -160,5 +155,16 @@ namespace bbiwarg.Recognition.FingerRecognition
|
|
finger.draw(outputImage, true);
|
|
finger.draw(outputImage, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void drawFingerIDs(OutputImage outputImage) {
|
|
|
|
+ foreach (FingerHistory fh in FingerHistories)
|
|
|
|
+ {
|
|
|
|
+ if (fh.CurrentFinger != null)
|
|
|
|
+ {
|
|
|
|
+ Finger f = fh.CurrentFinger;
|
|
|
|
+ outputImage.drawText(f.TipPoint.IntX, f.TipPoint.IntY, fh.ID.ToString(), Constants.FingerIDColor);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|