PalmTracker.cs 1.1 KB

12345678910111213141516171819202122232425262728293031
  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. namespace bbiwarg.Recognition.PalmRecognition
  8. {
  9. class PalmTracker : Tracker<Palm, TrackedPalm>
  10. {
  11. public List<Palm> Palms { get { return getCurrentObjectsWithState(TrackingState.Tracked); } }
  12. public List<Palm> OptimizedPalms { get { return getOptimizedPalms(); } }
  13. protected override TrackedPalm createTrackedObject(Palm detectedPalm)
  14. {
  15. return new TrackedPalm(idPool.getNextUnusedID(), detectedPalm, Parameters.PalmTrackerNumFramesDetectedUntilTracked, Parameters.PalmTrackerNumFramesLostUntilDeleted);
  16. }
  17. private List<Palm> getOptimizedPalms()
  18. {
  19. List<Palm> optimizedPalms = new List<Palm>();
  20. foreach (TrackedPalm tp in TrackedObjects)
  21. {
  22. if (tp.CurrentState == TrackingState.Tracked)
  23. optimizedPalms.Add(tp.OptimizedPalm);
  24. }
  25. return optimizedPalms;
  26. }
  27. }
  28. }