FREAK.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.Features2dModule;
  4. using OpenCVForUnity.UtilsModule;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Runtime.InteropServices;
  8. namespace OpenCVForUnity.Xfeatures2dModule {
  9. // C++: class FREAK
  10. //javadoc: FREAK
  11. public class FREAK : Feature2D {
  12. protected override void Dispose(bool disposing) {
  13. #if (UNITY_ANDROID && !UNITY_EDITOR)
  14. try {
  15. if (disposing) {
  16. }
  17. if (IsEnabledDispose) {
  18. if (nativeObj != IntPtr.Zero)
  19. xfeatures2d_FREAK_delete(nativeObj);
  20. nativeObj = IntPtr.Zero;
  21. }
  22. } finally {
  23. base.Dispose(disposing);
  24. }
  25. #else
  26. return;
  27. #endif
  28. }
  29. protected internal FREAK(IntPtr addr) : base(addr) { }
  30. // internal usage only
  31. public static new FREAK __fromPtr__(IntPtr addr) { return new FREAK(addr); }
  32. //
  33. // C++: static Ptr_FREAK cv::xfeatures2d::FREAK::create(bool orientationNormalized = true, bool scaleNormalized = true, float patternScale = 22.0f, int nOctaves = 4, vector_int selectedPairs = std::vector<int>())
  34. //
  35. //javadoc: FREAK::create(orientationNormalized, scaleNormalized, patternScale, nOctaves, selectedPairs)
  36. public static FREAK create(bool orientationNormalized, bool scaleNormalized, float patternScale, int nOctaves, MatOfInt selectedPairs) {
  37. if (selectedPairs != null) selectedPairs.ThrowIfDisposed();
  38. #if (UNITY_ANDROID && !UNITY_EDITOR)
  39. Mat selectedPairs_mat = selectedPairs;
  40. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_10(orientationNormalized, scaleNormalized, patternScale, nOctaves, selectedPairs_mat.nativeObj));
  41. return retVal;
  42. #else
  43. return null;
  44. #endif
  45. }
  46. //javadoc: FREAK::create(orientationNormalized, scaleNormalized, patternScale, nOctaves)
  47. public static FREAK create(bool orientationNormalized, bool scaleNormalized, float patternScale, int nOctaves) {
  48. #if (UNITY_ANDROID && !UNITY_EDITOR)
  49. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_11(orientationNormalized, scaleNormalized, patternScale, nOctaves));
  50. return retVal;
  51. #else
  52. return null;
  53. #endif
  54. }
  55. //javadoc: FREAK::create(orientationNormalized, scaleNormalized, patternScale)
  56. public static FREAK create(bool orientationNormalized, bool scaleNormalized, float patternScale) {
  57. #if (UNITY_ANDROID && !UNITY_EDITOR)
  58. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_12(orientationNormalized, scaleNormalized, patternScale));
  59. return retVal;
  60. #else
  61. return null;
  62. #endif
  63. }
  64. //javadoc: FREAK::create(orientationNormalized, scaleNormalized)
  65. public static FREAK create(bool orientationNormalized, bool scaleNormalized) {
  66. #if (UNITY_ANDROID && !UNITY_EDITOR)
  67. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_13(orientationNormalized, scaleNormalized));
  68. return retVal;
  69. #else
  70. return null;
  71. #endif
  72. }
  73. //javadoc: FREAK::create(orientationNormalized)
  74. public static FREAK create(bool orientationNormalized) {
  75. #if (UNITY_ANDROID && !UNITY_EDITOR)
  76. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_14(orientationNormalized));
  77. return retVal;
  78. #else
  79. return null;
  80. #endif
  81. }
  82. //javadoc: FREAK::create()
  83. public static FREAK create() {
  84. #if (UNITY_ANDROID && !UNITY_EDITOR)
  85. FREAK retVal = FREAK.__fromPtr__(xfeatures2d_FREAK_create_15());
  86. return retVal;
  87. #else
  88. return null;
  89. #endif
  90. }
  91. #if (UNITY_ANDROID && !UNITY_EDITOR)
  92. const string LIBNAME = "opencvforunity";
  93. // C++: static Ptr_FREAK cv::xfeatures2d::FREAK::create(bool orientationNormalized = true, bool scaleNormalized = true, float patternScale = 22.0f, int nOctaves = 4, vector_int selectedPairs = std::vector<int>())
  94. [DllImport(LIBNAME)]
  95. private static extern IntPtr xfeatures2d_FREAK_create_10(bool orientationNormalized, bool scaleNormalized, float patternScale, int nOctaves, IntPtr selectedPairs_mat_nativeObj);
  96. [DllImport(LIBNAME)]
  97. private static extern IntPtr xfeatures2d_FREAK_create_11(bool orientationNormalized, bool scaleNormalized, float patternScale, int nOctaves);
  98. [DllImport(LIBNAME)]
  99. private static extern IntPtr xfeatures2d_FREAK_create_12(bool orientationNormalized, bool scaleNormalized, float patternScale);
  100. [DllImport(LIBNAME)]
  101. private static extern IntPtr xfeatures2d_FREAK_create_13(bool orientationNormalized, bool scaleNormalized);
  102. [DllImport(LIBNAME)]
  103. private static extern IntPtr xfeatures2d_FREAK_create_14(bool orientationNormalized);
  104. [DllImport(LIBNAME)]
  105. private static extern IntPtr xfeatures2d_FREAK_create_15();
  106. // native support for java finalize()
  107. [DllImport(LIBNAME)]
  108. private static extern void xfeatures2d_FREAK_delete(IntPtr nativeObj);
  109. #endif
  110. }
  111. }