StandardCollector.cs 3.7 KB

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