legacy_TrackerMedianFlow.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 TrackerMedianFlow
  9. /**
  10. * the Median Flow tracker
  11. *
  12. * Implementation of a paper CITE: MedianFlow .
  13. *
  14. * The tracker is suitable for very smooth and predictable movements when object is visible throughout
  15. * the whole sequence. It's quite and accurate for this type of problems (in particular, it was shown
  16. * by authors to outperform MIL). During the implementation period the code at
  17. * <http://www.aonsquared.co.uk/node/5>, the courtesy of the author Arthur Amarra, was used for the
  18. * reference purpose.
  19. */
  20. public class legacy_TrackerMedianFlow : legacy_Tracker
  21. {
  22. protected override void Dispose(bool disposing)
  23. {
  24. try
  25. {
  26. if (disposing)
  27. {
  28. }
  29. if (IsEnabledDispose)
  30. {
  31. if (nativeObj != IntPtr.Zero)
  32. tracking_legacy_1TrackerMedianFlow_delete(nativeObj);
  33. nativeObj = IntPtr.Zero;
  34. }
  35. }
  36. finally
  37. {
  38. base.Dispose(disposing);
  39. }
  40. }
  41. protected internal legacy_TrackerMedianFlow(IntPtr addr) : base(addr) { }
  42. // internal usage only
  43. public static new legacy_TrackerMedianFlow __fromPtr__(IntPtr addr) { return new legacy_TrackerMedianFlow(addr); }
  44. //
  45. // C++: static Ptr_legacy_TrackerMedianFlow cv::legacy::TrackerMedianFlow::create()
  46. //
  47. /**
  48. * Constructor
  49. * return automatically generated
  50. */
  51. public static legacy_TrackerMedianFlow create()
  52. {
  53. return legacy_TrackerMedianFlow.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(tracking_legacy_1TrackerMedianFlow_create_10()));
  54. }
  55. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  56. const string LIBNAME = "__Internal";
  57. #else
  58. const string LIBNAME = "opencvforunity";
  59. #endif
  60. // C++: static Ptr_legacy_TrackerMedianFlow cv::legacy::TrackerMedianFlow::create()
  61. [DllImport(LIBNAME)]
  62. private static extern IntPtr tracking_legacy_1TrackerMedianFlow_create_10();
  63. // native support for java finalize()
  64. [DllImport(LIBNAME)]
  65. private static extern void tracking_legacy_1TrackerMedianFlow_delete(IntPtr nativeObj);
  66. }
  67. }