BasicFaceRecognizer.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 BasicFaceRecognizer
  9. public class BasicFaceRecognizer : FaceRecognizer
  10. {
  11. protected override void Dispose(bool disposing)
  12. {
  13. try
  14. {
  15. if (disposing)
  16. {
  17. }
  18. if (IsEnabledDispose)
  19. {
  20. if (nativeObj != IntPtr.Zero)
  21. face_BasicFaceRecognizer_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. }
  25. finally
  26. {
  27. base.Dispose(disposing);
  28. }
  29. }
  30. protected internal BasicFaceRecognizer(IntPtr addr) : base(addr) { }
  31. // internal usage only
  32. public static new BasicFaceRecognizer __fromPtr__(IntPtr addr) { return new BasicFaceRecognizer(addr); }
  33. //
  34. // C++: int cv::face::BasicFaceRecognizer::getNumComponents()
  35. //
  36. /**
  37. * SEE: setNumComponents
  38. * return automatically generated
  39. */
  40. public int getNumComponents()
  41. {
  42. ThrowIfDisposed();
  43. return face_BasicFaceRecognizer_getNumComponents_10(nativeObj);
  44. }
  45. //
  46. // C++: void cv::face::BasicFaceRecognizer::setNumComponents(int val)
  47. //
  48. /**
  49. * getNumComponents SEE: getNumComponents
  50. * param val automatically generated
  51. */
  52. public void setNumComponents(int val)
  53. {
  54. ThrowIfDisposed();
  55. face_BasicFaceRecognizer_setNumComponents_10(nativeObj, val);
  56. }
  57. //
  58. // C++: double cv::face::BasicFaceRecognizer::getThreshold()
  59. //
  60. /**
  61. * SEE: setThreshold
  62. * return automatically generated
  63. */
  64. public double getThreshold()
  65. {
  66. ThrowIfDisposed();
  67. return face_BasicFaceRecognizer_getThreshold_10(nativeObj);
  68. }
  69. //
  70. // C++: void cv::face::BasicFaceRecognizer::setThreshold(double val)
  71. //
  72. /**
  73. * getThreshold SEE: getThreshold
  74. * param val automatically generated
  75. */
  76. public void setThreshold(double val)
  77. {
  78. ThrowIfDisposed();
  79. face_BasicFaceRecognizer_setThreshold_10(nativeObj, val);
  80. }
  81. //
  82. // C++: vector_Mat cv::face::BasicFaceRecognizer::getProjections()
  83. //
  84. public List<Mat> getProjections()
  85. {
  86. ThrowIfDisposed();
  87. List<Mat> retVal = new List<Mat>();
  88. Mat retValMat = new Mat(DisposableObject.ThrowIfNullIntPtr(face_BasicFaceRecognizer_getProjections_10(nativeObj)));
  89. Converters.Mat_to_vector_Mat(retValMat, retVal);
  90. return retVal;
  91. }
  92. //
  93. // C++: Mat cv::face::BasicFaceRecognizer::getLabels()
  94. //
  95. public Mat getLabels()
  96. {
  97. ThrowIfDisposed();
  98. return new Mat(DisposableObject.ThrowIfNullIntPtr(face_BasicFaceRecognizer_getLabels_10(nativeObj)));
  99. }
  100. //
  101. // C++: Mat cv::face::BasicFaceRecognizer::getEigenValues()
  102. //
  103. public Mat getEigenValues()
  104. {
  105. ThrowIfDisposed();
  106. return new Mat(DisposableObject.ThrowIfNullIntPtr(face_BasicFaceRecognizer_getEigenValues_10(nativeObj)));
  107. }
  108. //
  109. // C++: Mat cv::face::BasicFaceRecognizer::getEigenVectors()
  110. //
  111. public Mat getEigenVectors()
  112. {
  113. ThrowIfDisposed();
  114. return new Mat(DisposableObject.ThrowIfNullIntPtr(face_BasicFaceRecognizer_getEigenVectors_10(nativeObj)));
  115. }
  116. //
  117. // C++: Mat cv::face::BasicFaceRecognizer::getMean()
  118. //
  119. public Mat getMean()
  120. {
  121. ThrowIfDisposed();
  122. return new Mat(DisposableObject.ThrowIfNullIntPtr(face_BasicFaceRecognizer_getMean_10(nativeObj)));
  123. }
  124. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  125. const string LIBNAME = "__Internal";
  126. #else
  127. const string LIBNAME = "opencvforunity";
  128. #endif
  129. // C++: int cv::face::BasicFaceRecognizer::getNumComponents()
  130. [DllImport(LIBNAME)]
  131. private static extern int face_BasicFaceRecognizer_getNumComponents_10(IntPtr nativeObj);
  132. // C++: void cv::face::BasicFaceRecognizer::setNumComponents(int val)
  133. [DllImport(LIBNAME)]
  134. private static extern void face_BasicFaceRecognizer_setNumComponents_10(IntPtr nativeObj, int val);
  135. // C++: double cv::face::BasicFaceRecognizer::getThreshold()
  136. [DllImport(LIBNAME)]
  137. private static extern double face_BasicFaceRecognizer_getThreshold_10(IntPtr nativeObj);
  138. // C++: void cv::face::BasicFaceRecognizer::setThreshold(double val)
  139. [DllImport(LIBNAME)]
  140. private static extern void face_BasicFaceRecognizer_setThreshold_10(IntPtr nativeObj, double val);
  141. // C++: vector_Mat cv::face::BasicFaceRecognizer::getProjections()
  142. [DllImport(LIBNAME)]
  143. private static extern IntPtr face_BasicFaceRecognizer_getProjections_10(IntPtr nativeObj);
  144. // C++: Mat cv::face::BasicFaceRecognizer::getLabels()
  145. [DllImport(LIBNAME)]
  146. private static extern IntPtr face_BasicFaceRecognizer_getLabels_10(IntPtr nativeObj);
  147. // C++: Mat cv::face::BasicFaceRecognizer::getEigenValues()
  148. [DllImport(LIBNAME)]
  149. private static extern IntPtr face_BasicFaceRecognizer_getEigenValues_10(IntPtr nativeObj);
  150. // C++: Mat cv::face::BasicFaceRecognizer::getEigenVectors()
  151. [DllImport(LIBNAME)]
  152. private static extern IntPtr face_BasicFaceRecognizer_getEigenVectors_10(IntPtr nativeObj);
  153. // C++: Mat cv::face::BasicFaceRecognizer::getMean()
  154. [DllImport(LIBNAME)]
  155. private static extern IntPtr face_BasicFaceRecognizer_getMean_10(IntPtr nativeObj);
  156. // native support for java finalize()
  157. [DllImport(LIBNAME)]
  158. private static extern void face_BasicFaceRecognizer_delete(IntPtr nativeObj);
  159. }
  160. }