legacy_TrackerCSRT.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 TrackerCSRT
  9. /**
  10. * the CSRT tracker
  11. *
  12. * The implementation is based on CITE: Lukezic_IJCV2018 Discriminative Correlation Filter with Channel and Spatial Reliability
  13. */
  14. public class legacy_TrackerCSRT : legacy_Tracker
  15. {
  16. protected override void Dispose(bool disposing)
  17. {
  18. try
  19. {
  20. if (disposing)
  21. {
  22. }
  23. if (IsEnabledDispose)
  24. {
  25. if (nativeObj != IntPtr.Zero)
  26. tracking_legacy_1TrackerCSRT_delete(nativeObj);
  27. nativeObj = IntPtr.Zero;
  28. }
  29. }
  30. finally
  31. {
  32. base.Dispose(disposing);
  33. }
  34. }
  35. protected internal legacy_TrackerCSRT(IntPtr addr) : base(addr) { }
  36. // internal usage only
  37. public static new legacy_TrackerCSRT __fromPtr__(IntPtr addr) { return new legacy_TrackerCSRT(addr); }
  38. //
  39. // C++: static Ptr_legacy_TrackerCSRT cv::legacy::TrackerCSRT::create()
  40. //
  41. /**
  42. * Constructor
  43. * return automatically generated
  44. */
  45. public static legacy_TrackerCSRT create()
  46. {
  47. return legacy_TrackerCSRT.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(tracking_legacy_1TrackerCSRT_create_10()));
  48. }
  49. //
  50. // C++: void cv::legacy::TrackerCSRT::setInitialMask(Mat mask)
  51. //
  52. public void setInitialMask(Mat mask)
  53. {
  54. ThrowIfDisposed();
  55. if (mask != null) mask.ThrowIfDisposed();
  56. tracking_legacy_1TrackerCSRT_setInitialMask_10(nativeObj, mask.nativeObj);
  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_TrackerCSRT cv::legacy::TrackerCSRT::create()
  64. [DllImport(LIBNAME)]
  65. private static extern IntPtr tracking_legacy_1TrackerCSRT_create_10();
  66. // C++: void cv::legacy::TrackerCSRT::setInitialMask(Mat mask)
  67. [DllImport(LIBNAME)]
  68. private static extern void tracking_legacy_1TrackerCSRT_setInitialMask_10(IntPtr nativeObj, IntPtr mask_nativeObj);
  69. // native support for java finalize()
  70. [DllImport(LIBNAME)]
  71. private static extern void tracking_legacy_1TrackerCSRT_delete(IntPtr nativeObj);
  72. }
  73. }