StandardCollector.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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.FaceModule
  8. {
  9. // C++: class StandardCollector
  10. //javadoc: StandardCollector
  11. public class StandardCollector : PredictCollector
  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. face_StandardCollector_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal StandardCollector (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new StandardCollector __fromPtr__ (IntPtr addr) { return new StandardCollector (addr); }
  34. //
  35. // C++: static Ptr_StandardCollector cv::face::StandardCollector::create(double threshold = DBL_MAX)
  36. //
  37. //javadoc: StandardCollector::create(threshold)
  38. public static StandardCollector create (double threshold)
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. StandardCollector retVal = StandardCollector.__fromPtr__(face_StandardCollector_create_10(threshold));
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //javadoc: StandardCollector::create()
  48. public static StandardCollector create ()
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. StandardCollector retVal = StandardCollector.__fromPtr__(face_StandardCollector_create_11());
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //
  58. // C++: double cv::face::StandardCollector::getMinDist()
  59. //
  60. //javadoc: StandardCollector::getMinDist()
  61. public double getMinDist ()
  62. {
  63. ThrowIfDisposed ();
  64. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  65. double retVal = face_StandardCollector_getMinDist_10(nativeObj);
  66. return retVal;
  67. #else
  68. return -1;
  69. #endif
  70. }
  71. //
  72. // C++: int cv::face::StandardCollector::getMinLabel()
  73. //
  74. //javadoc: StandardCollector::getMinLabel()
  75. public int getMinLabel ()
  76. {
  77. ThrowIfDisposed ();
  78. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  79. int retVal = face_StandardCollector_getMinLabel_10(nativeObj);
  80. return retVal;
  81. #else
  82. return -1;
  83. #endif
  84. }
  85. //
  86. // C++: vector_pair_int_and_double cv::face::StandardCollector::getResults(bool sorted = false)
  87. //
  88. // Return type 'vector_pair_int_and_double' is not supported, skipping the function
  89. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  90. const string LIBNAME = "__Internal";
  91. #else
  92. const string LIBNAME = "opencvforunity";
  93. #endif
  94. // C++: static Ptr_StandardCollector cv::face::StandardCollector::create(double threshold = DBL_MAX)
  95. [DllImport (LIBNAME)]
  96. private static extern IntPtr face_StandardCollector_create_10 (double threshold);
  97. [DllImport (LIBNAME)]
  98. private static extern IntPtr face_StandardCollector_create_11 ();
  99. // C++: double cv::face::StandardCollector::getMinDist()
  100. [DllImport (LIBNAME)]
  101. private static extern double face_StandardCollector_getMinDist_10 (IntPtr nativeObj);
  102. // C++: int cv::face::StandardCollector::getMinLabel()
  103. [DllImport (LIBNAME)]
  104. private static extern int face_StandardCollector_getMinLabel_10 (IntPtr nativeObj);
  105. // native support for java finalize()
  106. [DllImport (LIBNAME)]
  107. private static extern void face_StandardCollector_delete (IntPtr nativeObj);
  108. }
  109. }