BaseCascadeClassifier.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.ObjdetectModule
  7. {
  8. // C++: class BaseCascadeClassifier
  9. public class BaseCascadeClassifier : Algorithm
  10. {
  11. protected override void Dispose(bool disposing)
  12. {
  13. try
  14. {
  15. if (disposing)
  16. {
  17. }
  18. if (IsEnabledDispose)
  19. {
  20. if (nativeObj != IntPtr.Zero)
  21. objdetect_BaseCascadeClassifier_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. }
  25. finally
  26. {
  27. base.Dispose(disposing);
  28. }
  29. }
  30. protected internal BaseCascadeClassifier(IntPtr addr) : base(addr) { }
  31. // internal usage only
  32. public static new BaseCascadeClassifier __fromPtr__(IntPtr addr) { return new BaseCascadeClassifier(addr); }
  33. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  34. const string LIBNAME = "__Internal";
  35. #else
  36. const string LIBNAME = "opencvforunity";
  37. #endif
  38. // native support for java finalize()
  39. [DllImport(LIBNAME)]
  40. private static extern void objdetect_BaseCascadeClassifier_delete(IntPtr nativeObj);
  41. }
  42. }