HistogramCostExtractor.cs 5.3 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.ShapeModule
  8. {
  9. // C++: class HistogramCostExtractor
  10. //javadoc: HistogramCostExtractor
  11. public class HistogramCostExtractor : 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. shape_HistogramCostExtractor_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal HistogramCostExtractor (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new HistogramCostExtractor __fromPtr__ (IntPtr addr) { return new HistogramCostExtractor (addr); }
  34. //
  35. // C++: float cv::HistogramCostExtractor::getDefaultCost()
  36. //
  37. //javadoc: HistogramCostExtractor::getDefaultCost()
  38. public float getDefaultCost ()
  39. {
  40. ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. float retVal = shape_HistogramCostExtractor_getDefaultCost_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: int cv::HistogramCostExtractor::getNDummies()
  50. //
  51. //javadoc: HistogramCostExtractor::getNDummies()
  52. public int getNDummies ()
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. int retVal = shape_HistogramCostExtractor_getNDummies_10(nativeObj);
  57. return retVal;
  58. #else
  59. return -1;
  60. #endif
  61. }
  62. //
  63. // C++: void cv::HistogramCostExtractor::buildCostMatrix(Mat descriptors1, Mat descriptors2, Mat& costMatrix)
  64. //
  65. //javadoc: HistogramCostExtractor::buildCostMatrix(descriptors1, descriptors2, costMatrix)
  66. public void buildCostMatrix (Mat descriptors1, Mat descriptors2, Mat costMatrix)
  67. {
  68. ThrowIfDisposed ();
  69. if (descriptors1 != null) descriptors1.ThrowIfDisposed ();
  70. if (descriptors2 != null) descriptors2.ThrowIfDisposed ();
  71. if (costMatrix != null) costMatrix.ThrowIfDisposed ();
  72. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  73. shape_HistogramCostExtractor_buildCostMatrix_10(nativeObj, descriptors1.nativeObj, descriptors2.nativeObj, costMatrix.nativeObj);
  74. return;
  75. #else
  76. return;
  77. #endif
  78. }
  79. //
  80. // C++: void cv::HistogramCostExtractor::setDefaultCost(float defaultCost)
  81. //
  82. //javadoc: HistogramCostExtractor::setDefaultCost(defaultCost)
  83. public void setDefaultCost (float defaultCost)
  84. {
  85. ThrowIfDisposed ();
  86. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  87. shape_HistogramCostExtractor_setDefaultCost_10(nativeObj, defaultCost);
  88. return;
  89. #else
  90. return;
  91. #endif
  92. }
  93. //
  94. // C++: void cv::HistogramCostExtractor::setNDummies(int nDummies)
  95. //
  96. //javadoc: HistogramCostExtractor::setNDummies(nDummies)
  97. public void setNDummies (int nDummies)
  98. {
  99. ThrowIfDisposed ();
  100. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  101. shape_HistogramCostExtractor_setNDummies_10(nativeObj, nDummies);
  102. return;
  103. #else
  104. return;
  105. #endif
  106. }
  107. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  108. const string LIBNAME = "__Internal";
  109. #else
  110. const string LIBNAME = "opencvforunity";
  111. #endif
  112. // C++: float cv::HistogramCostExtractor::getDefaultCost()
  113. [DllImport (LIBNAME)]
  114. private static extern float shape_HistogramCostExtractor_getDefaultCost_10 (IntPtr nativeObj);
  115. // C++: int cv::HistogramCostExtractor::getNDummies()
  116. [DllImport (LIBNAME)]
  117. private static extern int shape_HistogramCostExtractor_getNDummies_10 (IntPtr nativeObj);
  118. // C++: void cv::HistogramCostExtractor::buildCostMatrix(Mat descriptors1, Mat descriptors2, Mat& costMatrix)
  119. [DllImport (LIBNAME)]
  120. private static extern void shape_HistogramCostExtractor_buildCostMatrix_10 (IntPtr nativeObj, IntPtr descriptors1_nativeObj, IntPtr descriptors2_nativeObj, IntPtr costMatrix_nativeObj);
  121. // C++: void cv::HistogramCostExtractor::setDefaultCost(float defaultCost)
  122. [DllImport (LIBNAME)]
  123. private static extern void shape_HistogramCostExtractor_setDefaultCost_10 (IntPtr nativeObj, float defaultCost);
  124. // C++: void cv::HistogramCostExtractor::setNDummies(int nDummies)
  125. [DllImport (LIBNAME)]
  126. private static extern void shape_HistogramCostExtractor_setNDummies_10 (IntPtr nativeObj, int nDummies);
  127. // native support for java finalize()
  128. [DllImport (LIBNAME)]
  129. private static extern void shape_HistogramCostExtractor_delete (IntPtr nativeObj);
  130. }
  131. }