LUCID.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using OpenCVForUnity.CoreModule;
  2. using OpenCVForUnity.Features2dModule;
  3. using OpenCVForUnity.UtilsModule;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.InteropServices;
  7. namespace OpenCVForUnity.Xfeatures2dModule
  8. {
  9. // C++: class LUCID
  10. /**
  11. * Class implementing the locally uniform comparison image descriptor, described in CITE: LUCID
  12. *
  13. * An image descriptor that can be computed very fast, while being
  14. * about as robust as, for example, SURF or BRIEF.
  15. *
  16. * <b>Note:</b> It requires a color image as input.
  17. */
  18. public class LUCID : Feature2D
  19. {
  20. protected override void Dispose(bool disposing)
  21. {
  22. try
  23. {
  24. if (disposing)
  25. {
  26. }
  27. if (IsEnabledDispose)
  28. {
  29. if (nativeObj != IntPtr.Zero)
  30. xfeatures2d_LUCID_delete(nativeObj);
  31. nativeObj = IntPtr.Zero;
  32. }
  33. }
  34. finally
  35. {
  36. base.Dispose(disposing);
  37. }
  38. }
  39. protected internal LUCID(IntPtr addr) : base(addr) { }
  40. // internal usage only
  41. public static new LUCID __fromPtr__(IntPtr addr) { return new LUCID(addr); }
  42. //
  43. // C++: static Ptr_LUCID cv::xfeatures2d::LUCID::create(int lucid_kernel = 1, int blur_kernel = 2)
  44. //
  45. /**
  46. * param lucid_kernel kernel for descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth
  47. * param blur_kernel kernel for blurring image prior to descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth
  48. * return automatically generated
  49. */
  50. public static LUCID create(int lucid_kernel, int blur_kernel)
  51. {
  52. return LUCID.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_LUCID_create_10(lucid_kernel, blur_kernel)));
  53. }
  54. /**
  55. * param lucid_kernel kernel for descriptor construction, where 1=3x3, 2=5x5, 3=7x7 and so forth
  56. * return automatically generated
  57. */
  58. public static LUCID create(int lucid_kernel)
  59. {
  60. return LUCID.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_LUCID_create_11(lucid_kernel)));
  61. }
  62. /**
  63. * return automatically generated
  64. */
  65. public static LUCID create()
  66. {
  67. return LUCID.__fromPtr__(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_LUCID_create_12()));
  68. }
  69. //
  70. // C++: void cv::xfeatures2d::LUCID::setLucidKernel(int lucid_kernel)
  71. //
  72. public void setLucidKernel(int lucid_kernel)
  73. {
  74. ThrowIfDisposed();
  75. xfeatures2d_LUCID_setLucidKernel_10(nativeObj, lucid_kernel);
  76. }
  77. //
  78. // C++: int cv::xfeatures2d::LUCID::getLucidKernel()
  79. //
  80. public int getLucidKernel()
  81. {
  82. ThrowIfDisposed();
  83. return xfeatures2d_LUCID_getLucidKernel_10(nativeObj);
  84. }
  85. //
  86. // C++: void cv::xfeatures2d::LUCID::setBlurKernel(int blur_kernel)
  87. //
  88. public void setBlurKernel(int blur_kernel)
  89. {
  90. ThrowIfDisposed();
  91. xfeatures2d_LUCID_setBlurKernel_10(nativeObj, blur_kernel);
  92. }
  93. //
  94. // C++: int cv::xfeatures2d::LUCID::getBlurKernel()
  95. //
  96. public int getBlurKernel()
  97. {
  98. ThrowIfDisposed();
  99. return xfeatures2d_LUCID_getBlurKernel_10(nativeObj);
  100. }
  101. //
  102. // C++: String cv::xfeatures2d::LUCID::getDefaultName()
  103. //
  104. public override string getDefaultName()
  105. {
  106. ThrowIfDisposed();
  107. string retVal = Marshal.PtrToStringAnsi(DisposableObject.ThrowIfNullIntPtr(xfeatures2d_LUCID_getDefaultName_10(nativeObj)));
  108. return retVal;
  109. }
  110. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  111. const string LIBNAME = "__Internal";
  112. #else
  113. const string LIBNAME = "opencvforunity";
  114. #endif
  115. // C++: static Ptr_LUCID cv::xfeatures2d::LUCID::create(int lucid_kernel = 1, int blur_kernel = 2)
  116. [DllImport(LIBNAME)]
  117. private static extern IntPtr xfeatures2d_LUCID_create_10(int lucid_kernel, int blur_kernel);
  118. [DllImport(LIBNAME)]
  119. private static extern IntPtr xfeatures2d_LUCID_create_11(int lucid_kernel);
  120. [DllImport(LIBNAME)]
  121. private static extern IntPtr xfeatures2d_LUCID_create_12();
  122. // C++: void cv::xfeatures2d::LUCID::setLucidKernel(int lucid_kernel)
  123. [DllImport(LIBNAME)]
  124. private static extern void xfeatures2d_LUCID_setLucidKernel_10(IntPtr nativeObj, int lucid_kernel);
  125. // C++: int cv::xfeatures2d::LUCID::getLucidKernel()
  126. [DllImport(LIBNAME)]
  127. private static extern int xfeatures2d_LUCID_getLucidKernel_10(IntPtr nativeObj);
  128. // C++: void cv::xfeatures2d::LUCID::setBlurKernel(int blur_kernel)
  129. [DllImport(LIBNAME)]
  130. private static extern void xfeatures2d_LUCID_setBlurKernel_10(IntPtr nativeObj, int blur_kernel);
  131. // C++: int cv::xfeatures2d::LUCID::getBlurKernel()
  132. [DllImport(LIBNAME)]
  133. private static extern int xfeatures2d_LUCID_getBlurKernel_10(IntPtr nativeObj);
  134. // C++: String cv::xfeatures2d::LUCID::getDefaultName()
  135. [DllImport(LIBNAME)]
  136. private static extern IntPtr xfeatures2d_LUCID_getDefaultName_10(IntPtr nativeObj);
  137. // native support for java finalize()
  138. [DllImport(LIBNAME)]
  139. private static extern void xfeatures2d_LUCID_delete(IntPtr nativeObj);
  140. }
  141. }