DAISY.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.Features2dModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.Xfeatures2dModule
  8. {
  9. // C++: class DAISY
  10. /**
  11. * Class implementing DAISY descriptor, described in CITE: Tola10
  12. *
  13. * radius radius of the descriptor at the initial scale
  14. * q_radius amount of radial range division quantity
  15. * q_theta amount of angular range division quantity
  16. * q_hist amount of gradient orientations range division quantity
  17. * norm choose descriptors normalization type, where
  18. * DAISY::NRM_NONE will not do any normalization (default),
  19. * DAISY::NRM_PARTIAL mean that histograms are normalized independently for L2 norm equal to 1.0,
  20. * DAISY::NRM_FULL mean that descriptors are normalized for L2 norm equal to 1.0,
  21. * DAISY::NRM_SIFT mean that descriptors are normalized for L2 norm equal to 1.0 but no individual one is bigger than 0.154 as in SIFT
  22. * H optional 3x3 homography matrix used to warp the grid of daisy but sampling keypoints remains unwarped on image
  23. * interpolation switch to disable interpolation for speed improvement at minor quality loss
  24. * use_orientation sample patterns using keypoints orientation, disabled by default.
  25. */
  26. public class DAISY : Feature2D
  27. {
  28. protected override void Dispose(bool disposing)
  29. {
  30. try
  31. {
  32. if (disposing)
  33. {
  34. }
  35. if (IsEnabledDispose)
  36. {
  37. if (nativeObj != IntPtr.Zero)
  38. xfeatures2d_DAISY_delete(nativeObj);
  39. nativeObj = IntPtr.Zero;
  40. }
  41. }
  42. finally
  43. {
  44. base.Dispose(disposing);
  45. }
  46. }
  47. protected internal DAISY(IntPtr addr) : base(addr) { }
  48. // internal usage only
  49. public static new DAISY __fromPtr__(IntPtr addr) { return new DAISY(addr); }
  50. // C++: enum cv.xfeatures2d.DAISY.NormalizationType
  51. public const int NRM_NONE = 100;
  52. public const int NRM_PARTIAL = 101;
  53. public const int NRM_FULL = 102;
  54. public const int NRM_SIFT = 103;
  55. //
  56. // C++: static Ptr_DAISY cv::xfeatures2d::DAISY::create(float radius = 15, int q_radius = 3, int q_theta = 8, int q_hist = 8, DAISY_NormalizationType norm = DAISY::NRM_NONE, Mat H = Mat(), bool interpolation = true, bool use_orientation = false)
  57. //
  58. public static DAISY create(float radius, int q_radius, int q_theta, int q_hist, Mat H, bool interpolation, bool use_orientation)
  59. {
  60. if (H != null) H.ThrowIfDisposed();
  61. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_10(radius, q_radius, q_theta, q_hist, H.nativeObj, interpolation, use_orientation)));
  62. }
  63. public static DAISY create(float radius, int q_radius, int q_theta, int q_hist, Mat H, bool interpolation)
  64. {
  65. if (H != null) H.ThrowIfDisposed();
  66. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_11(radius, q_radius, q_theta, q_hist, H.nativeObj, interpolation)));
  67. }
  68. public static DAISY create(float radius, int q_radius, int q_theta, int q_hist, Mat H)
  69. {
  70. if (H != null) H.ThrowIfDisposed();
  71. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_12(radius, q_radius, q_theta, q_hist, H.nativeObj)));
  72. }
  73. public static DAISY create(float radius, int q_radius, int q_theta, int q_hist)
  74. {
  75. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_13(radius, q_radius, q_theta, q_hist)));
  76. }
  77. public static DAISY create(float radius, int q_radius, int q_theta)
  78. {
  79. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_15(radius, q_radius, q_theta)));
  80. }
  81. public static DAISY create(float radius, int q_radius)
  82. {
  83. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_16(radius, q_radius)));
  84. }
  85. public static DAISY create(float radius)
  86. {
  87. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_17(radius)));
  88. }
  89. public static DAISY create()
  90. {
  91. return DAISY.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_create_18()));
  92. }
  93. //
  94. // C++: void cv::xfeatures2d::DAISY::setRadius(float radius)
  95. //
  96. public void setRadius(float radius)
  97. {
  98. ThrowIfDisposed();
  99. xfeatures2d_DAISY_setRadius_10(nativeObj, radius);
  100. }
  101. //
  102. // C++: float cv::xfeatures2d::DAISY::getRadius()
  103. //
  104. public float getRadius()
  105. {
  106. ThrowIfDisposed();
  107. return xfeatures2d_DAISY_getRadius_10(nativeObj);
  108. }
  109. //
  110. // C++: void cv::xfeatures2d::DAISY::setQRadius(int q_radius)
  111. //
  112. public void setQRadius(int q_radius)
  113. {
  114. ThrowIfDisposed();
  115. xfeatures2d_DAISY_setQRadius_10(nativeObj, q_radius);
  116. }
  117. //
  118. // C++: int cv::xfeatures2d::DAISY::getQRadius()
  119. //
  120. public int getQRadius()
  121. {
  122. ThrowIfDisposed();
  123. return xfeatures2d_DAISY_getQRadius_10(nativeObj);
  124. }
  125. //
  126. // C++: void cv::xfeatures2d::DAISY::setQTheta(int q_theta)
  127. //
  128. public void setQTheta(int q_theta)
  129. {
  130. ThrowIfDisposed();
  131. xfeatures2d_DAISY_setQTheta_10(nativeObj, q_theta);
  132. }
  133. //
  134. // C++: int cv::xfeatures2d::DAISY::getQTheta()
  135. //
  136. public int getQTheta()
  137. {
  138. ThrowIfDisposed();
  139. return xfeatures2d_DAISY_getQTheta_10(nativeObj);
  140. }
  141. //
  142. // C++: void cv::xfeatures2d::DAISY::setQHist(int q_hist)
  143. //
  144. public void setQHist(int q_hist)
  145. {
  146. ThrowIfDisposed();
  147. xfeatures2d_DAISY_setQHist_10(nativeObj, q_hist);
  148. }
  149. //
  150. // C++: int cv::xfeatures2d::DAISY::getQHist()
  151. //
  152. public int getQHist()
  153. {
  154. ThrowIfDisposed();
  155. return xfeatures2d_DAISY_getQHist_10(nativeObj);
  156. }
  157. //
  158. // C++: void cv::xfeatures2d::DAISY::setNorm(int norm)
  159. //
  160. public void setNorm(int norm)
  161. {
  162. ThrowIfDisposed();
  163. xfeatures2d_DAISY_setNorm_10(nativeObj, norm);
  164. }
  165. //
  166. // C++: int cv::xfeatures2d::DAISY::getNorm()
  167. //
  168. public int getNorm()
  169. {
  170. ThrowIfDisposed();
  171. return xfeatures2d_DAISY_getNorm_10(nativeObj);
  172. }
  173. //
  174. // C++: void cv::xfeatures2d::DAISY::setH(Mat H)
  175. //
  176. public void setH(Mat H)
  177. {
  178. ThrowIfDisposed();
  179. if (H != null) H.ThrowIfDisposed();
  180. xfeatures2d_DAISY_setH_10(nativeObj, H.nativeObj);
  181. }
  182. //
  183. // C++: Mat cv::xfeatures2d::DAISY::getH()
  184. //
  185. public Mat getH()
  186. {
  187. ThrowIfDisposed();
  188. return new Mat(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_getH_10(nativeObj)));
  189. }
  190. //
  191. // C++: void cv::xfeatures2d::DAISY::setInterpolation(bool interpolation)
  192. //
  193. public void setInterpolation(bool interpolation)
  194. {
  195. ThrowIfDisposed();
  196. xfeatures2d_DAISY_setInterpolation_10(nativeObj, interpolation);
  197. }
  198. //
  199. // C++: bool cv::xfeatures2d::DAISY::getInterpolation()
  200. //
  201. public bool getInterpolation()
  202. {
  203. ThrowIfDisposed();
  204. return xfeatures2d_DAISY_getInterpolation_10(nativeObj);
  205. }
  206. //
  207. // C++: void cv::xfeatures2d::DAISY::setUseOrientation(bool use_orientation)
  208. //
  209. public void setUseOrientation(bool use_orientation)
  210. {
  211. ThrowIfDisposed();
  212. xfeatures2d_DAISY_setUseOrientation_10(nativeObj, use_orientation);
  213. }
  214. //
  215. // C++: bool cv::xfeatures2d::DAISY::getUseOrientation()
  216. //
  217. public bool getUseOrientation()
  218. {
  219. ThrowIfDisposed();
  220. return xfeatures2d_DAISY_getUseOrientation_10(nativeObj);
  221. }
  222. //
  223. // C++: String cv::xfeatures2d::DAISY::getDefaultName()
  224. //
  225. public override string getDefaultName()
  226. {
  227. ThrowIfDisposed();
  228. string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_DAISY_getDefaultName_10(nativeObj)));
  229. return retVal;
  230. }
  231. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  232. const string LIBNAME = "__Internal";
  233. #else
  234. const string LIBNAME = "opencvforunity";
  235. #endif
  236. // C++: static Ptr_DAISY cv::xfeatures2d::DAISY::create(float radius = 15, int q_radius = 3, int q_theta = 8, int q_hist = 8, DAISY_NormalizationType norm = DAISY::NRM_NONE, Mat H = Mat(), bool interpolation = true, bool use_orientation = false)
  237. [DllImport(LIBNAME)]
  238. private static extern IntPtr xfeatures2d_DAISY_create_10(float radius, int q_radius, int q_theta, int q_hist, IntPtr H_nativeObj, [MarshalAs(UnmanagedType.U1)] bool interpolation, [MarshalAs(UnmanagedType.U1)] bool use_orientation);
  239. [DllImport(LIBNAME)]
  240. private static extern IntPtr xfeatures2d_DAISY_create_11(float radius, int q_radius, int q_theta, int q_hist, IntPtr H_nativeObj, [MarshalAs(UnmanagedType.U1)] bool interpolation);
  241. [DllImport(LIBNAME)]
  242. private static extern IntPtr xfeatures2d_DAISY_create_12(float radius, int q_radius, int q_theta, int q_hist, IntPtr H_nativeObj);
  243. [DllImport(LIBNAME)]
  244. private static extern IntPtr xfeatures2d_DAISY_create_13(float radius, int q_radius, int q_theta, int q_hist);
  245. [DllImport(LIBNAME)]
  246. private static extern IntPtr xfeatures2d_DAISY_create_15(float radius, int q_radius, int q_theta);
  247. [DllImport(LIBNAME)]
  248. private static extern IntPtr xfeatures2d_DAISY_create_16(float radius, int q_radius);
  249. [DllImport(LIBNAME)]
  250. private static extern IntPtr xfeatures2d_DAISY_create_17(float radius);
  251. [DllImport(LIBNAME)]
  252. private static extern IntPtr xfeatures2d_DAISY_create_18();
  253. // C++: void cv::xfeatures2d::DAISY::setRadius(float radius)
  254. [DllImport(LIBNAME)]
  255. private static extern void xfeatures2d_DAISY_setRadius_10(IntPtr nativeObj, float radius);
  256. // C++: float cv::xfeatures2d::DAISY::getRadius()
  257. [DllImport(LIBNAME)]
  258. private static extern float xfeatures2d_DAISY_getRadius_10(IntPtr nativeObj);
  259. // C++: void cv::xfeatures2d::DAISY::setQRadius(int q_radius)
  260. [DllImport(LIBNAME)]
  261. private static extern void xfeatures2d_DAISY_setQRadius_10(IntPtr nativeObj, int q_radius);
  262. // C++: int cv::xfeatures2d::DAISY::getQRadius()
  263. [DllImport(LIBNAME)]
  264. private static extern int xfeatures2d_DAISY_getQRadius_10(IntPtr nativeObj);
  265. // C++: void cv::xfeatures2d::DAISY::setQTheta(int q_theta)
  266. [DllImport(LIBNAME)]
  267. private static extern void xfeatures2d_DAISY_setQTheta_10(IntPtr nativeObj, int q_theta);
  268. // C++: int cv::xfeatures2d::DAISY::getQTheta()
  269. [DllImport(LIBNAME)]
  270. private static extern int xfeatures2d_DAISY_getQTheta_10(IntPtr nativeObj);
  271. // C++: void cv::xfeatures2d::DAISY::setQHist(int q_hist)
  272. [DllImport(LIBNAME)]
  273. private static extern void xfeatures2d_DAISY_setQHist_10(IntPtr nativeObj, int q_hist);
  274. // C++: int cv::xfeatures2d::DAISY::getQHist()
  275. [DllImport(LIBNAME)]
  276. private static extern int xfeatures2d_DAISY_getQHist_10(IntPtr nativeObj);
  277. // C++: void cv::xfeatures2d::DAISY::setNorm(int norm)
  278. [DllImport(LIBNAME)]
  279. private static extern void xfeatures2d_DAISY_setNorm_10(IntPtr nativeObj, int norm);
  280. // C++: int cv::xfeatures2d::DAISY::getNorm()
  281. [DllImport(LIBNAME)]
  282. private static extern int xfeatures2d_DAISY_getNorm_10(IntPtr nativeObj);
  283. // C++: void cv::xfeatures2d::DAISY::setH(Mat H)
  284. [DllImport(LIBNAME)]
  285. private static extern void xfeatures2d_DAISY_setH_10(IntPtr nativeObj, IntPtr H_nativeObj);
  286. // C++: Mat cv::xfeatures2d::DAISY::getH()
  287. [DllImport(LIBNAME)]
  288. private static extern IntPtr xfeatures2d_DAISY_getH_10(IntPtr nativeObj);
  289. // C++: void cv::xfeatures2d::DAISY::setInterpolation(bool interpolation)
  290. [DllImport(LIBNAME)]
  291. private static extern void xfeatures2d_DAISY_setInterpolation_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool interpolation);
  292. // C++: bool cv::xfeatures2d::DAISY::getInterpolation()
  293. [DllImport(LIBNAME)]
  294. [return: MarshalAs(UnmanagedType.U1)]
  295. private static extern bool xfeatures2d_DAISY_getInterpolation_10(IntPtr nativeObj);
  296. // C++: void cv::xfeatures2d::DAISY::setUseOrientation(bool use_orientation)
  297. [DllImport(LIBNAME)]
  298. private static extern void xfeatures2d_DAISY_setUseOrientation_10(IntPtr nativeObj, [MarshalAs(UnmanagedType.U1)] bool use_orientation);
  299. // C++: bool cv::xfeatures2d::DAISY::getUseOrientation()
  300. [DllImport(LIBNAME)]
  301. [return: MarshalAs(UnmanagedType.U1)]
  302. private static extern bool xfeatures2d_DAISY_getUseOrientation_10(IntPtr nativeObj);
  303. // C++: String cv::xfeatures2d::DAISY::getDefaultName()
  304. [DllImport(LIBNAME)]
  305. private static extern IntPtr xfeatures2d_DAISY_getDefaultName_10(IntPtr nativeObj);
  306. // native support for java finalize()
  307. [DllImport(LIBNAME)]
  308. private static extern void xfeatures2d_DAISY_delete(IntPtr nativeObj);
  309. }
  310. }