DescriptorMatcher.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  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 DescriptorMatcher
  10. //javadoc: DescriptorMatcher
  11. public class DescriptorMatcher : Algorithm
  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_DescriptorMatcher_delete (nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal DescriptorMatcher (IntPtr addr)
  32. : base (addr)
  33. {
  34. }
  35. // internal usage only
  36. public static new DescriptorMatcher __fromPtr__ (IntPtr addr)
  37. {
  38. return new DescriptorMatcher (addr);
  39. }
  40. // C++: enum MatcherType
  41. public const int FLANNBASED = 1;
  42. public const int BRUTEFORCE = 2;
  43. public const int BRUTEFORCE_L1 = 3;
  44. public const int BRUTEFORCE_HAMMING = 4;
  45. public const int BRUTEFORCE_HAMMINGLUT = 5;
  46. public const int BRUTEFORCE_SL2 = 6;
  47. //
  48. // C++: Ptr_DescriptorMatcher cv::DescriptorMatcher::clone(bool emptyTrainData = false)
  49. //
  50. //javadoc: DescriptorMatcher::clone(emptyTrainData)
  51. public DescriptorMatcher clone (bool emptyTrainData)
  52. {
  53. ThrowIfDisposed ();
  54. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  55. DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__ (features2d_DescriptorMatcher_clone_10 (nativeObj, emptyTrainData));
  56. return retVal;
  57. #else
  58. return null;
  59. #endif
  60. }
  61. //javadoc: DescriptorMatcher::clone()
  62. public DescriptorMatcher clone ()
  63. {
  64. ThrowIfDisposed ();
  65. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  66. DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__ (features2d_DescriptorMatcher_clone_11 (nativeObj));
  67. return retVal;
  68. #else
  69. return null;
  70. #endif
  71. }
  72. //
  73. // C++: static Ptr_DescriptorMatcher cv::DescriptorMatcher::create(DescriptorMatcher_MatcherType matcherType)
  74. //
  75. //javadoc: DescriptorMatcher::create(matcherType)
  76. public static DescriptorMatcher create (int matcherType)
  77. {
  78. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  79. DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__ (features2d_DescriptorMatcher_create_10 (matcherType));
  80. return retVal;
  81. #else
  82. return null;
  83. #endif
  84. }
  85. //
  86. // C++: static Ptr_DescriptorMatcher cv::DescriptorMatcher::create(String descriptorMatcherType)
  87. //
  88. //javadoc: DescriptorMatcher::create(descriptorMatcherType)
  89. public static DescriptorMatcher create (string descriptorMatcherType)
  90. {
  91. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  92. DescriptorMatcher retVal = DescriptorMatcher.__fromPtr__ (features2d_DescriptorMatcher_create_11 (descriptorMatcherType));
  93. return retVal;
  94. #else
  95. return null;
  96. #endif
  97. }
  98. //
  99. // C++: bool cv::DescriptorMatcher::empty()
  100. //
  101. //javadoc: DescriptorMatcher::empty()
  102. public override bool empty ()
  103. {
  104. ThrowIfDisposed ();
  105. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  106. bool retVal = features2d_DescriptorMatcher_empty_10 (nativeObj);
  107. return retVal;
  108. #else
  109. return false;
  110. #endif
  111. }
  112. //
  113. // C++: bool cv::DescriptorMatcher::isMaskSupported()
  114. //
  115. //javadoc: DescriptorMatcher::isMaskSupported()
  116. public bool isMaskSupported ()
  117. {
  118. ThrowIfDisposed ();
  119. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  120. bool retVal = features2d_DescriptorMatcher_isMaskSupported_10 (nativeObj);
  121. return retVal;
  122. #else
  123. return false;
  124. #endif
  125. }
  126. //
  127. // C++: vector_Mat cv::DescriptorMatcher::getTrainDescriptors()
  128. //
  129. //javadoc: DescriptorMatcher::getTrainDescriptors()
  130. public List<Mat> getTrainDescriptors ()
  131. {
  132. ThrowIfDisposed ();
  133. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  134. List<Mat> retVal = new List<Mat> ();
  135. Mat retValMat = new Mat (features2d_DescriptorMatcher_getTrainDescriptors_10 (nativeObj));
  136. Converters.Mat_to_vector_Mat (retValMat, retVal);
  137. return retVal;
  138. #else
  139. return null;
  140. #endif
  141. }
  142. //
  143. // C++: void cv::DescriptorMatcher::add(vector_Mat descriptors)
  144. //
  145. //javadoc: DescriptorMatcher::add(descriptors)
  146. public void add (List<Mat> descriptors)
  147. {
  148. ThrowIfDisposed ();
  149. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  150. Mat descriptors_mat = Converters.vector_Mat_to_Mat (descriptors);
  151. features2d_DescriptorMatcher_add_10 (nativeObj, descriptors_mat.nativeObj);
  152. return;
  153. #else
  154. return;
  155. #endif
  156. }
  157. //
  158. // C++: void cv::DescriptorMatcher::clear()
  159. //
  160. //javadoc: DescriptorMatcher::clear()
  161. public override void clear ()
  162. {
  163. ThrowIfDisposed ();
  164. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  165. features2d_DescriptorMatcher_clear_10 (nativeObj);
  166. return;
  167. #else
  168. return;
  169. #endif
  170. }
  171. //
  172. // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, int k, Mat mask = Mat(), bool compactResult = false)
  173. //
  174. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, trainDescriptors, matches, k, mask, compactResult)
  175. public void knnMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, int k, Mat mask, bool compactResult)
  176. {
  177. ThrowIfDisposed ();
  178. if (queryDescriptors != null)
  179. queryDescriptors.ThrowIfDisposed ();
  180. if (trainDescriptors != null)
  181. trainDescriptors.ThrowIfDisposed ();
  182. if (mask != null)
  183. mask.ThrowIfDisposed ();
  184. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  185. Mat matches_mat = new Mat ();
  186. features2d_DescriptorMatcher_knnMatch_10 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k, mask.nativeObj, compactResult);
  187. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  188. matches_mat.release ();
  189. return;
  190. #else
  191. return;
  192. #endif
  193. }
  194. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, trainDescriptors, matches, k, mask)
  195. public void knnMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, int k, Mat mask)
  196. {
  197. ThrowIfDisposed ();
  198. if (queryDescriptors != null)
  199. queryDescriptors.ThrowIfDisposed ();
  200. if (trainDescriptors != null)
  201. trainDescriptors.ThrowIfDisposed ();
  202. if (mask != null)
  203. mask.ThrowIfDisposed ();
  204. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  205. Mat matches_mat = new Mat ();
  206. features2d_DescriptorMatcher_knnMatch_11 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k, mask.nativeObj);
  207. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  208. matches_mat.release ();
  209. return;
  210. #else
  211. return;
  212. #endif
  213. }
  214. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, trainDescriptors, matches, k)
  215. public void knnMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, int k)
  216. {
  217. ThrowIfDisposed ();
  218. if (queryDescriptors != null)
  219. queryDescriptors.ThrowIfDisposed ();
  220. if (trainDescriptors != null)
  221. trainDescriptors.ThrowIfDisposed ();
  222. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  223. Mat matches_mat = new Mat ();
  224. features2d_DescriptorMatcher_knnMatch_12 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, k);
  225. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  226. matches_mat.release ();
  227. return;
  228. #else
  229. return;
  230. #endif
  231. }
  232. //
  233. // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, vector_vector_DMatch& matches, int k, vector_Mat masks = vector_Mat(), bool compactResult = false)
  234. //
  235. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, matches, k, masks, compactResult)
  236. public void knnMatch (Mat queryDescriptors, List<MatOfDMatch> matches, int k, List<Mat> masks, bool compactResult)
  237. {
  238. ThrowIfDisposed ();
  239. if (queryDescriptors != null)
  240. queryDescriptors.ThrowIfDisposed ();
  241. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  242. Mat matches_mat = new Mat ();
  243. Mat masks_mat = Converters.vector_Mat_to_Mat (masks);
  244. features2d_DescriptorMatcher_knnMatch_13 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k, masks_mat.nativeObj, compactResult);
  245. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  246. matches_mat.release ();
  247. return;
  248. #else
  249. return;
  250. #endif
  251. }
  252. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, matches, k, masks)
  253. public void knnMatch (Mat queryDescriptors, List<MatOfDMatch> matches, int k, List<Mat> masks)
  254. {
  255. ThrowIfDisposed ();
  256. if (queryDescriptors != null)
  257. queryDescriptors.ThrowIfDisposed ();
  258. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  259. Mat matches_mat = new Mat ();
  260. Mat masks_mat = Converters.vector_Mat_to_Mat (masks);
  261. features2d_DescriptorMatcher_knnMatch_14 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k, masks_mat.nativeObj);
  262. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  263. matches_mat.release ();
  264. return;
  265. #else
  266. return;
  267. #endif
  268. }
  269. //javadoc: DescriptorMatcher::knnMatch(queryDescriptors, matches, k)
  270. public void knnMatch (Mat queryDescriptors, List<MatOfDMatch> matches, int k)
  271. {
  272. ThrowIfDisposed ();
  273. if (queryDescriptors != null)
  274. queryDescriptors.ThrowIfDisposed ();
  275. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  276. Mat matches_mat = new Mat ();
  277. features2d_DescriptorMatcher_knnMatch_15 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, k);
  278. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  279. matches_mat.release ();
  280. return;
  281. #else
  282. return;
  283. #endif
  284. }
  285. //
  286. // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
  287. //
  288. //javadoc: DescriptorMatcher::match(queryDescriptors, trainDescriptors, matches, mask)
  289. public void match (Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches, Mat mask)
  290. {
  291. ThrowIfDisposed ();
  292. if (queryDescriptors != null)
  293. queryDescriptors.ThrowIfDisposed ();
  294. if (trainDescriptors != null)
  295. trainDescriptors.ThrowIfDisposed ();
  296. if (matches != null)
  297. matches.ThrowIfDisposed ();
  298. if (mask != null)
  299. mask.ThrowIfDisposed ();
  300. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  301. Mat matches_mat = matches;
  302. features2d_DescriptorMatcher_match_10 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, mask.nativeObj);
  303. return;
  304. #else
  305. return;
  306. #endif
  307. }
  308. //javadoc: DescriptorMatcher::match(queryDescriptors, trainDescriptors, matches)
  309. public void match (Mat queryDescriptors, Mat trainDescriptors, MatOfDMatch matches)
  310. {
  311. ThrowIfDisposed ();
  312. if (queryDescriptors != null)
  313. queryDescriptors.ThrowIfDisposed ();
  314. if (trainDescriptors != null)
  315. trainDescriptors.ThrowIfDisposed ();
  316. if (matches != null)
  317. matches.ThrowIfDisposed ();
  318. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  319. Mat matches_mat = matches;
  320. features2d_DescriptorMatcher_match_11 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj);
  321. return;
  322. #else
  323. return;
  324. #endif
  325. }
  326. //
  327. // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
  328. //
  329. //javadoc: DescriptorMatcher::match(queryDescriptors, matches, masks)
  330. public void match (Mat queryDescriptors, MatOfDMatch matches, List<Mat> masks)
  331. {
  332. ThrowIfDisposed ();
  333. if (queryDescriptors != null)
  334. queryDescriptors.ThrowIfDisposed ();
  335. if (matches != null)
  336. matches.ThrowIfDisposed ();
  337. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  338. Mat matches_mat = matches;
  339. Mat masks_mat = Converters.vector_Mat_to_Mat (masks);
  340. features2d_DescriptorMatcher_match_12 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, masks_mat.nativeObj);
  341. return;
  342. #else
  343. return;
  344. #endif
  345. }
  346. //javadoc: DescriptorMatcher::match(queryDescriptors, matches)
  347. public void match (Mat queryDescriptors, MatOfDMatch matches)
  348. {
  349. ThrowIfDisposed ();
  350. if (queryDescriptors != null)
  351. queryDescriptors.ThrowIfDisposed ();
  352. if (matches != null)
  353. matches.ThrowIfDisposed ();
  354. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  355. Mat matches_mat = matches;
  356. features2d_DescriptorMatcher_match_13 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj);
  357. return;
  358. #else
  359. return;
  360. #endif
  361. }
  362. //
  363. // C++: void cv::DescriptorMatcher::radiusMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, float maxDistance, Mat mask = Mat(), bool compactResult = false)
  364. //
  365. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance, mask, compactResult)
  366. public void radiusMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, float maxDistance, Mat mask, bool compactResult)
  367. {
  368. ThrowIfDisposed ();
  369. if (queryDescriptors != null)
  370. queryDescriptors.ThrowIfDisposed ();
  371. if (trainDescriptors != null)
  372. trainDescriptors.ThrowIfDisposed ();
  373. if (mask != null)
  374. mask.ThrowIfDisposed ();
  375. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  376. Mat matches_mat = new Mat ();
  377. features2d_DescriptorMatcher_radiusMatch_10 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, mask.nativeObj, compactResult);
  378. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  379. matches_mat.release ();
  380. return;
  381. #else
  382. return;
  383. #endif
  384. }
  385. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance, mask)
  386. public void radiusMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, float maxDistance, Mat mask)
  387. {
  388. ThrowIfDisposed ();
  389. if (queryDescriptors != null)
  390. queryDescriptors.ThrowIfDisposed ();
  391. if (trainDescriptors != null)
  392. trainDescriptors.ThrowIfDisposed ();
  393. if (mask != null)
  394. mask.ThrowIfDisposed ();
  395. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  396. Mat matches_mat = new Mat ();
  397. features2d_DescriptorMatcher_radiusMatch_11 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, mask.nativeObj);
  398. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  399. matches_mat.release ();
  400. return;
  401. #else
  402. return;
  403. #endif
  404. }
  405. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, trainDescriptors, matches, maxDistance)
  406. public void radiusMatch (Mat queryDescriptors, Mat trainDescriptors, List<MatOfDMatch> matches, float maxDistance)
  407. {
  408. ThrowIfDisposed ();
  409. if (queryDescriptors != null)
  410. queryDescriptors.ThrowIfDisposed ();
  411. if (trainDescriptors != null)
  412. trainDescriptors.ThrowIfDisposed ();
  413. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  414. Mat matches_mat = new Mat ();
  415. features2d_DescriptorMatcher_radiusMatch_12 (nativeObj, queryDescriptors.nativeObj, trainDescriptors.nativeObj, matches_mat.nativeObj, maxDistance);
  416. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  417. matches_mat.release ();
  418. return;
  419. #else
  420. return;
  421. #endif
  422. }
  423. //
  424. // C++: void cv::DescriptorMatcher::radiusMatch(Mat queryDescriptors, vector_vector_DMatch& matches, float maxDistance, vector_Mat masks = vector_Mat(), bool compactResult = false)
  425. //
  426. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, matches, maxDistance, masks, compactResult)
  427. public void radiusMatch (Mat queryDescriptors, List<MatOfDMatch> matches, float maxDistance, List<Mat> masks, bool compactResult)
  428. {
  429. ThrowIfDisposed ();
  430. if (queryDescriptors != null)
  431. queryDescriptors.ThrowIfDisposed ();
  432. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  433. Mat matches_mat = new Mat ();
  434. Mat masks_mat = Converters.vector_Mat_to_Mat (masks);
  435. features2d_DescriptorMatcher_radiusMatch_13 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, masks_mat.nativeObj, compactResult);
  436. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  437. matches_mat.release ();
  438. return;
  439. #else
  440. return;
  441. #endif
  442. }
  443. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, matches, maxDistance, masks)
  444. public void radiusMatch (Mat queryDescriptors, List<MatOfDMatch> matches, float maxDistance, List<Mat> masks)
  445. {
  446. ThrowIfDisposed ();
  447. if (queryDescriptors != null)
  448. queryDescriptors.ThrowIfDisposed ();
  449. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  450. Mat matches_mat = new Mat ();
  451. Mat masks_mat = Converters.vector_Mat_to_Mat (masks);
  452. features2d_DescriptorMatcher_radiusMatch_14 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, maxDistance, masks_mat.nativeObj);
  453. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  454. matches_mat.release ();
  455. return;
  456. #else
  457. return;
  458. #endif
  459. }
  460. //javadoc: DescriptorMatcher::radiusMatch(queryDescriptors, matches, maxDistance)
  461. public void radiusMatch (Mat queryDescriptors, List<MatOfDMatch> matches, float maxDistance)
  462. {
  463. ThrowIfDisposed ();
  464. if (queryDescriptors != null)
  465. queryDescriptors.ThrowIfDisposed ();
  466. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  467. Mat matches_mat = new Mat ();
  468. features2d_DescriptorMatcher_radiusMatch_15 (nativeObj, queryDescriptors.nativeObj, matches_mat.nativeObj, maxDistance);
  469. Converters.Mat_to_vector_vector_DMatch (matches_mat, matches);
  470. matches_mat.release ();
  471. return;
  472. #else
  473. return;
  474. #endif
  475. }
  476. //
  477. // C++: void cv::DescriptorMatcher::read(FileNode arg1)
  478. //
  479. // Unknown type 'FileNode' (I), skipping the function
  480. //
  481. // C++: void cv::DescriptorMatcher::read(String fileName)
  482. //
  483. //javadoc: DescriptorMatcher::read(fileName)
  484. public void read (string fileName)
  485. {
  486. ThrowIfDisposed ();
  487. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  488. features2d_DescriptorMatcher_read_10 (nativeObj, fileName);
  489. return;
  490. #else
  491. return;
  492. #endif
  493. }
  494. //
  495. // C++: void cv::DescriptorMatcher::train()
  496. //
  497. //javadoc: DescriptorMatcher::train()
  498. public void train ()
  499. {
  500. ThrowIfDisposed ();
  501. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  502. features2d_DescriptorMatcher_train_10 (nativeObj);
  503. return;
  504. #else
  505. return;
  506. #endif
  507. }
  508. //
  509. // C++: void cv::DescriptorMatcher::write(Ptr_FileStorage fs, String name = String())
  510. //
  511. // Unknown type 'Ptr_FileStorage' (I), skipping the function
  512. //
  513. // C++: void cv::DescriptorMatcher::write(String fileName)
  514. //
  515. //javadoc: DescriptorMatcher::write(fileName)
  516. public void write (string fileName)
  517. {
  518. ThrowIfDisposed ();
  519. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  520. features2d_DescriptorMatcher_write_10 (nativeObj, fileName);
  521. return;
  522. #else
  523. return;
  524. #endif
  525. }
  526. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  527. const string LIBNAME = "__Internal";
  528. #else
  529. const string LIBNAME = "opencvforunity";
  530. #endif
  531. // C++: Ptr_DescriptorMatcher cv::DescriptorMatcher::clone(bool emptyTrainData = false)
  532. [DllImport (LIBNAME)]
  533. private static extern IntPtr features2d_DescriptorMatcher_clone_10 (IntPtr nativeObj, bool emptyTrainData);
  534. [DllImport (LIBNAME)]
  535. private static extern IntPtr features2d_DescriptorMatcher_clone_11 (IntPtr nativeObj);
  536. // C++: static Ptr_DescriptorMatcher cv::DescriptorMatcher::create(DescriptorMatcher_MatcherType matcherType)
  537. [DllImport (LIBNAME)]
  538. private static extern IntPtr features2d_DescriptorMatcher_create_10 (int matcherType);
  539. // C++: static Ptr_DescriptorMatcher cv::DescriptorMatcher::create(String descriptorMatcherType)
  540. [DllImport (LIBNAME)]
  541. private static extern IntPtr features2d_DescriptorMatcher_create_11 (string descriptorMatcherType);
  542. // C++: bool cv::DescriptorMatcher::empty()
  543. [DllImport (LIBNAME)]
  544. private static extern bool features2d_DescriptorMatcher_empty_10 (IntPtr nativeObj);
  545. // C++: bool cv::DescriptorMatcher::isMaskSupported()
  546. [DllImport (LIBNAME)]
  547. private static extern bool features2d_DescriptorMatcher_isMaskSupported_10 (IntPtr nativeObj);
  548. // C++: vector_Mat cv::DescriptorMatcher::getTrainDescriptors()
  549. [DllImport (LIBNAME)]
  550. private static extern IntPtr features2d_DescriptorMatcher_getTrainDescriptors_10 (IntPtr nativeObj);
  551. // C++: void cv::DescriptorMatcher::add(vector_Mat descriptors)
  552. [DllImport (LIBNAME)]
  553. private static extern void features2d_DescriptorMatcher_add_10 (IntPtr nativeObj, IntPtr descriptors_mat_nativeObj);
  554. // C++: void cv::DescriptorMatcher::clear()
  555. [DllImport (LIBNAME)]
  556. private static extern void features2d_DescriptorMatcher_clear_10 (IntPtr nativeObj);
  557. // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, int k, Mat mask = Mat(), bool compactResult = false)
  558. [DllImport (LIBNAME)]
  559. private static extern void features2d_DescriptorMatcher_knnMatch_10 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k, IntPtr mask_nativeObj, bool compactResult);
  560. [DllImport (LIBNAME)]
  561. private static extern void features2d_DescriptorMatcher_knnMatch_11 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k, IntPtr mask_nativeObj);
  562. [DllImport (LIBNAME)]
  563. private static extern void features2d_DescriptorMatcher_knnMatch_12 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k);
  564. // C++: void cv::DescriptorMatcher::knnMatch(Mat queryDescriptors, vector_vector_DMatch& matches, int k, vector_Mat masks = vector_Mat(), bool compactResult = false)
  565. [DllImport (LIBNAME)]
  566. private static extern void features2d_DescriptorMatcher_knnMatch_13 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k, IntPtr masks_mat_nativeObj, bool compactResult);
  567. [DllImport (LIBNAME)]
  568. private static extern void features2d_DescriptorMatcher_knnMatch_14 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k, IntPtr masks_mat_nativeObj);
  569. [DllImport (LIBNAME)]
  570. private static extern void features2d_DescriptorMatcher_knnMatch_15 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, int k);
  571. // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, Mat trainDescriptors, vector_DMatch& matches, Mat mask = Mat())
  572. [DllImport (LIBNAME)]
  573. private static extern void features2d_DescriptorMatcher_match_10 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, IntPtr mask_nativeObj);
  574. [DllImport (LIBNAME)]
  575. private static extern void features2d_DescriptorMatcher_match_11 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj);
  576. // C++: void cv::DescriptorMatcher::match(Mat queryDescriptors, vector_DMatch& matches, vector_Mat masks = vector_Mat())
  577. [DllImport (LIBNAME)]
  578. private static extern void features2d_DescriptorMatcher_match_12 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, IntPtr masks_mat_nativeObj);
  579. [DllImport (LIBNAME)]
  580. private static extern void features2d_DescriptorMatcher_match_13 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj);
  581. // C++: void cv::DescriptorMatcher::radiusMatch(Mat queryDescriptors, Mat trainDescriptors, vector_vector_DMatch& matches, float maxDistance, Mat mask = Mat(), bool compactResult = false)
  582. [DllImport (LIBNAME)]
  583. private static extern void features2d_DescriptorMatcher_radiusMatch_10 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance, IntPtr mask_nativeObj, bool compactResult);
  584. [DllImport (LIBNAME)]
  585. private static extern void features2d_DescriptorMatcher_radiusMatch_11 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance, IntPtr mask_nativeObj);
  586. [DllImport (LIBNAME)]
  587. private static extern void features2d_DescriptorMatcher_radiusMatch_12 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr trainDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance);
  588. // C++: void cv::DescriptorMatcher::radiusMatch(Mat queryDescriptors, vector_vector_DMatch& matches, float maxDistance, vector_Mat masks = vector_Mat(), bool compactResult = false)
  589. [DllImport (LIBNAME)]
  590. private static extern void features2d_DescriptorMatcher_radiusMatch_13 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance, IntPtr masks_mat_nativeObj, bool compactResult);
  591. [DllImport (LIBNAME)]
  592. private static extern void features2d_DescriptorMatcher_radiusMatch_14 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance, IntPtr masks_mat_nativeObj);
  593. [DllImport (LIBNAME)]
  594. private static extern void features2d_DescriptorMatcher_radiusMatch_15 (IntPtr nativeObj, IntPtr queryDescriptors_nativeObj, IntPtr matches_mat_nativeObj, float maxDistance);
  595. // C++: void cv::DescriptorMatcher::read(String fileName)
  596. [DllImport (LIBNAME)]
  597. private static extern void features2d_DescriptorMatcher_read_10 (IntPtr nativeObj, string fileName);
  598. // C++: void cv::DescriptorMatcher::train()
  599. [DllImport (LIBNAME)]
  600. private static extern void features2d_DescriptorMatcher_train_10 (IntPtr nativeObj);
  601. // C++: void cv::DescriptorMatcher::write(String fileName)
  602. [DllImport (LIBNAME)]
  603. private static extern void features2d_DescriptorMatcher_write_10 (IntPtr nativeObj, string fileName);
  604. // native support for java finalize()
  605. [DllImport (LIBNAME)]
  606. private static extern void features2d_DescriptorMatcher_delete (IntPtr nativeObj);
  607. }
  608. }