AgastFeatureDetector.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.Features2dModule
  7. {
  8. // C++: class AgastFeatureDetector
  9. /**
  10. * Wrapping class for feature detection using the AGAST method. :
  11. */
  12. public class AgastFeatureDetector : Feature2D
  13. {
  14. protected override void Dispose(bool disposing)
  15. {
  16. try
  17. {
  18. if (disposing)
  19. {
  20. }
  21. if (IsEnabledDispose)
  22. {
  23. if (nativeObj != IntPtr.Zero)
  24. features2d_AgastFeatureDetector_delete(nativeObj);
  25. nativeObj = IntPtr.Zero;
  26. }
  27. }
  28. finally
  29. {
  30. base.Dispose(disposing);
  31. }
  32. }
  33. protected internal AgastFeatureDetector(IntPtr addr) : base(addr) { }
  34. // internal usage only
  35. public static new AgastFeatureDetector __fromPtr__(IntPtr addr) { return new AgastFeatureDetector(addr); }
  36. // C++: enum <unnamed>
  37. public const int THRESHOLD = 10000;
  38. public const int NONMAX_SUPPRESSION = 10001;
  39. // C++: enum cv.AgastFeatureDetector.DetectorType
  40. public const int AGAST_5_8 = 0;
  41. public const int AGAST_7_12d = 1;
  42. public const int AGAST_7_12s = 2;
  43. public const int OAST_9_16 = 3;
  44. //
  45. // C++: static Ptr_AgastFeatureDetector cv::AgastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, AgastFeatureDetector_DetectorType type = AgastFeatureDetector::OAST_9_16)
  46. //
  47. public static AgastFeatureDetector create(int threshold, bool nonmaxSuppression, int type)
  48. {
  49. return AgastFeatureDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_AgastFeatureDetector_create_10(threshold, nonmaxSuppression, type)));
  50. }
  51. public static AgastFeatureDetector create(int threshold, bool nonmaxSuppression)
  52. {
  53. return AgastFeatureDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_AgastFeatureDetector_create_11(threshold, nonmaxSuppression)));
  54. }
  55. public static AgastFeatureDetector create(int threshold)
  56. {
  57. return AgastFeatureDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_AgastFeatureDetector_create_12(threshold)));
  58. }
  59. public static AgastFeatureDetector create()
  60. {
  61. return AgastFeatureDetector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_AgastFeatureDetector_create_13()));
  62. }
  63. //
  64. // C++: void cv::AgastFeatureDetector::setThreshold(int threshold)
  65. //
  66. public void setThreshold(int threshold)
  67. {
  68. ThrowIfDisposed();
  69. features2d_AgastFeatureDetector_setThreshold_10(nativeObj, threshold);
  70. }
  71. //
  72. // C++: int cv::AgastFeatureDetector::getThreshold()
  73. //
  74. public int getThreshold()
  75. {
  76. ThrowIfDisposed();
  77. return features2d_AgastFeatureDetector_getThreshold_10(nativeObj);
  78. }
  79. //
  80. // C++: void cv::AgastFeatureDetector::setNonmaxSuppression(bool f)
  81. //
  82. public void setNonmaxSuppression(bool f)
  83. {
  84. ThrowIfDisposed();
  85. features2d_AgastFeatureDetector_setNonmaxSuppression_10(nativeObj, f);
  86. }
  87. //
  88. // C++: bool cv::AgastFeatureDetector::getNonmaxSuppression()
  89. //
  90. public bool getNonmaxSuppression()
  91. {
  92. ThrowIfDisposed();
  93. return features2d_AgastFeatureDetector_getNonmaxSuppression_10(nativeObj);
  94. }
  95. //
  96. // C++: void cv::AgastFeatureDetector::setType(AgastFeatureDetector_DetectorType type)
  97. //
  98. public void setType(int type)
  99. {
  100. ThrowIfDisposed();
  101. features2d_AgastFeatureDetector_setType_10(nativeObj, type);
  102. }
  103. //
  104. // C++: AgastFeatureDetector_DetectorType cv::AgastFeatureDetector::getType()
  105. //
  106. public int getType()
  107. {
  108. ThrowIfDisposed();
  109. return features2d_AgastFeatureDetector_getType_10(nativeObj);
  110. }
  111. //
  112. // C++: String cv::AgastFeatureDetector::getDefaultName()
  113. //
  114. public override string getDefaultName()
  115. {
  116. ThrowIfDisposed();
  117. string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(features2d_AgastFeatureDetector_getDefaultName_10(nativeObj)));
  118. return retVal;
  119. }
  120. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  121. const string LIBNAME = "__Internal";
  122. #else
  123. const string LIBNAME = "opencvforunity";
  124. #endif
  125. // C++: static Ptr_AgastFeatureDetector cv::AgastFeatureDetector::create(int threshold = 10, bool nonmaxSuppression = true, AgastFeatureDetector_DetectorType type = AgastFeatureDetector::OAST_9_16)
  126. [DllImport(LIBNAME)]
  127. private static extern IntPtr features2d_AgastFeatureDetector_create_10(int threshold, [MarshalAs(UnmanagedType.U1)] bool nonmaxSuppression, int type);
  128. [DllImport(LIBNAME)]
  129. private static extern IntPtr features2d_AgastFeatureDetector_create_11(int threshold, [MarshalAs(UnmanagedType.U1)] bool nonmaxSuppression);
  130. [DllImport(LIBNAME)]
  131. private static extern IntPtr features2d_AgastFeatureDetector_create_12(int threshold);
  132. [DllImport(LIBNAME)]
  133. private static extern IntPtr features2d_AgastFeatureDetector_create_13();
  134. // C++: void cv::AgastFeatureDetector::setThreshold(int threshold)
  135. [DllImport(LIBNAME)]
  136. private static extern void features2d_AgastFeatureDetector_setThreshold_10(IntPtr nativeObj, int threshold);
  137. // C++: int cv::AgastFeatureDetector::getThreshold()
  138. [DllImport(LIBNAME)]
  139. private static extern int features2d_AgastFeatureDetector_getThreshold_10(IntPtr nativeObj);
  140. // C++: void cv::AgastFeatureDetector::setNonmaxSuppression(bool f)
  141. [DllImport(LIBNAME)]
  142. private static extern void features2d_AgastFeatureDetector_setNonmaxSuppression_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool f);
  143. // C++: bool cv::AgastFeatureDetector::getNonmaxSuppression()
  144. [DllImport(LIBNAME)]
  145. [return: MarshalAs(UnmanagedType.U1)]
  146. private static extern bool features2d_AgastFeatureDetector_getNonmaxSuppression_10(IntPtr nativeObj);
  147. // C++: void cv::AgastFeatureDetector::setType(AgastFeatureDetector_DetectorType type)
  148. [DllImport(LIBNAME)]
  149. private static extern void features2d_AgastFeatureDetector_setType_10(IntPtr nativeObj, int type);
  150. // C++: AgastFeatureDetector_DetectorType cv::AgastFeatureDetector::getType()
  151. [DllImport(LIBNAME)]
  152. private static extern int features2d_AgastFeatureDetector_getType_10(IntPtr nativeObj);
  153. // C++: String cv::AgastFeatureDetector::getDefaultName()
  154. [DllImport(LIBNAME)]
  155. private static extern IntPtr features2d_AgastFeatureDetector_getDefaultName_10(IntPtr nativeObj);
  156. // native support for java finalize()
  157. [DllImport(LIBNAME)]
  158. private static extern void features2d_AgastFeatureDetector_delete(IntPtr nativeObj);
  159. }
  160. }