BasicFaceRecognizer.cs 6.8 KB

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