TrackerCSRT.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.TrackingModule
  8. {
  9. // C++: class TrackerCSRT
  10. //javadoc: TrackerCSRT
  11. public class TrackerCSRT : Tracker
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. tracking_TrackerCSRT_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal TrackerCSRT (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new TrackerCSRT __fromPtr__ (IntPtr addr) { return new TrackerCSRT (addr); }
  34. //
  35. // C++: static Ptr_TrackerCSRT cv::TrackerCSRT::create()
  36. //
  37. //javadoc: TrackerCSRT::create()
  38. public static TrackerCSRT create ()
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. TrackerCSRT retVal = TrackerCSRT.__fromPtr__(tracking_TrackerCSRT_create_10());
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //
  48. // C++: void cv::TrackerCSRT::setInitialMask(Mat mask)
  49. //
  50. //javadoc: TrackerCSRT::setInitialMask(mask)
  51. public void setInitialMask (Mat mask)
  52. {
  53. ThrowIfDisposed ();
  54. if (mask != null) mask.ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. tracking_TrackerCSRT_setInitialMask_10(nativeObj, mask.nativeObj);
  57. return;
  58. #else
  59. return;
  60. #endif
  61. }
  62. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  63. const string LIBNAME = "__Internal";
  64. #else
  65. const string LIBNAME = "opencvforunity";
  66. #endif
  67. // C++: static Ptr_TrackerCSRT cv::TrackerCSRT::create()
  68. [DllImport (LIBNAME)]
  69. private static extern IntPtr tracking_TrackerCSRT_create_10 ();
  70. // C++: void cv::TrackerCSRT::setInitialMask(Mat mask)
  71. [DllImport (LIBNAME)]
  72. private static extern void tracking_TrackerCSRT_setInitialMask_10 (IntPtr nativeObj, IntPtr mask_nativeObj);
  73. // native support for java finalize()
  74. [DllImport (LIBNAME)]
  75. private static extern void tracking_TrackerCSRT_delete (IntPtr nativeObj);
  76. }
  77. }