SuperpixelSEEDS.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 SuperpixelSEEDS
  10. //javadoc: SuperpixelSEEDS
  11. public class SuperpixelSEEDS : 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_SuperpixelSEEDS_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal SuperpixelSEEDS (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new SuperpixelSEEDS __fromPtr__ (IntPtr addr) { return new SuperpixelSEEDS (addr); }
  34. //
  35. // C++: int cv::ximgproc::SuperpixelSEEDS::getNumberOfSuperpixels()
  36. //
  37. //javadoc: SuperpixelSEEDS::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_SuperpixelSEEDS_getNumberOfSuperpixels_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: void cv::ximgproc::SuperpixelSEEDS::getLabelContourMask(Mat& image, bool thick_line = false)
  50. //
  51. //javadoc: SuperpixelSEEDS::getLabelContourMask(image, thick_line)
  52. public void getLabelContourMask (Mat image, bool thick_line)
  53. {
  54. ThrowIfDisposed ();
  55. if (image != null) image.ThrowIfDisposed ();
  56. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  57. ximgproc_SuperpixelSEEDS_getLabelContourMask_10(nativeObj, image.nativeObj, thick_line);
  58. return;
  59. #else
  60. return;
  61. #endif
  62. }
  63. //javadoc: SuperpixelSEEDS::getLabelContourMask(image)
  64. public void getLabelContourMask (Mat image)
  65. {
  66. ThrowIfDisposed ();
  67. if (image != null) image.ThrowIfDisposed ();
  68. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  69. ximgproc_SuperpixelSEEDS_getLabelContourMask_11(nativeObj, image.nativeObj);
  70. return;
  71. #else
  72. return;
  73. #endif
  74. }
  75. //
  76. // C++: void cv::ximgproc::SuperpixelSEEDS::getLabels(Mat& labels_out)
  77. //
  78. //javadoc: SuperpixelSEEDS::getLabels(labels_out)
  79. public void getLabels (Mat labels_out)
  80. {
  81. ThrowIfDisposed ();
  82. if (labels_out != null) labels_out.ThrowIfDisposed ();
  83. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  84. ximgproc_SuperpixelSEEDS_getLabels_10(nativeObj, labels_out.nativeObj);
  85. return;
  86. #else
  87. return;
  88. #endif
  89. }
  90. //
  91. // C++: void cv::ximgproc::SuperpixelSEEDS::iterate(Mat img, int num_iterations = 4)
  92. //
  93. //javadoc: SuperpixelSEEDS::iterate(img, num_iterations)
  94. public void iterate (Mat img, int num_iterations)
  95. {
  96. ThrowIfDisposed ();
  97. if (img != null) img.ThrowIfDisposed ();
  98. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  99. ximgproc_SuperpixelSEEDS_iterate_10(nativeObj, img.nativeObj, num_iterations);
  100. return;
  101. #else
  102. return;
  103. #endif
  104. }
  105. //javadoc: SuperpixelSEEDS::iterate(img)
  106. public void iterate (Mat img)
  107. {
  108. ThrowIfDisposed ();
  109. if (img != null) img.ThrowIfDisposed ();
  110. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  111. ximgproc_SuperpixelSEEDS_iterate_11(nativeObj, img.nativeObj);
  112. return;
  113. #else
  114. return;
  115. #endif
  116. }
  117. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  118. const string LIBNAME = "__Internal";
  119. #else
  120. const string LIBNAME = "opencvforunity";
  121. #endif
  122. // C++: int cv::ximgproc::SuperpixelSEEDS::getNumberOfSuperpixels()
  123. [DllImport (LIBNAME)]
  124. private static extern int ximgproc_SuperpixelSEEDS_getNumberOfSuperpixels_10 (IntPtr nativeObj);
  125. // C++: void cv::ximgproc::SuperpixelSEEDS::getLabelContourMask(Mat& image, bool thick_line = false)
  126. [DllImport (LIBNAME)]
  127. private static extern void ximgproc_SuperpixelSEEDS_getLabelContourMask_10 (IntPtr nativeObj, IntPtr image_nativeObj, bool thick_line);
  128. [DllImport (LIBNAME)]
  129. private static extern void ximgproc_SuperpixelSEEDS_getLabelContourMask_11 (IntPtr nativeObj, IntPtr image_nativeObj);
  130. // C++: void cv::ximgproc::SuperpixelSEEDS::getLabels(Mat& labels_out)
  131. [DllImport (LIBNAME)]
  132. private static extern void ximgproc_SuperpixelSEEDS_getLabels_10 (IntPtr nativeObj, IntPtr labels_out_nativeObj);
  133. // C++: void cv::ximgproc::SuperpixelSEEDS::iterate(Mat img, int num_iterations = 4)
  134. [DllImport (LIBNAME)]
  135. private static extern void ximgproc_SuperpixelSEEDS_iterate_10 (IntPtr nativeObj, IntPtr img_nativeObj, int num_iterations);
  136. [DllImport (LIBNAME)]
  137. private static extern void ximgproc_SuperpixelSEEDS_iterate_11 (IntPtr nativeObj, IntPtr img_nativeObj);
  138. // native support for java finalize()
  139. [DllImport (LIBNAME)]
  140. private static extern void ximgproc_SuperpixelSEEDS_delete (IntPtr nativeObj);
  141. }
  142. }