FingerTracker.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using bbiwarg.Recognition.Tracking;
  7. using bbiwarg.Utility;
  8. namespace bbiwarg.Recognition.FingerRecognition
  9. {
  10. class FingerTracker : Tracker<Finger>
  11. {
  12. public List<Finger> Fingers { get { return TrackedObjects; } }
  13. public FingerTracker()
  14. : base(Constants.FingerNumFramesDetectedUntilTracked, Constants.FingerNumFramesLostUntilDeleted, Constants.FingerMinSimilarityForTracking)
  15. {
  16. }
  17. protected override void onDetect(object sender, EventArgs e)
  18. {
  19. TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
  20. if (history.NumFramesInCurrentState == 1)
  21. Logger.log("Finger #" + history.ID.ToString() + " detected", LogSubject.FingerTracker);
  22. }
  23. protected override void onTrack(object sender, EventArgs e)
  24. {
  25. TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
  26. if (history.NumFramesInCurrentState == 1)
  27. Logger.log("Finger #" + history.ID.ToString() + " tracked", LogSubject.FingerTracker);
  28. }
  29. protected override void onRetrack(object sender, EventArgs e)
  30. {
  31. TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
  32. if (history.NumFramesInCurrentState == 1)
  33. Logger.log("Finger #" + history.ID.ToString() + " retracked", LogSubject.FingerTracker);
  34. }
  35. protected override void onLoose(object sender, EventArgs e)
  36. {
  37. TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
  38. if (history.NumFramesInCurrentState == 1)
  39. Logger.log("Finger #" + history.ID.ToString() + " lost", LogSubject.FingerTracker);
  40. }
  41. protected override void onDelete(object sender, EventArgs e)
  42. {
  43. TrackableObjectHistory<Finger> history = (TrackableObjectHistory<Finger>)sender;
  44. if (history.NumFramesInCurrentState == 1)
  45. Logger.log("Finger #" + history.ID.ToString() + " deleted", LogSubject.FingerTracker);
  46. }
  47. }
  48. }