legacy_TrackerKCF.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 TrackerKCF
  9. /**
  10. * the KCF (Kernelized Correlation Filter) tracker
  11. *
  12. * KCF is a novel tracking framework that utilizes properties of circulant matrix to enhance the processing speed.
  13. * This tracking method is an implementation of CITE: KCF_ECCV which is extended to KCF with color-names features (CITE: KCF_CN).
  14. * The original paper of KCF is available at <http://www.robots.ox.ac.uk/~joao/publications/henriques_tpami2015.pdf>
  15. * as well as the matlab implementation. For more information about KCF with color-names features, please refer to
  16. * <http://www.cvl.isy.liu.se/research/objrec/visualtracking/colvistrack/index.html>.
  17. */
  18. public class legacy_TrackerKCF : legacy_Tracker
  19. {
  20. protected override void Dispose(bool disposing)
  21. {
  22. try
  23. {
  24. if (disposing)
  25. {
  26. }
  27. if (IsEnabledDispose)
  28. {
  29. if (nativeObj != IntPtr.Zero)
  30. tracking_legacy_1TrackerKCF_delete(nativeObj);
  31. nativeObj = IntPtr.Zero;
  32. }
  33. }
  34. finally
  35. {
  36. base.Dispose(disposing);
  37. }
  38. }
  39. protected internal legacy_TrackerKCF(IntPtr addr) : base(addr) { }
  40. // internal usage only
  41. public static new legacy_TrackerKCF __fromPtr__(IntPtr addr) { return new legacy_TrackerKCF(addr); }
  42. //
  43. // C++: static Ptr_legacy_TrackerKCF cv::legacy::TrackerKCF::create()
  44. //
  45. /**
  46. * Constructor
  47. * return automatically generated
  48. */
  49. public static legacy_TrackerKCF create()
  50. {
  51. return legacy_TrackerKCF.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(tracking_legacy_1TrackerKCF_create_10()));
  52. }
  53. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  54. const string LIBNAME = "__Internal";
  55. #else
  56. const string LIBNAME = "opencvforunity";
  57. #endif
  58. // C++: static Ptr_legacy_TrackerKCF cv::legacy::TrackerKCF::create()
  59. [DllImport(LIBNAME)]
  60. private static extern IntPtr tracking_legacy_1TrackerKCF_create_10();
  61. // native support for java finalize()
  62. [DllImport(LIBNAME)]
  63. private static extern void tracking_legacy_1TrackerKCF_delete(IntPtr nativeObj);
  64. }
  65. }