LUCID.cs 2.9 KB

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