FisherFaceRecognizer.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 FisherFaceRecognizer
  10. //javadoc: FisherFaceRecognizer
  11. public class FisherFaceRecognizer : BasicFaceRecognizer
  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_FisherFaceRecognizer_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal FisherFaceRecognizer (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new FisherFaceRecognizer __fromPtr__ (IntPtr addr) { return new FisherFaceRecognizer (addr); }
  34. //
  35. // C++: static Ptr_FisherFaceRecognizer cv::face::FisherFaceRecognizer::create(int num_components = 0, double threshold = DBL_MAX)
  36. //
  37. //javadoc: FisherFaceRecognizer::create(num_components, threshold)
  38. public static FisherFaceRecognizer create (int num_components, double threshold)
  39. {
  40. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  41. FisherFaceRecognizer retVal = FisherFaceRecognizer.__fromPtr__(face_FisherFaceRecognizer_create_10(num_components, threshold));
  42. return retVal;
  43. #else
  44. return null;
  45. #endif
  46. }
  47. //javadoc: FisherFaceRecognizer::create(num_components)
  48. public static FisherFaceRecognizer create (int num_components)
  49. {
  50. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  51. FisherFaceRecognizer retVal = FisherFaceRecognizer.__fromPtr__(face_FisherFaceRecognizer_create_11(num_components));
  52. return retVal;
  53. #else
  54. return null;
  55. #endif
  56. }
  57. //javadoc: FisherFaceRecognizer::create()
  58. public static FisherFaceRecognizer create ()
  59. {
  60. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  61. FisherFaceRecognizer retVal = FisherFaceRecognizer.__fromPtr__(face_FisherFaceRecognizer_create_12());
  62. return retVal;
  63. #else
  64. return null;
  65. #endif
  66. }
  67. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  68. const string LIBNAME = "__Internal";
  69. #else
  70. const string LIBNAME = "opencvforunity";
  71. #endif
  72. // C++: static Ptr_FisherFaceRecognizer cv::face::FisherFaceRecognizer::create(int num_components = 0, double threshold = DBL_MAX)
  73. [DllImport (LIBNAME)]
  74. private static extern IntPtr face_FisherFaceRecognizer_create_10 (int num_components, double threshold);
  75. [DllImport (LIBNAME)]
  76. private static extern IntPtr face_FisherFaceRecognizer_create_11 (int num_components);
  77. [DllImport (LIBNAME)]
  78. private static extern IntPtr face_FisherFaceRecognizer_create_12 ();
  79. // native support for java finalize()
  80. [DllImport (LIBNAME)]
  81. private static extern void face_FisherFaceRecognizer_delete (IntPtr nativeObj);
  82. }
  83. }