BRISK.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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 BRISK
  9. /**
  10. * Class implementing the BRISK keypoint detector and descriptor extractor, described in CITE: LCS11 .
  11. */
  12. public class BRISK : 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_BRISK_delete(nativeObj);
  25. nativeObj = IntPtr.Zero;
  26. }
  27. }
  28. finally
  29. {
  30. base.Dispose(disposing);
  31. }
  32. }
  33. protected internal BRISK(IntPtr addr) : base(addr) { }
  34. // internal usage only
  35. public static new BRISK __fromPtr__(IntPtr addr) { return new BRISK(addr); }
  36. //
  37. // C++: static Ptr_BRISK cv::BRISK::create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
  38. //
  39. /**
  40. * The BRISK constructor
  41. *
  42. * param thresh AGAST detection threshold score.
  43. * param octaves detection octaves. Use 0 to do single scale.
  44. * param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
  45. * keypoint.
  46. * return automatically generated
  47. */
  48. public static BRISK create(int thresh, int octaves, float patternScale)
  49. {
  50. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_10(thresh, octaves, patternScale)));
  51. }
  52. /**
  53. * The BRISK constructor
  54. *
  55. * param thresh AGAST detection threshold score.
  56. * param octaves detection octaves. Use 0 to do single scale.
  57. * keypoint.
  58. * return automatically generated
  59. */
  60. public static BRISK create(int thresh, int octaves)
  61. {
  62. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_11(thresh, octaves)));
  63. }
  64. /**
  65. * The BRISK constructor
  66. *
  67. * param thresh AGAST detection threshold score.
  68. * keypoint.
  69. * return automatically generated
  70. */
  71. public static BRISK create(int thresh)
  72. {
  73. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_12(thresh)));
  74. }
  75. /**
  76. * The BRISK constructor
  77. *
  78. * keypoint.
  79. * return automatically generated
  80. */
  81. public static BRISK create()
  82. {
  83. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_13()));
  84. }
  85. //
  86. // C++: static Ptr_BRISK cv::BRISK::create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
  87. //
  88. /**
  89. * The BRISK constructor for a custom pattern
  90. *
  91. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  92. * keypoint scale 1).
  93. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  94. * size as radiusList..
  95. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  96. * scale 1).
  97. * param dMin threshold for the long pairings used for orientation determination (in pixels for
  98. * keypoint scale 1).
  99. * param indexChange index remapping of the bits.
  100. * return automatically generated
  101. */
  102. public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin, MatOfInt indexChange)
  103. {
  104. if (radiusList != null) radiusList.ThrowIfDisposed();
  105. if (numberList != null) numberList.ThrowIfDisposed();
  106. if (indexChange != null) indexChange.ThrowIfDisposed();
  107. Mat radiusList_mat = radiusList;
  108. Mat numberList_mat = numberList;
  109. Mat indexChange_mat = indexChange;
  110. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_14(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj)));
  111. }
  112. /**
  113. * The BRISK constructor for a custom pattern
  114. *
  115. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  116. * keypoint scale 1).
  117. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  118. * size as radiusList..
  119. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  120. * scale 1).
  121. * param dMin threshold for the long pairings used for orientation determination (in pixels for
  122. * keypoint scale 1).
  123. * return automatically generated
  124. */
  125. public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin)
  126. {
  127. if (radiusList != null) radiusList.ThrowIfDisposed();
  128. if (numberList != null) numberList.ThrowIfDisposed();
  129. Mat radiusList_mat = radiusList;
  130. Mat numberList_mat = numberList;
  131. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_15(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin)));
  132. }
  133. /**
  134. * The BRISK constructor for a custom pattern
  135. *
  136. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  137. * keypoint scale 1).
  138. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  139. * size as radiusList..
  140. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  141. * scale 1).
  142. * keypoint scale 1).
  143. * return automatically generated
  144. */
  145. public static BRISK create(MatOfFloat radiusList, MatOfInt numberList, float dMax)
  146. {
  147. if (radiusList != null) radiusList.ThrowIfDisposed();
  148. if (numberList != null) numberList.ThrowIfDisposed();
  149. Mat radiusList_mat = radiusList;
  150. Mat numberList_mat = numberList;
  151. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_16(radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax)));
  152. }
  153. /**
  154. * The BRISK constructor for a custom pattern
  155. *
  156. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  157. * keypoint scale 1).
  158. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  159. * size as radiusList..
  160. * scale 1).
  161. * keypoint scale 1).
  162. * return automatically generated
  163. */
  164. public static BRISK create(MatOfFloat radiusList, MatOfInt numberList)
  165. {
  166. if (radiusList != null) radiusList.ThrowIfDisposed();
  167. if (numberList != null) numberList.ThrowIfDisposed();
  168. Mat radiusList_mat = radiusList;
  169. Mat numberList_mat = numberList;
  170. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_17(radiusList_mat.nativeObj, numberList_mat.nativeObj)));
  171. }
  172. //
  173. // C++: static Ptr_BRISK cv::BRISK::create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
  174. //
  175. /**
  176. * The BRISK constructor for a custom pattern, detection threshold and octaves
  177. *
  178. * param thresh AGAST detection threshold score.
  179. * param octaves detection octaves. Use 0 to do single scale.
  180. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  181. * keypoint scale 1).
  182. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  183. * size as radiusList..
  184. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  185. * scale 1).
  186. * param dMin threshold for the long pairings used for orientation determination (in pixels for
  187. * keypoint scale 1).
  188. * param indexChange index remapping of the bits.
  189. * return automatically generated
  190. */
  191. public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin, MatOfInt indexChange)
  192. {
  193. if (radiusList != null) radiusList.ThrowIfDisposed();
  194. if (numberList != null) numberList.ThrowIfDisposed();
  195. if (indexChange != null) indexChange.ThrowIfDisposed();
  196. Mat radiusList_mat = radiusList;
  197. Mat numberList_mat = numberList;
  198. Mat indexChange_mat = indexChange;
  199. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_18(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin, indexChange_mat.nativeObj)));
  200. }
  201. /**
  202. * The BRISK constructor for a custom pattern, detection threshold and octaves
  203. *
  204. * param thresh AGAST detection threshold score.
  205. * param octaves detection octaves. Use 0 to do single scale.
  206. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  207. * keypoint scale 1).
  208. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  209. * size as radiusList..
  210. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  211. * scale 1).
  212. * param dMin threshold for the long pairings used for orientation determination (in pixels for
  213. * keypoint scale 1).
  214. * return automatically generated
  215. */
  216. public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax, float dMin)
  217. {
  218. if (radiusList != null) radiusList.ThrowIfDisposed();
  219. if (numberList != null) numberList.ThrowIfDisposed();
  220. Mat radiusList_mat = radiusList;
  221. Mat numberList_mat = numberList;
  222. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_19(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax, dMin)));
  223. }
  224. /**
  225. * The BRISK constructor for a custom pattern, detection threshold and octaves
  226. *
  227. * param thresh AGAST detection threshold score.
  228. * param octaves detection octaves. Use 0 to do single scale.
  229. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  230. * keypoint scale 1).
  231. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  232. * size as radiusList..
  233. * param dMax threshold for the short pairings used for descriptor formation (in pixels for keypoint
  234. * scale 1).
  235. * keypoint scale 1).
  236. * return automatically generated
  237. */
  238. public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList, float dMax)
  239. {
  240. if (radiusList != null) radiusList.ThrowIfDisposed();
  241. if (numberList != null) numberList.ThrowIfDisposed();
  242. Mat radiusList_mat = radiusList;
  243. Mat numberList_mat = numberList;
  244. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_110(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj, dMax)));
  245. }
  246. /**
  247. * The BRISK constructor for a custom pattern, detection threshold and octaves
  248. *
  249. * param thresh AGAST detection threshold score.
  250. * param octaves detection octaves. Use 0 to do single scale.
  251. * param radiusList defines the radii (in pixels) where the samples around a keypoint are taken (for
  252. * keypoint scale 1).
  253. * param numberList defines the number of sampling points on the sampling circle. Must be the same
  254. * size as radiusList..
  255. * scale 1).
  256. * keypoint scale 1).
  257. * return automatically generated
  258. */
  259. public static BRISK create(int thresh, int octaves, MatOfFloat radiusList, MatOfInt numberList)
  260. {
  261. if (radiusList != null) radiusList.ThrowIfDisposed();
  262. if (numberList != null) numberList.ThrowIfDisposed();
  263. Mat radiusList_mat = radiusList;
  264. Mat numberList_mat = numberList;
  265. return BRISK.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_create_111(thresh, octaves, radiusList_mat.nativeObj, numberList_mat.nativeObj)));
  266. }
  267. //
  268. // C++: String cv::BRISK::getDefaultName()
  269. //
  270. public override string getDefaultName()
  271. {
  272. ThrowIfDisposed();
  273. string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(features2d_BRISK_getDefaultName_10(nativeObj)));
  274. return retVal;
  275. }
  276. //
  277. // C++: void cv::BRISK::setThreshold(int threshold)
  278. //
  279. /**
  280. * Set detection threshold.
  281. * param threshold AGAST detection threshold score.
  282. */
  283. public void setThreshold(int threshold)
  284. {
  285. ThrowIfDisposed();
  286. features2d_BRISK_setThreshold_10(nativeObj, threshold);
  287. }
  288. //
  289. // C++: int cv::BRISK::getThreshold()
  290. //
  291. public int getThreshold()
  292. {
  293. ThrowIfDisposed();
  294. return features2d_BRISK_getThreshold_10(nativeObj);
  295. }
  296. //
  297. // C++: void cv::BRISK::setOctaves(int octaves)
  298. //
  299. /**
  300. * Set detection octaves.
  301. * param octaves detection octaves. Use 0 to do single scale.
  302. */
  303. public void setOctaves(int octaves)
  304. {
  305. ThrowIfDisposed();
  306. features2d_BRISK_setOctaves_10(nativeObj, octaves);
  307. }
  308. //
  309. // C++: int cv::BRISK::getOctaves()
  310. //
  311. public int getOctaves()
  312. {
  313. ThrowIfDisposed();
  314. return features2d_BRISK_getOctaves_10(nativeObj);
  315. }
  316. //
  317. // C++: void cv::BRISK::setPatternScale(float patternScale)
  318. //
  319. /**
  320. * Set detection patternScale.
  321. * param patternScale apply this scale to the pattern used for sampling the neighbourhood of a
  322. * keypoint.
  323. */
  324. public void setPatternScale(float patternScale)
  325. {
  326. ThrowIfDisposed();
  327. features2d_BRISK_setPatternScale_10(nativeObj, patternScale);
  328. }
  329. //
  330. // C++: float cv::BRISK::getPatternScale()
  331. //
  332. public float getPatternScale()
  333. {
  334. ThrowIfDisposed();
  335. return features2d_BRISK_getPatternScale_10(nativeObj);
  336. }
  337. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  338. const string LIBNAME = "__Internal";
  339. #else
  340. const string LIBNAME = "opencvforunity";
  341. #endif
  342. // C++: static Ptr_BRISK cv::BRISK::create(int thresh = 30, int octaves = 3, float patternScale = 1.0f)
  343. [DllImport(LIBNAME)]
  344. private static extern IntPtr features2d_BRISK_create_10(int thresh, int octaves, float patternScale);
  345. [DllImport(LIBNAME)]
  346. private static extern IntPtr features2d_BRISK_create_11(int thresh, int octaves);
  347. [DllImport(LIBNAME)]
  348. private static extern IntPtr features2d_BRISK_create_12(int thresh);
  349. [DllImport(LIBNAME)]
  350. private static extern IntPtr features2d_BRISK_create_13();
  351. // C++: static Ptr_BRISK cv::BRISK::create(vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
  352. [DllImport(LIBNAME)]
  353. private static extern IntPtr features2d_BRISK_create_14(IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax, float dMin, IntPtr indexChange_mat_nativeObj);
  354. [DllImport(LIBNAME)]
  355. private static extern IntPtr features2d_BRISK_create_15(IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax, float dMin);
  356. [DllImport(LIBNAME)]
  357. private static extern IntPtr features2d_BRISK_create_16(IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax);
  358. [DllImport(LIBNAME)]
  359. private static extern IntPtr features2d_BRISK_create_17(IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj);
  360. // C++: static Ptr_BRISK cv::BRISK::create(int thresh, int octaves, vector_float radiusList, vector_int numberList, float dMax = 5.85f, float dMin = 8.2f, vector_int indexChange = std::vector<int>())
  361. [DllImport(LIBNAME)]
  362. private static extern IntPtr features2d_BRISK_create_18(int thresh, int octaves, IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax, float dMin, IntPtr indexChange_mat_nativeObj);
  363. [DllImport(LIBNAME)]
  364. private static extern IntPtr features2d_BRISK_create_19(int thresh, int octaves, IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax, float dMin);
  365. [DllImport(LIBNAME)]
  366. private static extern IntPtr features2d_BRISK_create_110(int thresh, int octaves, IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj, float dMax);
  367. [DllImport(LIBNAME)]
  368. private static extern IntPtr features2d_BRISK_create_111(int thresh, int octaves, IntPtr radiusList_mat_nativeObj, IntPtr numberList_mat_nativeObj);
  369. // C++: String cv::BRISK::getDefaultName()
  370. [DllImport(LIBNAME)]
  371. private static extern IntPtr features2d_BRISK_getDefaultName_10(IntPtr nativeObj);
  372. // C++: void cv::BRISK::setThreshold(int threshold)
  373. [DllImport(LIBNAME)]
  374. private static extern void features2d_BRISK_setThreshold_10(IntPtr nativeObj, int threshold);
  375. // C++: int cv::BRISK::getThreshold()
  376. [DllImport(LIBNAME)]
  377. private static extern int features2d_BRISK_getThreshold_10(IntPtr nativeObj);
  378. // C++: void cv::BRISK::setOctaves(int octaves)
  379. [DllImport(LIBNAME)]
  380. private static extern void features2d_BRISK_setOctaves_10(IntPtr nativeObj, int octaves);
  381. // C++: int cv::BRISK::getOctaves()
  382. [DllImport(LIBNAME)]
  383. private static extern int features2d_BRISK_getOctaves_10(IntPtr nativeObj);
  384. // C++: void cv::BRISK::setPatternScale(float patternScale)
  385. [DllImport(LIBNAME)]
  386. private static extern void features2d_BRISK_setPatternScale_10(IntPtr nativeObj, float patternScale);
  387. // C++: float cv::BRISK::getPatternScale()
  388. [DllImport(LIBNAME)]
  389. private static extern float features2d_BRISK_getPatternScale_10(IntPtr nativeObj);
  390. // native support for java finalize()
  391. [DllImport(LIBNAME)]
  392. private static extern void features2d_BRISK_delete(IntPtr nativeObj);
  393. }
  394. }