Features2d.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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 Features2d
  9. public class Features2d
  10. {
  11. // C++: enum cv.DrawMatchesFlags
  12. public const int DrawMatchesFlags_DEFAULT = 0;
  13. public const int DrawMatchesFlags_DRAW_OVER_OUTIMG = 1;
  14. public const int DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS = 2;
  15. public const int DrawMatchesFlags_DRAW_RICH_KEYPOINTS = 4;
  16. //
  17. // C++: void cv::drawKeypoints(Mat image, vector_KeyPoint keypoints, Mat& outImage, Scalar color = Scalar::all(-1), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  18. //
  19. /**
  20. * Draws keypoints.
  21. *
  22. * param image Source image.
  23. * param keypoints Keypoints from the source image.
  24. * param outImage Output image. Its content depends on the flags value defining what is drawn in the
  25. * output image. See possible flags bit values below.
  26. * param color Color of keypoints.
  27. * param flags Flags setting drawing features. Possible flags bit values are defined by
  28. * DrawMatchesFlags. See details above in drawMatches .
  29. *
  30. * <b>Note:</b>
  31. * For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT,
  32. * cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
  33. * cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
  34. */
  35. public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage, Scalar color, int flags)
  36. {
  37. if (image != null) image.ThrowIfDisposed();
  38. if (keypoints != null) keypoints.ThrowIfDisposed();
  39. if (outImage != null) outImage.ThrowIfDisposed();
  40. Mat keypoints_mat = keypoints;
  41. features2d_Features2d_drawKeypoints_10(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3], flags);
  42. }
  43. /**
  44. * Draws keypoints.
  45. *
  46. * param image Source image.
  47. * param keypoints Keypoints from the source image.
  48. * param outImage Output image. Its content depends on the flags value defining what is drawn in the
  49. * output image. See possible flags bit values below.
  50. * param color Color of keypoints.
  51. * DrawMatchesFlags. See details above in drawMatches .
  52. *
  53. * <b>Note:</b>
  54. * For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT,
  55. * cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
  56. * cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
  57. */
  58. public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage, Scalar color)
  59. {
  60. if (image != null) image.ThrowIfDisposed();
  61. if (keypoints != null) keypoints.ThrowIfDisposed();
  62. if (outImage != null) outImage.ThrowIfDisposed();
  63. Mat keypoints_mat = keypoints;
  64. features2d_Features2d_drawKeypoints_11(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj, color.val[0], color.val[1], color.val[2], color.val[3]);
  65. }
  66. /**
  67. * Draws keypoints.
  68. *
  69. * param image Source image.
  70. * param keypoints Keypoints from the source image.
  71. * param outImage Output image. Its content depends on the flags value defining what is drawn in the
  72. * output image. See possible flags bit values below.
  73. * DrawMatchesFlags. See details above in drawMatches .
  74. *
  75. * <b>Note:</b>
  76. * For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT,
  77. * cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
  78. * cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
  79. */
  80. public static void drawKeypoints(Mat image, MatOfKeyPoint keypoints, Mat outImage)
  81. {
  82. if (image != null) image.ThrowIfDisposed();
  83. if (keypoints != null) keypoints.ThrowIfDisposed();
  84. if (outImage != null) outImage.ThrowIfDisposed();
  85. Mat keypoints_mat = keypoints;
  86. features2d_Features2d_drawKeypoints_12(image.nativeObj, keypoints_mat.nativeObj, outImage.nativeObj);
  87. }
  88. //
  89. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  90. //
  91. /**
  92. * Draws the found matches of keypoints from two images.
  93. *
  94. * param img1 First source image.
  95. * param keypoints1 Keypoints from the first source image.
  96. * param img2 Second source image.
  97. * param keypoints2 Keypoints from the second source image.
  98. * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
  99. * has a corresponding point in keypoints2[matches[i]] .
  100. * param outImg Output image. Its content depends on the flags value defining what is drawn in the
  101. * output image. See possible flags bit values below.
  102. * param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
  103. * , the color is generated randomly.
  104. * param singlePointColor Color of single keypoints (circles), which means that keypoints do not
  105. * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  106. * param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are
  107. * drawn.
  108. * param flags Flags setting drawing features. Possible flags bit values are defined by
  109. * DrawMatchesFlags.
  110. *
  111. * This function draws matches of keypoints from two images in the output image. Match is a line
  112. * connecting two keypoints (circles). See cv::DrawMatchesFlags.
  113. */
  114. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
  115. {
  116. if (img1 != null) img1.ThrowIfDisposed();
  117. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  118. if (img2 != null) img2.ThrowIfDisposed();
  119. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  120. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  121. if (outImg != null) outImg.ThrowIfDisposed();
  122. if (matchesMask != null) matchesMask.ThrowIfDisposed();
  123. Mat keypoints1_mat = keypoints1;
  124. Mat keypoints2_mat = keypoints2;
  125. Mat matches1to2_mat = matches1to2;
  126. Mat matchesMask_mat = matchesMask;
  127. features2d_Features2d_drawMatches_10(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
  128. }
  129. /**
  130. * Draws the found matches of keypoints from two images.
  131. *
  132. * param img1 First source image.
  133. * param keypoints1 Keypoints from the first source image.
  134. * param img2 Second source image.
  135. * param keypoints2 Keypoints from the second source image.
  136. * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
  137. * has a corresponding point in keypoints2[matches[i]] .
  138. * param outImg Output image. Its content depends on the flags value defining what is drawn in the
  139. * output image. See possible flags bit values below.
  140. * param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
  141. * , the color is generated randomly.
  142. * param singlePointColor Color of single keypoints (circles), which means that keypoints do not
  143. * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  144. * param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are
  145. * drawn.
  146. * DrawMatchesFlags.
  147. *
  148. * This function draws matches of keypoints from two images in the output image. Match is a line
  149. * connecting two keypoints (circles). See cv::DrawMatchesFlags.
  150. */
  151. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask)
  152. {
  153. if (img1 != null) img1.ThrowIfDisposed();
  154. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  155. if (img2 != null) img2.ThrowIfDisposed();
  156. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  157. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  158. if (outImg != null) outImg.ThrowIfDisposed();
  159. if (matchesMask != null) matchesMask.ThrowIfDisposed();
  160. Mat keypoints1_mat = keypoints1;
  161. Mat keypoints2_mat = keypoints2;
  162. Mat matches1to2_mat = matches1to2;
  163. Mat matchesMask_mat = matchesMask;
  164. features2d_Features2d_drawMatches_11(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj);
  165. }
  166. /**
  167. * Draws the found matches of keypoints from two images.
  168. *
  169. * param img1 First source image.
  170. * param keypoints1 Keypoints from the first source image.
  171. * param img2 Second source image.
  172. * param keypoints2 Keypoints from the second source image.
  173. * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
  174. * has a corresponding point in keypoints2[matches[i]] .
  175. * param outImg Output image. Its content depends on the flags value defining what is drawn in the
  176. * output image. See possible flags bit values below.
  177. * param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
  178. * , the color is generated randomly.
  179. * param singlePointColor Color of single keypoints (circles), which means that keypoints do not
  180. * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  181. * drawn.
  182. * DrawMatchesFlags.
  183. *
  184. * This function draws matches of keypoints from two images in the output image. Match is a line
  185. * connecting two keypoints (circles). See cv::DrawMatchesFlags.
  186. */
  187. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor)
  188. {
  189. if (img1 != null) img1.ThrowIfDisposed();
  190. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  191. if (img2 != null) img2.ThrowIfDisposed();
  192. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  193. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  194. if (outImg != null) outImg.ThrowIfDisposed();
  195. Mat keypoints1_mat = keypoints1;
  196. Mat keypoints2_mat = keypoints2;
  197. Mat matches1to2_mat = matches1to2;
  198. features2d_Features2d_drawMatches_12(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3]);
  199. }
  200. /**
  201. * Draws the found matches of keypoints from two images.
  202. *
  203. * param img1 First source image.
  204. * param keypoints1 Keypoints from the first source image.
  205. * param img2 Second source image.
  206. * param keypoints2 Keypoints from the second source image.
  207. * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
  208. * has a corresponding point in keypoints2[matches[i]] .
  209. * param outImg Output image. Its content depends on the flags value defining what is drawn in the
  210. * output image. See possible flags bit values below.
  211. * param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1)
  212. * , the color is generated randomly.
  213. * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  214. * drawn.
  215. * DrawMatchesFlags.
  216. *
  217. * This function draws matches of keypoints from two images in the output image. Match is a line
  218. * connecting two keypoints (circles). See cv::DrawMatchesFlags.
  219. */
  220. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, Scalar matchColor)
  221. {
  222. if (img1 != null) img1.ThrowIfDisposed();
  223. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  224. if (img2 != null) img2.ThrowIfDisposed();
  225. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  226. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  227. if (outImg != null) outImg.ThrowIfDisposed();
  228. Mat keypoints1_mat = keypoints1;
  229. Mat keypoints2_mat = keypoints2;
  230. Mat matches1to2_mat = matches1to2;
  231. features2d_Features2d_drawMatches_13(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3]);
  232. }
  233. /**
  234. * Draws the found matches of keypoints from two images.
  235. *
  236. * param img1 First source image.
  237. * param keypoints1 Keypoints from the first source image.
  238. * param img2 Second source image.
  239. * param keypoints2 Keypoints from the second source image.
  240. * param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
  241. * has a corresponding point in keypoints2[matches[i]] .
  242. * param outImg Output image. Its content depends on the flags value defining what is drawn in the
  243. * output image. See possible flags bit values below.
  244. * , the color is generated randomly.
  245. * have the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
  246. * drawn.
  247. * DrawMatchesFlags.
  248. *
  249. * This function draws matches of keypoints from two images in the output image. Match is a line
  250. * connecting two keypoints (circles). See cv::DrawMatchesFlags.
  251. */
  252. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg)
  253. {
  254. if (img1 != null) img1.ThrowIfDisposed();
  255. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  256. if (img2 != null) img2.ThrowIfDisposed();
  257. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  258. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  259. if (outImg != null) outImg.ThrowIfDisposed();
  260. Mat keypoints1_mat = keypoints1;
  261. Mat keypoints2_mat = keypoints2;
  262. Mat matches1to2_mat = matches1to2;
  263. features2d_Features2d_drawMatches_14(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
  264. }
  265. //
  266. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, int matchesThickness, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  267. //
  268. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, int matchesThickness, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask, int flags)
  269. {
  270. if (img1 != null) img1.ThrowIfDisposed();
  271. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  272. if (img2 != null) img2.ThrowIfDisposed();
  273. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  274. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  275. if (outImg != null) outImg.ThrowIfDisposed();
  276. if (matchesMask != null) matchesMask.ThrowIfDisposed();
  277. Mat keypoints1_mat = keypoints1;
  278. Mat keypoints2_mat = keypoints2;
  279. Mat matches1to2_mat = matches1to2;
  280. Mat matchesMask_mat = matchesMask;
  281. features2d_Features2d_drawMatches_15(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchesThickness, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
  282. }
  283. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, int matchesThickness, Scalar matchColor, Scalar singlePointColor, MatOfByte matchesMask)
  284. {
  285. if (img1 != null) img1.ThrowIfDisposed();
  286. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  287. if (img2 != null) img2.ThrowIfDisposed();
  288. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  289. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  290. if (outImg != null) outImg.ThrowIfDisposed();
  291. if (matchesMask != null) matchesMask.ThrowIfDisposed();
  292. Mat keypoints1_mat = keypoints1;
  293. Mat keypoints2_mat = keypoints2;
  294. Mat matches1to2_mat = matches1to2;
  295. Mat matchesMask_mat = matchesMask;
  296. features2d_Features2d_drawMatches_16(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchesThickness, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj);
  297. }
  298. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, int matchesThickness, Scalar matchColor, Scalar singlePointColor)
  299. {
  300. if (img1 != null) img1.ThrowIfDisposed();
  301. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  302. if (img2 != null) img2.ThrowIfDisposed();
  303. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  304. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  305. if (outImg != null) outImg.ThrowIfDisposed();
  306. Mat keypoints1_mat = keypoints1;
  307. Mat keypoints2_mat = keypoints2;
  308. Mat matches1to2_mat = matches1to2;
  309. features2d_Features2d_drawMatches_17(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchesThickness, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3]);
  310. }
  311. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, int matchesThickness, Scalar matchColor)
  312. {
  313. if (img1 != null) img1.ThrowIfDisposed();
  314. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  315. if (img2 != null) img2.ThrowIfDisposed();
  316. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  317. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  318. if (outImg != null) outImg.ThrowIfDisposed();
  319. Mat keypoints1_mat = keypoints1;
  320. Mat keypoints2_mat = keypoints2;
  321. Mat matches1to2_mat = matches1to2;
  322. features2d_Features2d_drawMatches_18(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchesThickness, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3]);
  323. }
  324. public static void drawMatches(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, Mat outImg, int matchesThickness)
  325. {
  326. if (img1 != null) img1.ThrowIfDisposed();
  327. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  328. if (img2 != null) img2.ThrowIfDisposed();
  329. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  330. if (matches1to2 != null) matches1to2.ThrowIfDisposed();
  331. if (outImg != null) outImg.ThrowIfDisposed();
  332. Mat keypoints1_mat = keypoints1;
  333. Mat keypoints2_mat = keypoints2;
  334. Mat matches1to2_mat = matches1to2;
  335. features2d_Features2d_drawMatches_19(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchesThickness);
  336. }
  337. //
  338. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  339. //
  340. public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask, int flags)
  341. {
  342. if (img1 != null) img1.ThrowIfDisposed();
  343. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  344. if (img2 != null) img2.ThrowIfDisposed();
  345. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  346. if (outImg != null) outImg.ThrowIfDisposed();
  347. Mat keypoints1_mat = keypoints1;
  348. Mat keypoints2_mat = keypoints2;
  349. List<Mat> matches1to2_tmplm = new List<Mat>((matches1to2 != null) ? matches1to2.Count : 0);
  350. Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
  351. List<Mat> matchesMask_tmplm = new List<Mat>((matchesMask != null) ? matchesMask.Count : 0);
  352. Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
  353. features2d_Features2d_drawMatchesKnn_10(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj, flags);
  354. }
  355. public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor, List<MatOfByte> matchesMask)
  356. {
  357. if (img1 != null) img1.ThrowIfDisposed();
  358. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  359. if (img2 != null) img2.ThrowIfDisposed();
  360. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  361. if (outImg != null) outImg.ThrowIfDisposed();
  362. Mat keypoints1_mat = keypoints1;
  363. Mat keypoints2_mat = keypoints2;
  364. List<Mat> matches1to2_tmplm = new List<Mat>((matches1to2 != null) ? matches1to2.Count : 0);
  365. Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
  366. List<Mat> matchesMask_tmplm = new List<Mat>((matchesMask != null) ? matchesMask.Count : 0);
  367. Mat matchesMask_mat = Converters.vector_vector_char_to_Mat(matchesMask, matchesMask_tmplm);
  368. features2d_Features2d_drawMatchesKnn_11(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3], matchesMask_mat.nativeObj);
  369. }
  370. public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor, Scalar singlePointColor)
  371. {
  372. if (img1 != null) img1.ThrowIfDisposed();
  373. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  374. if (img2 != null) img2.ThrowIfDisposed();
  375. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  376. if (outImg != null) outImg.ThrowIfDisposed();
  377. Mat keypoints1_mat = keypoints1;
  378. Mat keypoints2_mat = keypoints2;
  379. List<Mat> matches1to2_tmplm = new List<Mat>((matches1to2 != null) ? matches1to2.Count : 0);
  380. Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
  381. features2d_Features2d_drawMatchesKnn_12(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3], singlePointColor.val[0], singlePointColor.val[1], singlePointColor.val[2], singlePointColor.val[3]);
  382. }
  383. public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg, Scalar matchColor)
  384. {
  385. if (img1 != null) img1.ThrowIfDisposed();
  386. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  387. if (img2 != null) img2.ThrowIfDisposed();
  388. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  389. if (outImg != null) outImg.ThrowIfDisposed();
  390. Mat keypoints1_mat = keypoints1;
  391. Mat keypoints2_mat = keypoints2;
  392. List<Mat> matches1to2_tmplm = new List<Mat>((matches1to2 != null) ? matches1to2.Count : 0);
  393. Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
  394. features2d_Features2d_drawMatchesKnn_13(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj, matchColor.val[0], matchColor.val[1], matchColor.val[2], matchColor.val[3]);
  395. }
  396. public static void drawMatchesKnn(Mat img1, MatOfKeyPoint keypoints1, Mat img2, MatOfKeyPoint keypoints2, List<MatOfDMatch> matches1to2, Mat outImg)
  397. {
  398. if (img1 != null) img1.ThrowIfDisposed();
  399. if (keypoints1 != null) keypoints1.ThrowIfDisposed();
  400. if (img2 != null) img2.ThrowIfDisposed();
  401. if (keypoints2 != null) keypoints2.ThrowIfDisposed();
  402. if (outImg != null) outImg.ThrowIfDisposed();
  403. Mat keypoints1_mat = keypoints1;
  404. Mat keypoints2_mat = keypoints2;
  405. List<Mat> matches1to2_tmplm = new List<Mat>((matches1to2 != null) ? matches1to2.Count : 0);
  406. Mat matches1to2_mat = Converters.vector_vector_DMatch_to_Mat(matches1to2, matches1to2_tmplm);
  407. features2d_Features2d_drawMatchesKnn_14(img1.nativeObj, keypoints1_mat.nativeObj, img2.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, outImg.nativeObj);
  408. }
  409. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  410. const string LIBNAME = "__Internal";
  411. #else
  412. const string LIBNAME = "opencvforunity";
  413. #endif
  414. // C++: void cv::drawKeypoints(Mat image, vector_KeyPoint keypoints, Mat& outImage, Scalar color = Scalar::all(-1), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  415. [DllImport(LIBNAME)]
  416. private static extern void features2d_Features2d_drawKeypoints_10(IntPtr image_nativeObj, IntPtr keypoints_mat_nativeObj, IntPtr outImage_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3, int flags);
  417. [DllImport(LIBNAME)]
  418. private static extern void features2d_Features2d_drawKeypoints_11(IntPtr image_nativeObj, IntPtr keypoints_mat_nativeObj, IntPtr outImage_nativeObj, double color_val0, double color_val1, double color_val2, double color_val3);
  419. [DllImport(LIBNAME)]
  420. private static extern void features2d_Features2d_drawKeypoints_12(IntPtr image_nativeObj, IntPtr keypoints_mat_nativeObj, IntPtr outImage_nativeObj);
  421. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  422. [DllImport(LIBNAME)]
  423. private static extern void features2d_Features2d_drawMatches_10(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj, int flags);
  424. [DllImport(LIBNAME)]
  425. private static extern void features2d_Features2d_drawMatches_11(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj);
  426. [DllImport(LIBNAME)]
  427. private static extern void features2d_Features2d_drawMatches_12(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3);
  428. [DllImport(LIBNAME)]
  429. private static extern void features2d_Features2d_drawMatches_13(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3);
  430. [DllImport(LIBNAME)]
  431. private static extern void features2d_Features2d_drawMatches_14(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj);
  432. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_DMatch matches1to2, Mat& outImg, int matchesThickness, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_char matchesMask = std::vector<char>(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  433. [DllImport(LIBNAME)]
  434. private static extern void features2d_Features2d_drawMatches_15(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, int matchesThickness, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj, int flags);
  435. [DllImport(LIBNAME)]
  436. private static extern void features2d_Features2d_drawMatches_16(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, int matchesThickness, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj);
  437. [DllImport(LIBNAME)]
  438. private static extern void features2d_Features2d_drawMatches_17(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, int matchesThickness, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3);
  439. [DllImport(LIBNAME)]
  440. private static extern void features2d_Features2d_drawMatches_18(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, int matchesThickness, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3);
  441. [DllImport(LIBNAME)]
  442. private static extern void features2d_Features2d_drawMatches_19(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, int matchesThickness);
  443. // C++: void cv::drawMatches(Mat img1, vector_KeyPoint keypoints1, Mat img2, vector_KeyPoint keypoints2, vector_vector_DMatch matches1to2, Mat& outImg, Scalar matchColor = Scalar::all(-1), Scalar singlePointColor = Scalar::all(-1), vector_vector_char matchesMask = std::vector<std::vector<char> >(), DrawMatchesFlags flags = DrawMatchesFlags::DEFAULT)
  444. [DllImport(LIBNAME)]
  445. private static extern void features2d_Features2d_drawMatchesKnn_10(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj, int flags);
  446. [DllImport(LIBNAME)]
  447. private static extern void features2d_Features2d_drawMatchesKnn_11(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3, IntPtr matchesMask_mat_nativeObj);
  448. [DllImport(LIBNAME)]
  449. private static extern void features2d_Features2d_drawMatchesKnn_12(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3, double singlePointColor_val0, double singlePointColor_val1, double singlePointColor_val2, double singlePointColor_val3);
  450. [DllImport(LIBNAME)]
  451. private static extern void features2d_Features2d_drawMatchesKnn_13(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj, double matchColor_val0, double matchColor_val1, double matchColor_val2, double matchColor_val3);
  452. [DllImport(LIBNAME)]
  453. private static extern void features2d_Features2d_drawMatchesKnn_14(IntPtr img1_nativeObj, IntPtr keypoints1_mat_nativeObj, IntPtr img2_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr outImg_nativeObj);
  454. }
  455. }