PCTSignaturesSQFD.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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.Xfeatures2dModule
  8. {
  9. // C++: class PCTSignaturesSQFD
  10. //javadoc: PCTSignaturesSQFD
  11. public class PCTSignaturesSQFD : 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. xfeatures2d_PCTSignaturesSQFD_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal PCTSignaturesSQFD (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new PCTSignaturesSQFD __fromPtr__ (IntPtr addr) { return new PCTSignaturesSQFD (addr); }
  34. //
  35. // C++: static Ptr_PCTSignaturesSQFD cv::xfeatures2d::PCTSignaturesSQFD::create(int distanceFunction = 3, int similarityFunction = 2, float similarityParameter = 1.0f)
  36. //
  37. //javadoc: PCTSignaturesSQFD::create(distanceFunction, similarityFunction, similarityParameter)
  38. public static PCTSignaturesSQFD create (int distanceFunction, int similarityFunction, float similarityParameter)
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. PCTSignaturesSQFD retVal = PCTSignaturesSQFD.__fromPtr__(xfeatures2d_PCTSignaturesSQFD_create_10(distanceFunction, similarityFunction, similarityParameter));
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //javadoc: PCTSignaturesSQFD::create(distanceFunction, similarityFunction)
  48. public static PCTSignaturesSQFD create (int distanceFunction, int similarityFunction)
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. PCTSignaturesSQFD retVal = PCTSignaturesSQFD.__fromPtr__(xfeatures2d_PCTSignaturesSQFD_create_11(distanceFunction, similarityFunction));
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //javadoc: PCTSignaturesSQFD::create(distanceFunction)
  58. public static PCTSignaturesSQFD create (int distanceFunction)
  59. {
  60. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  61. PCTSignaturesSQFD retVal = PCTSignaturesSQFD.__fromPtr__(xfeatures2d_PCTSignaturesSQFD_create_12(distanceFunction));
  62. return retVal;
  63. #else
  64. return null;
  65. #endif
  66. }
  67. //javadoc: PCTSignaturesSQFD::create()
  68. public static PCTSignaturesSQFD create ()
  69. {
  70. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  71. PCTSignaturesSQFD retVal = PCTSignaturesSQFD.__fromPtr__(xfeatures2d_PCTSignaturesSQFD_create_13());
  72. return retVal;
  73. #else
  74. return null;
  75. #endif
  76. }
  77. //
  78. // C++: float cv::xfeatures2d::PCTSignaturesSQFD::computeQuadraticFormDistance(Mat _signature0, Mat _signature1)
  79. //
  80. //javadoc: PCTSignaturesSQFD::computeQuadraticFormDistance(_signature0, _signature1)
  81. public float computeQuadraticFormDistance (Mat _signature0, Mat _signature1)
  82. {
  83. ThrowIfDisposed ();
  84. if (_signature0 != null) _signature0.ThrowIfDisposed ();
  85. if (_signature1 != null) _signature1.ThrowIfDisposed ();
  86. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  87. float retVal = xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistance_10(nativeObj, _signature0.nativeObj, _signature1.nativeObj);
  88. return retVal;
  89. #else
  90. return -1;
  91. #endif
  92. }
  93. //
  94. // C++: void cv::xfeatures2d::PCTSignaturesSQFD::computeQuadraticFormDistances(Mat sourceSignature, vector_Mat imageSignatures, vector_float distances)
  95. //
  96. //javadoc: PCTSignaturesSQFD::computeQuadraticFormDistances(sourceSignature, imageSignatures, distances)
  97. public void computeQuadraticFormDistances (Mat sourceSignature, List<Mat> imageSignatures, MatOfFloat distances)
  98. {
  99. ThrowIfDisposed ();
  100. if (sourceSignature != null) sourceSignature.ThrowIfDisposed ();
  101. if (distances != null) distances.ThrowIfDisposed ();
  102. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  103. Mat imageSignatures_mat = Converters.vector_Mat_to_Mat(imageSignatures);
  104. Mat distances_mat = distances;
  105. xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistances_10(nativeObj, sourceSignature.nativeObj, imageSignatures_mat.nativeObj, distances_mat.nativeObj);
  106. return;
  107. #else
  108. return;
  109. #endif
  110. }
  111. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  112. const string LIBNAME = "__Internal";
  113. #else
  114. const string LIBNAME = "opencvforunity";
  115. #endif
  116. // C++: static Ptr_PCTSignaturesSQFD cv::xfeatures2d::PCTSignaturesSQFD::create(int distanceFunction = 3, int similarityFunction = 2, float similarityParameter = 1.0f)
  117. [DllImport (LIBNAME)]
  118. private static extern IntPtr xfeatures2d_PCTSignaturesSQFD_create_10 (int distanceFunction, int similarityFunction, float similarityParameter);
  119. [DllImport (LIBNAME)]
  120. private static extern IntPtr xfeatures2d_PCTSignaturesSQFD_create_11 (int distanceFunction, int similarityFunction);
  121. [DllImport (LIBNAME)]
  122. private static extern IntPtr xfeatures2d_PCTSignaturesSQFD_create_12 (int distanceFunction);
  123. [DllImport (LIBNAME)]
  124. private static extern IntPtr xfeatures2d_PCTSignaturesSQFD_create_13 ();
  125. // C++: float cv::xfeatures2d::PCTSignaturesSQFD::computeQuadraticFormDistance(Mat _signature0, Mat _signature1)
  126. [DllImport (LIBNAME)]
  127. private static extern float xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistance_10 (IntPtr nativeObj, IntPtr _signature0_nativeObj, IntPtr _signature1_nativeObj);
  128. // C++: void cv::xfeatures2d::PCTSignaturesSQFD::computeQuadraticFormDistances(Mat sourceSignature, vector_Mat imageSignatures, vector_float distances)
  129. [DllImport (LIBNAME)]
  130. private static extern void xfeatures2d_PCTSignaturesSQFD_computeQuadraticFormDistances_10 (IntPtr nativeObj, IntPtr sourceSignature_nativeObj, IntPtr imageSignatures_mat_nativeObj, IntPtr distances_mat_nativeObj);
  131. // native support for java finalize()
  132. [DllImport (LIBNAME)]
  133. private static extern void xfeatures2d_PCTSignaturesSQFD_delete (IntPtr nativeObj);
  134. }
  135. }