Xfeatures2d.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.Features2dModule;
  4. using OpenCVForUnity.UtilsModule;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Runtime.InteropServices;
  8. namespace OpenCVForUnity.Xfeatures2dModule
  9. {
  10. // C++: class Xfeatures2d
  11. //javadoc: Xfeatures2d
  12. public class Xfeatures2d
  13. {
  14. //
  15. // C++: void cv::xfeatures2d::matchGMS(Size size1, Size size2, vector_KeyPoint keypoints1, vector_KeyPoint keypoints2, vector_DMatch matches1to2, vector_DMatch& matchesGMS, bool withRotation = false, bool withScale = false, double thresholdFactor = 6.0)
  16. //
  17. //javadoc: matchGMS(size1, size2, keypoints1, keypoints2, matches1to2, matchesGMS, withRotation, withScale, thresholdFactor)
  18. public static void matchGMS (Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS, bool withRotation, bool withScale, double thresholdFactor)
  19. {
  20. if (keypoints1 != null) keypoints1.ThrowIfDisposed ();
  21. if (keypoints2 != null) keypoints2.ThrowIfDisposed ();
  22. if (matches1to2 != null) matches1to2.ThrowIfDisposed ();
  23. if (matchesGMS != null) matchesGMS.ThrowIfDisposed ();
  24. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  25. Mat keypoints1_mat = keypoints1;
  26. Mat keypoints2_mat = keypoints2;
  27. Mat matches1to2_mat = matches1to2;
  28. Mat matchesGMS_mat = matchesGMS;
  29. xfeatures2d_Xfeatures2d_matchGMS_10(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj, withRotation, withScale, thresholdFactor);
  30. return;
  31. #else
  32. return;
  33. #endif
  34. }
  35. //javadoc: matchGMS(size1, size2, keypoints1, keypoints2, matches1to2, matchesGMS, withRotation, withScale)
  36. public static void matchGMS (Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS, bool withRotation, bool withScale)
  37. {
  38. if (keypoints1 != null) keypoints1.ThrowIfDisposed ();
  39. if (keypoints2 != null) keypoints2.ThrowIfDisposed ();
  40. if (matches1to2 != null) matches1to2.ThrowIfDisposed ();
  41. if (matchesGMS != null) matchesGMS.ThrowIfDisposed ();
  42. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  43. Mat keypoints1_mat = keypoints1;
  44. Mat keypoints2_mat = keypoints2;
  45. Mat matches1to2_mat = matches1to2;
  46. Mat matchesGMS_mat = matchesGMS;
  47. xfeatures2d_Xfeatures2d_matchGMS_11(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj, withRotation, withScale);
  48. return;
  49. #else
  50. return;
  51. #endif
  52. }
  53. //javadoc: matchGMS(size1, size2, keypoints1, keypoints2, matches1to2, matchesGMS, withRotation)
  54. public static void matchGMS (Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS, bool withRotation)
  55. {
  56. if (keypoints1 != null) keypoints1.ThrowIfDisposed ();
  57. if (keypoints2 != null) keypoints2.ThrowIfDisposed ();
  58. if (matches1to2 != null) matches1to2.ThrowIfDisposed ();
  59. if (matchesGMS != null) matchesGMS.ThrowIfDisposed ();
  60. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  61. Mat keypoints1_mat = keypoints1;
  62. Mat keypoints2_mat = keypoints2;
  63. Mat matches1to2_mat = matches1to2;
  64. Mat matchesGMS_mat = matchesGMS;
  65. xfeatures2d_Xfeatures2d_matchGMS_12(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj, withRotation);
  66. return;
  67. #else
  68. return;
  69. #endif
  70. }
  71. //javadoc: matchGMS(size1, size2, keypoints1, keypoints2, matches1to2, matchesGMS)
  72. public static void matchGMS (Size size1, Size size2, MatOfKeyPoint keypoints1, MatOfKeyPoint keypoints2, MatOfDMatch matches1to2, MatOfDMatch matchesGMS)
  73. {
  74. if (keypoints1 != null) keypoints1.ThrowIfDisposed ();
  75. if (keypoints2 != null) keypoints2.ThrowIfDisposed ();
  76. if (matches1to2 != null) matches1to2.ThrowIfDisposed ();
  77. if (matchesGMS != null) matchesGMS.ThrowIfDisposed ();
  78. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  79. Mat keypoints1_mat = keypoints1;
  80. Mat keypoints2_mat = keypoints2;
  81. Mat matches1to2_mat = matches1to2;
  82. Mat matchesGMS_mat = matchesGMS;
  83. xfeatures2d_Xfeatures2d_matchGMS_13(size1.width, size1.height, size2.width, size2.height, keypoints1_mat.nativeObj, keypoints2_mat.nativeObj, matches1to2_mat.nativeObj, matchesGMS_mat.nativeObj);
  84. return;
  85. #else
  86. return;
  87. #endif
  88. }
  89. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  90. const string LIBNAME = "__Internal";
  91. #else
  92. const string LIBNAME = "opencvforunity";
  93. #endif
  94. // C++: void cv::xfeatures2d::matchGMS(Size size1, Size size2, vector_KeyPoint keypoints1, vector_KeyPoint keypoints2, vector_DMatch matches1to2, vector_DMatch& matchesGMS, bool withRotation = false, bool withScale = false, double thresholdFactor = 6.0)
  95. [DllImport (LIBNAME)]
  96. private static extern void xfeatures2d_Xfeatures2d_matchGMS_10 (double size1_width, double size1_height, double size2_width, double size2_height, IntPtr keypoints1_mat_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr matchesGMS_mat_nativeObj, bool withRotation, bool withScale, double thresholdFactor);
  97. [DllImport (LIBNAME)]
  98. private static extern void xfeatures2d_Xfeatures2d_matchGMS_11 (double size1_width, double size1_height, double size2_width, double size2_height, IntPtr keypoints1_mat_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr matchesGMS_mat_nativeObj, bool withRotation, bool withScale);
  99. [DllImport (LIBNAME)]
  100. private static extern void xfeatures2d_Xfeatures2d_matchGMS_12 (double size1_width, double size1_height, double size2_width, double size2_height, IntPtr keypoints1_mat_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr matchesGMS_mat_nativeObj, bool withRotation);
  101. [DllImport (LIBNAME)]
  102. private static extern void xfeatures2d_Xfeatures2d_matchGMS_13 (double size1_width, double size1_height, double size2_width, double size2_height, IntPtr keypoints1_mat_nativeObj, IntPtr keypoints2_mat_nativeObj, IntPtr matches1to2_mat_nativeObj, IntPtr matchesGMS_mat_nativeObj);
  103. }
  104. }