LATCH.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 LATCH
  11. //javadoc: LATCH
  12. public class LATCH : 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_LATCH_delete(nativeObj);
  23. nativeObj = IntPtr.Zero;
  24. }
  25. } finally {
  26. base.Dispose (disposing);
  27. }
  28. #else
  29. return;
  30. #endif
  31. }
  32. protected internal LATCH (IntPtr addr) : base (addr) { }
  33. // internal usage only
  34. public static new LATCH __fromPtr__ (IntPtr addr) { return new LATCH (addr); }
  35. //
  36. // C++: static Ptr_LATCH cv::xfeatures2d::LATCH::create(int bytes = 32, bool rotationInvariance = true, int half_ssd_size = 3, double sigma = 2.0)
  37. //
  38. //javadoc: LATCH::create(bytes, rotationInvariance, half_ssd_size, sigma)
  39. public static LATCH create (int bytes, bool rotationInvariance, int half_ssd_size, double sigma)
  40. {
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. LATCH retVal = LATCH.__fromPtr__(xfeatures2d_LATCH_create_10(bytes, rotationInvariance, half_ssd_size, sigma));
  43. return retVal;
  44. #else
  45. return null;
  46. #endif
  47. }
  48. //javadoc: LATCH::create(bytes, rotationInvariance, half_ssd_size)
  49. public static LATCH create (int bytes, bool rotationInvariance, int half_ssd_size)
  50. {
  51. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  52. LATCH retVal = LATCH.__fromPtr__(xfeatures2d_LATCH_create_11(bytes, rotationInvariance, half_ssd_size));
  53. return retVal;
  54. #else
  55. return null;
  56. #endif
  57. }
  58. //javadoc: LATCH::create(bytes, rotationInvariance)
  59. public static LATCH create (int bytes, bool rotationInvariance)
  60. {
  61. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  62. LATCH retVal = LATCH.__fromPtr__(xfeatures2d_LATCH_create_12(bytes, rotationInvariance));
  63. return retVal;
  64. #else
  65. return null;
  66. #endif
  67. }
  68. //javadoc: LATCH::create(bytes)
  69. public static LATCH create (int bytes)
  70. {
  71. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  72. LATCH retVal = LATCH.__fromPtr__(xfeatures2d_LATCH_create_13(bytes));
  73. return retVal;
  74. #else
  75. return null;
  76. #endif
  77. }
  78. //javadoc: LATCH::create()
  79. public static LATCH create ()
  80. {
  81. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  82. LATCH retVal = LATCH.__fromPtr__(xfeatures2d_LATCH_create_14());
  83. return retVal;
  84. #else
  85. return null;
  86. #endif
  87. }
  88. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  89. const string LIBNAME = "__Internal";
  90. #else
  91. const string LIBNAME = "opencvforunity";
  92. #endif
  93. // C++: static Ptr_LATCH cv::xfeatures2d::LATCH::create(int bytes = 32, bool rotationInvariance = true, int half_ssd_size = 3, double sigma = 2.0)
  94. [DllImport (LIBNAME)]
  95. private static extern IntPtr xfeatures2d_LATCH_create_10 (int bytes, bool rotationInvariance, int half_ssd_size, double sigma);
  96. [DllImport (LIBNAME)]
  97. private static extern IntPtr xfeatures2d_LATCH_create_11 (int bytes, bool rotationInvariance, int half_ssd_size);
  98. [DllImport (LIBNAME)]
  99. private static extern IntPtr xfeatures2d_LATCH_create_12 (int bytes, bool rotationInvariance);
  100. [DllImport (LIBNAME)]
  101. private static extern IntPtr xfeatures2d_LATCH_create_13 (int bytes);
  102. [DllImport (LIBNAME)]
  103. private static extern IntPtr xfeatures2d_LATCH_create_14 ();
  104. // native support for java finalize()
  105. [DllImport (LIBNAME)]
  106. private static extern void xfeatures2d_LATCH_delete (IntPtr nativeObj);
  107. }
  108. }