BasicFaceRecognizer.cs 7.5 KB

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