legacy_TrackerMOSSE.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 TrackerMOSSE
  9. /**
  10. * the MOSSE (Minimum Output Sum of Squared %Error) tracker
  11. *
  12. * The implementation is based on CITE: MOSSE Visual Object Tracking using Adaptive Correlation Filters
  13. * <b>Note:</b> this tracker works with grayscale images, if passed bgr ones, they will get converted internally.
  14. */
  15. public class legacy_TrackerMOSSE : legacy_Tracker
  16. {
  17. protected override void Dispose(bool disposing)
  18. {
  19. try
  20. {
  21. if (disposing)
  22. {
  23. }
  24. if (IsEnabledDispose)
  25. {
  26. if (nativeObj != IntPtr.Zero)
  27. tracking_legacy_1TrackerMOSSE_delete(nativeObj);
  28. nativeObj = IntPtr.Zero;
  29. }
  30. }
  31. finally
  32. {
  33. base.Dispose(disposing);
  34. }
  35. }
  36. protected internal legacy_TrackerMOSSE(IntPtr addr) : base(addr) { }
  37. // internal usage only
  38. public static new legacy_TrackerMOSSE __fromPtr__(IntPtr addr) { return new legacy_TrackerMOSSE(addr); }
  39. //
  40. // C++: static Ptr_legacy_TrackerMOSSE cv::legacy::TrackerMOSSE::create()
  41. //
  42. /**
  43. * Constructor
  44. * return automatically generated
  45. */
  46. public static legacy_TrackerMOSSE create()
  47. {
  48. return legacy_TrackerMOSSE.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(tracking_legacy_1TrackerMOSSE_create_10()));
  49. }
  50. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  51. const string LIBNAME = "__Internal";
  52. #else
  53. const string LIBNAME = "opencvforunity";
  54. #endif
  55. // C++: static Ptr_legacy_TrackerMOSSE cv::legacy::TrackerMOSSE::create()
  56. [DllImport(LIBNAME)]
  57. private static extern IntPtr tracking_legacy_1TrackerMOSSE_create_10();
  58. // native support for java finalize()
  59. [DllImport(LIBNAME)]
  60. private static extern void tracking_legacy_1TrackerMOSSE_delete(IntPtr nativeObj);
  61. }
  62. }