SuperpixelLSC.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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.XimgprocModule
  8. {
  9. // C++: class SuperpixelLSC
  10. //javadoc: SuperpixelLSC
  11. public class SuperpixelLSC : Algorithm
  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. ximgproc_SuperpixelLSC_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal SuperpixelLSC (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new SuperpixelLSC __fromPtr__ (IntPtr addr) { return new SuperpixelLSC (addr); }
  34. //
  35. // C++: int cv::ximgproc::SuperpixelLSC::getNumberOfSuperpixels()
  36. //
  37. //javadoc: SuperpixelLSC::getNumberOfSuperpixels()
  38. public int getNumberOfSuperpixels ()
  39. {
  40. ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. int retVal = ximgproc_SuperpixelLSC_getNumberOfSuperpixels_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: void cv::ximgproc::SuperpixelLSC::enforceLabelConnectivity(int min_element_size = 20)
  50. //
  51. //javadoc: SuperpixelLSC::enforceLabelConnectivity(min_element_size)
  52. public void enforceLabelConnectivity (int min_element_size)
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. ximgproc_SuperpixelLSC_enforceLabelConnectivity_10(nativeObj, min_element_size);
  57. return;
  58. #else
  59. return;
  60. #endif
  61. }
  62. //javadoc: SuperpixelLSC::enforceLabelConnectivity()
  63. public void enforceLabelConnectivity ()
  64. {
  65. ThrowIfDisposed ();
  66. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  67. ximgproc_SuperpixelLSC_enforceLabelConnectivity_11(nativeObj);
  68. return;
  69. #else
  70. return;
  71. #endif
  72. }
  73. //
  74. // C++: void cv::ximgproc::SuperpixelLSC::getLabelContourMask(Mat& image, bool thick_line = true)
  75. //
  76. //javadoc: SuperpixelLSC::getLabelContourMask(image, thick_line)
  77. public void getLabelContourMask (Mat image, bool thick_line)
  78. {
  79. ThrowIfDisposed ();
  80. if (image != null) image.ThrowIfDisposed ();
  81. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  82. ximgproc_SuperpixelLSC_getLabelContourMask_10(nativeObj, image.nativeObj, thick_line);
  83. return;
  84. #else
  85. return;
  86. #endif
  87. }
  88. //javadoc: SuperpixelLSC::getLabelContourMask(image)
  89. public void getLabelContourMask (Mat image)
  90. {
  91. ThrowIfDisposed ();
  92. if (image != null) image.ThrowIfDisposed ();
  93. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  94. ximgproc_SuperpixelLSC_getLabelContourMask_11(nativeObj, image.nativeObj);
  95. return;
  96. #else
  97. return;
  98. #endif
  99. }
  100. //
  101. // C++: void cv::ximgproc::SuperpixelLSC::getLabels(Mat& labels_out)
  102. //
  103. //javadoc: SuperpixelLSC::getLabels(labels_out)
  104. public void getLabels (Mat labels_out)
  105. {
  106. ThrowIfDisposed ();
  107. if (labels_out != null) labels_out.ThrowIfDisposed ();
  108. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  109. ximgproc_SuperpixelLSC_getLabels_10(nativeObj, labels_out.nativeObj);
  110. return;
  111. #else
  112. return;
  113. #endif
  114. }
  115. //
  116. // C++: void cv::ximgproc::SuperpixelLSC::iterate(int num_iterations = 10)
  117. //
  118. //javadoc: SuperpixelLSC::iterate(num_iterations)
  119. public void iterate (int num_iterations)
  120. {
  121. ThrowIfDisposed ();
  122. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  123. ximgproc_SuperpixelLSC_iterate_10(nativeObj, num_iterations);
  124. return;
  125. #else
  126. return;
  127. #endif
  128. }
  129. //javadoc: SuperpixelLSC::iterate()
  130. public void iterate ()
  131. {
  132. ThrowIfDisposed ();
  133. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  134. ximgproc_SuperpixelLSC_iterate_11(nativeObj);
  135. return;
  136. #else
  137. return;
  138. #endif
  139. }
  140. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  141. const string LIBNAME = "__Internal";
  142. #else
  143. const string LIBNAME = "opencvforunity";
  144. #endif
  145. // C++: int cv::ximgproc::SuperpixelLSC::getNumberOfSuperpixels()
  146. [DllImport (LIBNAME)]
  147. private static extern int ximgproc_SuperpixelLSC_getNumberOfSuperpixels_10 (IntPtr nativeObj);
  148. // C++: void cv::ximgproc::SuperpixelLSC::enforceLabelConnectivity(int min_element_size = 20)
  149. [DllImport (LIBNAME)]
  150. private static extern void ximgproc_SuperpixelLSC_enforceLabelConnectivity_10 (IntPtr nativeObj, int min_element_size);
  151. [DllImport (LIBNAME)]
  152. private static extern void ximgproc_SuperpixelLSC_enforceLabelConnectivity_11 (IntPtr nativeObj);
  153. // C++: void cv::ximgproc::SuperpixelLSC::getLabelContourMask(Mat& image, bool thick_line = true)
  154. [DllImport (LIBNAME)]
  155. private static extern void ximgproc_SuperpixelLSC_getLabelContourMask_10 (IntPtr nativeObj, IntPtr image_nativeObj, bool thick_line);
  156. [DllImport (LIBNAME)]
  157. private static extern void ximgproc_SuperpixelLSC_getLabelContourMask_11 (IntPtr nativeObj, IntPtr image_nativeObj);
  158. // C++: void cv::ximgproc::SuperpixelLSC::getLabels(Mat& labels_out)
  159. [DllImport (LIBNAME)]
  160. private static extern void ximgproc_SuperpixelLSC_getLabels_10 (IntPtr nativeObj, IntPtr labels_out_nativeObj);
  161. // C++: void cv::ximgproc::SuperpixelLSC::iterate(int num_iterations = 10)
  162. [DllImport (LIBNAME)]
  163. private static extern void ximgproc_SuperpixelLSC_iterate_10 (IntPtr nativeObj, int num_iterations);
  164. [DllImport (LIBNAME)]
  165. private static extern void ximgproc_SuperpixelLSC_iterate_11 (IntPtr nativeObj);
  166. // native support for java finalize()
  167. [DllImport (LIBNAME)]
  168. private static extern void ximgproc_SuperpixelLSC_delete (IntPtr nativeObj);
  169. }
  170. }