LATCH.cs 3.9 KB

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