StandardCollector.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.UtilsModule;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Runtime.InteropServices;
  6. namespace OpenCVForUnity.FaceModule
  7. {
  8. // C++: class StandardCollector
  9. /**
  10. * Default predict collector
  11. *
  12. * Trace minimal distance with treshhold checking (that is default behavior for most predict logic)
  13. */
  14. public class StandardCollector : PredictCollector
  15. {
  16. protected override void Dispose(bool disposing)
  17. {
  18. try
  19. {
  20. if (disposing)
  21. {
  22. }
  23. if (IsEnabledDispose)
  24. {
  25. if (nativeObj != IntPtr.Zero)
  26. face_StandardCollector_delete(nativeObj);
  27. nativeObj = IntPtr.Zero;
  28. }
  29. }
  30. finally
  31. {
  32. base.Dispose(disposing);
  33. }
  34. }
  35. protected internal StandardCollector(IntPtr addr) : base(addr) { }
  36. // internal usage only
  37. public static new StandardCollector __fromPtr__(IntPtr addr) { return new StandardCollector(addr); }
  38. //
  39. // C++: int cv::face::StandardCollector::getMinLabel()
  40. //
  41. /**
  42. * Returns label with minimal distance
  43. * return automatically generated
  44. */
  45. public int getMinLabel()
  46. {
  47. ThrowIfDisposed();
  48. return face_StandardCollector_getMinLabel_10(nativeObj);
  49. }
  50. //
  51. // C++: double cv::face::StandardCollector::getMinDist()
  52. //
  53. /**
  54. * Returns minimal distance value
  55. * return automatically generated
  56. */
  57. public double getMinDist()
  58. {
  59. ThrowIfDisposed();
  60. return face_StandardCollector_getMinDist_10(nativeObj);
  61. }
  62. //
  63. // C++: vector_pair_int_and_double cv::face::StandardCollector::getResults(bool sorted = false)
  64. //
  65. // Return type 'vector_pair_int_and_double' is not supported, skipping the function
  66. //
  67. // C++: static Ptr_StandardCollector cv::face::StandardCollector::create(double threshold = DBL_MAX)
  68. //
  69. /**
  70. * Static constructor
  71. * param threshold set threshold
  72. * return automatically generated
  73. */
  74. public static StandardCollector create(double threshold)
  75. {
  76. return StandardCollector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(face_StandardCollector_create_10(threshold)));
  77. }
  78. /**
  79. * Static constructor
  80. * return automatically generated
  81. */
  82. public static StandardCollector create()
  83. {
  84. return StandardCollector.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(face_StandardCollector_create_11()));
  85. }
  86. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  87. const string LIBNAME = "__Internal";
  88. #else
  89. const string LIBNAME = "opencvforunity";
  90. #endif
  91. // C++: int cv::face::StandardCollector::getMinLabel()
  92. [DllImport(LIBNAME)]
  93. private static extern int face_StandardCollector_getMinLabel_10(IntPtr nativeObj);
  94. // C++: double cv::face::StandardCollector::getMinDist()
  95. [DllImport(LIBNAME)]
  96. private static extern double face_StandardCollector_getMinDist_10(IntPtr nativeObj);
  97. // C++: static Ptr_StandardCollector cv::face::StandardCollector::create(double threshold = DBL_MAX)
  98. [DllImport(LIBNAME)]
  99. private static extern IntPtr face_StandardCollector_create_10(double threshold);
  100. [DllImport(LIBNAME)]
  101. private static extern IntPtr face_StandardCollector_create_11();
  102. // native support for java finalize()
  103. [DllImport(LIBNAME)]
  104. private static extern void face_StandardCollector_delete(IntPtr nativeObj);
  105. }
  106. }