FastFeatureDetector.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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 FastFeatureDetector
  10. //javadoc: FastFeatureDetector
  11. public class FastFeatureDetector : Feature2D
  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_FastFeatureDetector_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal FastFeatureDetector (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. // internal usage only
  36. public static new FastFeatureDetector __fromPtr__ (IntPtr addr)
  37. {
  38. return new FastFeatureDetector (addr);
  39. }
  40. // C++: enum DetectorType
  41. public const int TYPE_5_8 = 0;
  42. public const int TYPE_7_12 = 1;
  43. public const int TYPE_9_16 = 2;
  44. // C++: enum <unnamed>
  45. public const int THRESHOLD = 10000;
  46. public const int NONMAX_SUPPRESSION = 10001;
  47. public const int FAST_N = 10002;
  48. //
  49. // C++: FastFeatureDetector_DetectorType cv::FastFeatureDetector::getType()
  50. //
  51. //javadoc: FastFeatureDetector::getType()
  52. public int getType ()
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. int retVal = features2d_FastFeatureDetector_getType_10 (nativeObj);
  57. return retVal;
  58. #else
  59. return -1;
  60. #endif
  61. }
  62. //
  63. // C++: static Ptr_FastFeatureDetector cv::FastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, FastFeatureDetector_DetectorType type = FastFeatureDetector::TYPE_9_16)
  64. //
  65. //javadoc: FastFeatureDetector::create(threshold, nonmaxSuppression, type)
  66. public static FastFeatureDetector create (int threshold, bool nonmaxSuppression, int type)
  67. {
  68. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  69. FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__ (features2d_FastFeatureDetector_create_10 (threshold, nonmaxSuppression, type));
  70. return retVal;
  71. #else
  72. return null;
  73. #endif
  74. }
  75. //javadoc: FastFeatureDetector::create(threshold, nonmaxSuppression)
  76. public static FastFeatureDetector create (int threshold, bool nonmaxSuppression)
  77. {
  78. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  79. FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__ (features2d_FastFeatureDetector_create_11 (threshold, nonmaxSuppression));
  80. return retVal;
  81. #else
  82. return null;
  83. #endif
  84. }
  85. //javadoc: FastFeatureDetector::create(threshold)
  86. public static FastFeatureDetector create (int threshold)
  87. {
  88. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  89. FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__ (features2d_FastFeatureDetector_create_12 (threshold));
  90. return retVal;
  91. #else
  92. return null;
  93. #endif
  94. }
  95. //javadoc: FastFeatureDetector::create()
  96. public static FastFeatureDetector create ()
  97. {
  98. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  99. FastFeatureDetector retVal = FastFeatureDetector.__fromPtr__ (features2d_FastFeatureDetector_create_13 ());
  100. return retVal;
  101. #else
  102. return null;
  103. #endif
  104. }
  105. //
  106. // C++: String cv::FastFeatureDetector::getDefaultName()
  107. //
  108. //javadoc: FastFeatureDetector::getDefaultName()
  109. public override string getDefaultName ()
  110. {
  111. ThrowIfDisposed ();
  112. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  113. string retVal = Marshal.PtrToStringAnsi (features2d_FastFeatureDetector_getDefaultName_10 (nativeObj));
  114. return retVal;
  115. #else
  116. return null;
  117. #endif
  118. }
  119. //
  120. // C++: bool cv::FastFeatureDetector::getNonmaxSuppression()
  121. //
  122. //javadoc: FastFeatureDetector::getNonmaxSuppression()
  123. public bool getNonmaxSuppression ()
  124. {
  125. ThrowIfDisposed ();
  126. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  127. bool retVal = features2d_FastFeatureDetector_getNonmaxSuppression_10 (nativeObj);
  128. return retVal;
  129. #else
  130. return false;
  131. #endif
  132. }
  133. //
  134. // C++: int cv::FastFeatureDetector::getThreshold()
  135. //
  136. //javadoc: FastFeatureDetector::getThreshold()
  137. public int getThreshold ()
  138. {
  139. ThrowIfDisposed ();
  140. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  141. int retVal = features2d_FastFeatureDetector_getThreshold_10 (nativeObj);
  142. return retVal;
  143. #else
  144. return -1;
  145. #endif
  146. }
  147. //
  148. // C++: void cv::FastFeatureDetector::setNonmaxSuppression(bool f)
  149. //
  150. //javadoc: FastFeatureDetector::setNonmaxSuppression(f)
  151. public void setNonmaxSuppression (bool f)
  152. {
  153. ThrowIfDisposed ();
  154. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  155. features2d_FastFeatureDetector_setNonmaxSuppression_10 (nativeObj, f);
  156. return;
  157. #else
  158. return;
  159. #endif
  160. }
  161. //
  162. // C++: void cv::FastFeatureDetector::setThreshold(int threshold)
  163. //
  164. //javadoc: FastFeatureDetector::setThreshold(threshold)
  165. public void setThreshold (int threshold)
  166. {
  167. ThrowIfDisposed ();
  168. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  169. features2d_FastFeatureDetector_setThreshold_10 (nativeObj, threshold);
  170. return;
  171. #else
  172. return;
  173. #endif
  174. }
  175. //
  176. // C++: void cv::FastFeatureDetector::setType(FastFeatureDetector_DetectorType type)
  177. //
  178. //javadoc: FastFeatureDetector::setType(type)
  179. public void setType (int type)
  180. {
  181. ThrowIfDisposed ();
  182. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  183. features2d_FastFeatureDetector_setType_10 (nativeObj, type);
  184. return;
  185. #else
  186. return;
  187. #endif
  188. }
  189. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  190. const string LIBNAME = "__Internal";
  191. #else
  192. const string LIBNAME = "opencvforunity";
  193. #endif
  194. // C++: FastFeatureDetector_DetectorType cv::FastFeatureDetector::getType()
  195. [DllImport (LIBNAME)]
  196. private static extern int features2d_FastFeatureDetector_getType_10 (IntPtr nativeObj);
  197. // C++: static Ptr_FastFeatureDetector cv::FastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, FastFeatureDetector_DetectorType type = FastFeatureDetector::TYPE_9_16)
  198. [DllImport (LIBNAME)]
  199. private static extern IntPtr features2d_FastFeatureDetector_create_10 (int threshold, bool nonmaxSuppression, int type);
  200. [DllImport (LIBNAME)]
  201. private static extern IntPtr features2d_FastFeatureDetector_create_11 (int threshold, bool nonmaxSuppression);
  202. [DllImport (LIBNAME)]
  203. private static extern IntPtr features2d_FastFeatureDetector_create_12 (int threshold);
  204. [DllImport (LIBNAME)]
  205. private static extern IntPtr features2d_FastFeatureDetector_create_13 ();
  206. // C++: String cv::FastFeatureDetector::getDefaultName()
  207. [DllImport (LIBNAME)]
  208. private static extern IntPtr features2d_FastFeatureDetector_getDefaultName_10 (IntPtr nativeObj);
  209. // C++: bool cv::FastFeatureDetector::getNonmaxSuppression()
  210. [DllImport (LIBNAME)]
  211. private static extern bool features2d_FastFeatureDetector_getNonmaxSuppression_10 (IntPtr nativeObj);
  212. // C++: int cv::FastFeatureDetector::getThreshold()
  213. [DllImport (LIBNAME)]
  214. private static extern int features2d_FastFeatureDetector_getThreshold_10 (IntPtr nativeObj);
  215. // C++: void cv::FastFeatureDetector::setNonmaxSuppression(bool f)
  216. [DllImport (LIBNAME)]
  217. private static extern void features2d_FastFeatureDetector_setNonmaxSuppression_10 (IntPtr nativeObj, bool f);
  218. // C++: void cv::FastFeatureDetector::setThreshold(int threshold)
  219. [DllImport (LIBNAME)]
  220. private static extern void features2d_FastFeatureDetector_setThreshold_10 (IntPtr nativeObj, int threshold);
  221. // C++: void cv::FastFeatureDetector::setType(FastFeatureDetector_DetectorType type)
  222. [DllImport (LIBNAME)]
  223. private static extern void features2d_FastFeatureDetector_setType_10 (IntPtr nativeObj, int type);
  224. // native support for java finalize()
  225. [DllImport (LIBNAME)]
  226. private static extern void features2d_FastFeatureDetector_delete (IntPtr nativeObj);
  227. }
  228. }