BFMatcher.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.Features2dModule
  8. {
  9. // C++: class BFMatcher
  10. //javadoc: BFMatcher
  11. public class BFMatcher : DescriptorMatcher
  12. {
  13. protected override void Dispose (bool disposing)
  14. {
  15. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  16. try {
  17. if (disposing) {
  18. }
  19. if (IsEnabledDispose) {
  20. if (nativeObj != IntPtr.Zero)
  21. features2d_BFMatcher_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal BFMatcher (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. // internal usage only
  36. public static new BFMatcher __fromPtr__ (IntPtr addr)
  37. {
  38. return new BFMatcher (addr);
  39. }
  40. //
  41. // C++: cv::BFMatcher::BFMatcher(int normType = NORM_L2, bool crossCheck = false)
  42. //
  43. //javadoc: BFMatcher::BFMatcher(normType, crossCheck)
  44. public BFMatcher (int normType, bool crossCheck) :
  45. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  46. base (features2d_BFMatcher_BFMatcher_10 (normType, crossCheck))
  47. #else
  48. base (IntPtr.Zero)
  49. #endif
  50. {
  51. return;
  52. }
  53. //javadoc: BFMatcher::BFMatcher(normType)
  54. public BFMatcher (int normType) :
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. base (features2d_BFMatcher_BFMatcher_11 (normType))
  57. #else
  58. base (IntPtr.Zero)
  59. #endif
  60. {
  61. return;
  62. }
  63. //javadoc: BFMatcher::BFMatcher()
  64. public BFMatcher () :
  65. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  66. base (features2d_BFMatcher_BFMatcher_12 ())
  67. #else
  68. base (IntPtr.Zero)
  69. #endif
  70. {
  71. return;
  72. }
  73. //
  74. // C++: static Ptr_BFMatcher cv::BFMatcher::create(int normType = NORM_L2, bool crossCheck = false)
  75. //
  76. //javadoc: BFMatcher::create(normType, crossCheck)
  77. public static BFMatcher create (int normType, bool crossCheck)
  78. {
  79. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  80. BFMatcher retVal = BFMatcher.__fromPtr__ (features2d_BFMatcher_create_10 (normType, crossCheck));
  81. return retVal;
  82. #else
  83. return null;
  84. #endif
  85. }
  86. //javadoc: BFMatcher::create(normType)
  87. public static new BFMatcher create (int normType)
  88. {
  89. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  90. BFMatcher retVal = BFMatcher.__fromPtr__ (features2d_BFMatcher_create_11 (normType));
  91. return retVal;
  92. #else
  93. return null;
  94. #endif
  95. }
  96. //javadoc: BFMatcher::create()
  97. public static BFMatcher create ()
  98. {
  99. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  100. BFMatcher retVal = BFMatcher.__fromPtr__ (features2d_BFMatcher_create_12 ());
  101. return retVal;
  102. #else
  103. return null;
  104. #endif
  105. }
  106. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  107. const string LIBNAME = "__Internal";
  108. #else
  109. const string LIBNAME = "opencvforunity";
  110. #endif
  111. // C++: cv::BFMatcher::BFMatcher(int normType = NORM_L2, bool crossCheck = false)
  112. [DllImport (LIBNAME)]
  113. private static extern IntPtr features2d_BFMatcher_BFMatcher_10 (int normType, bool crossCheck);
  114. [DllImport (LIBNAME)]
  115. private static extern IntPtr features2d_BFMatcher_BFMatcher_11 (int normType);
  116. [DllImport (LIBNAME)]
  117. private static extern IntPtr features2d_BFMatcher_BFMatcher_12 ();
  118. // C++: static Ptr_BFMatcher cv::BFMatcher::create(int normType = NORM_L2, bool crossCheck = false)
  119. [DllImport (LIBNAME)]
  120. private static extern IntPtr features2d_BFMatcher_create_10 (int normType, bool crossCheck);
  121. [DllImport (LIBNAME)]
  122. private static extern IntPtr features2d_BFMatcher_create_11 (int normType);
  123. [DllImport (LIBNAME)]
  124. private static extern IntPtr features2d_BFMatcher_create_12 ();
  125. // native support for java finalize()
  126. [DllImport (LIBNAME)]
  127. private static extern void features2d_BFMatcher_delete (IntPtr nativeObj);
  128. }
  129. }