FisherFaceRecognizer.cs 3.1 KB

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