legacy_TrackerTLD.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.TrackingModule
  7. {
  8. // C++: class TrackerTLD
  9. /**
  10. * the TLD (Tracking, learning and detection) tracker
  11. *
  12. * TLD is a novel tracking framework that explicitly decomposes the long-term tracking task into
  13. * tracking, learning and detection.
  14. *
  15. * The tracker follows the object from frame to frame. The detector localizes all appearances that
  16. * have been observed so far and corrects the tracker if necessary. The learning estimates detector's
  17. * errors and updates it to avoid these errors in the future. The implementation is based on CITE: TLD .
  18. *
  19. * The Median Flow algorithm (see cv::TrackerMedianFlow) was chosen as a tracking component in this
  20. * implementation, following authors. The tracker is supposed to be able to handle rapid motions, partial
  21. * occlusions, object absence etc.
  22. */
  23. public class legacy_TrackerTLD : legacy_Tracker
  24. {
  25. protected override void Dispose(bool disposing)
  26. {
  27. try
  28. {
  29. if (disposing)
  30. {
  31. }
  32. if (IsEnabledDispose)
  33. {
  34. if (nativeObj != IntPtr.Zero)
  35. tracking_legacy_1TrackerTLD_delete(nativeObj);
  36. nativeObj = IntPtr.Zero;
  37. }
  38. }
  39. finally
  40. {
  41. base.Dispose(disposing);
  42. }
  43. }
  44. protected internal legacy_TrackerTLD(IntPtr addr) : base(addr) { }
  45. // internal usage only
  46. public static new legacy_TrackerTLD __fromPtr__(IntPtr addr) { return new legacy_TrackerTLD(addr); }
  47. //
  48. // C++: static Ptr_legacy_TrackerTLD cv::legacy::TrackerTLD::create()
  49. //
  50. /**
  51. * Constructor
  52. * return automatically generated
  53. */
  54. public static legacy_TrackerTLD create()
  55. {
  56. return legacy_TrackerTLD.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(tracking_legacy_1TrackerTLD_create_10()));
  57. }
  58. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  59. const string LIBNAME = "__Internal";
  60. #else
  61. const string LIBNAME = "opencvforunity";
  62. #endif
  63. // C++: static Ptr_legacy_TrackerTLD cv::legacy::TrackerTLD::create()
  64. [DllImport(LIBNAME)]
  65. private static extern IntPtr tracking_legacy_1TrackerTLD_create_10();
  66. // native support for java finalize()
  67. [DllImport(LIBNAME)]
  68. private static extern void tracking_legacy_1TrackerTLD_delete(IntPtr nativeObj);
  69. }
  70. }