TrackerKCF.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 TrackerKCF
  10. //javadoc: TrackerKCF
  11. public class TrackerKCF : 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_TrackerKCF_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal TrackerKCF (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new TrackerKCF __fromPtr__ (IntPtr addr) { return new TrackerKCF (addr); }
  34. // C++: enum MODE
  35. public const int GRAY = (1 << 0);
  36. public const int CN = (1 << 1);
  37. public const int CUSTOM = (1 << 2);
  38. //
  39. // C++: static Ptr_TrackerKCF cv::TrackerKCF::create()
  40. //
  41. //javadoc: TrackerKCF::create()
  42. public static TrackerKCF create ()
  43. {
  44. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  45. TrackerKCF retVal = TrackerKCF.__fromPtr__(tracking_TrackerKCF_create_10());
  46. return retVal;
  47. #else
  48. return null;
  49. #endif
  50. }
  51. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  52. const string LIBNAME = "__Internal";
  53. #else
  54. const string LIBNAME = "opencvforunity";
  55. #endif
  56. // C++: static Ptr_TrackerKCF cv::TrackerKCF::create()
  57. [DllImport (LIBNAME)]
  58. private static extern IntPtr tracking_TrackerKCF_create_10 ();
  59. // native support for java finalize()
  60. [DllImport (LIBNAME)]
  61. private static extern void tracking_TrackerKCF_delete (IntPtr nativeObj);
  62. }
  63. }