GraphSegmentation.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 GraphSegmentation
  10. //javadoc: GraphSegmentation
  11. public class GraphSegmentation : 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_GraphSegmentation_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal GraphSegmentation (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new GraphSegmentation __fromPtr__ (IntPtr addr) { return new GraphSegmentation (addr); }
  34. //
  35. // C++: double cv::ximgproc::segmentation::GraphSegmentation::getSigma()
  36. //
  37. //javadoc: GraphSegmentation::getSigma()
  38. public double getSigma ()
  39. {
  40. ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. double retVal = ximgproc_GraphSegmentation_getSigma_10(nativeObj);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: float cv::ximgproc::segmentation::GraphSegmentation::getK()
  50. //
  51. //javadoc: GraphSegmentation::getK()
  52. public float getK ()
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. float retVal = ximgproc_GraphSegmentation_getK_10(nativeObj);
  57. return retVal;
  58. #else
  59. return -1;
  60. #endif
  61. }
  62. //
  63. // C++: int cv::ximgproc::segmentation::GraphSegmentation::getMinSize()
  64. //
  65. //javadoc: GraphSegmentation::getMinSize()
  66. public int getMinSize ()
  67. {
  68. ThrowIfDisposed ();
  69. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  70. int retVal = ximgproc_GraphSegmentation_getMinSize_10(nativeObj);
  71. return retVal;
  72. #else
  73. return -1;
  74. #endif
  75. }
  76. //
  77. // C++: void cv::ximgproc::segmentation::GraphSegmentation::processImage(Mat src, Mat& dst)
  78. //
  79. //javadoc: GraphSegmentation::processImage(src, dst)
  80. public void processImage (Mat src, Mat dst)
  81. {
  82. ThrowIfDisposed ();
  83. if (src != null) src.ThrowIfDisposed ();
  84. if (dst != null) dst.ThrowIfDisposed ();
  85. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  86. ximgproc_GraphSegmentation_processImage_10(nativeObj, src.nativeObj, dst.nativeObj);
  87. return;
  88. #else
  89. return;
  90. #endif
  91. }
  92. //
  93. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setK(float k)
  94. //
  95. //javadoc: GraphSegmentation::setK(k)
  96. public void setK (float k)
  97. {
  98. ThrowIfDisposed ();
  99. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  100. ximgproc_GraphSegmentation_setK_10(nativeObj, k);
  101. return;
  102. #else
  103. return;
  104. #endif
  105. }
  106. //
  107. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setMinSize(int min_size)
  108. //
  109. //javadoc: GraphSegmentation::setMinSize(min_size)
  110. public void setMinSize (int min_size)
  111. {
  112. ThrowIfDisposed ();
  113. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  114. ximgproc_GraphSegmentation_setMinSize_10(nativeObj, min_size);
  115. return;
  116. #else
  117. return;
  118. #endif
  119. }
  120. //
  121. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setSigma(double sigma)
  122. //
  123. //javadoc: GraphSegmentation::setSigma(sigma)
  124. public void setSigma (double sigma)
  125. {
  126. ThrowIfDisposed ();
  127. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  128. ximgproc_GraphSegmentation_setSigma_10(nativeObj, sigma);
  129. return;
  130. #else
  131. return;
  132. #endif
  133. }
  134. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  135. const string LIBNAME = "__Internal";
  136. #else
  137. const string LIBNAME = "opencvforunity";
  138. #endif
  139. // C++: double cv::ximgproc::segmentation::GraphSegmentation::getSigma()
  140. [DllImport (LIBNAME)]
  141. private static extern double ximgproc_GraphSegmentation_getSigma_10 (IntPtr nativeObj);
  142. // C++: float cv::ximgproc::segmentation::GraphSegmentation::getK()
  143. [DllImport (LIBNAME)]
  144. private static extern float ximgproc_GraphSegmentation_getK_10 (IntPtr nativeObj);
  145. // C++: int cv::ximgproc::segmentation::GraphSegmentation::getMinSize()
  146. [DllImport (LIBNAME)]
  147. private static extern int ximgproc_GraphSegmentation_getMinSize_10 (IntPtr nativeObj);
  148. // C++: void cv::ximgproc::segmentation::GraphSegmentation::processImage(Mat src, Mat& dst)
  149. [DllImport (LIBNAME)]
  150. private static extern void ximgproc_GraphSegmentation_processImage_10 (IntPtr nativeObj, IntPtr src_nativeObj, IntPtr dst_nativeObj);
  151. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setK(float k)
  152. [DllImport (LIBNAME)]
  153. private static extern void ximgproc_GraphSegmentation_setK_10 (IntPtr nativeObj, float k);
  154. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setMinSize(int min_size)
  155. [DllImport (LIBNAME)]
  156. private static extern void ximgproc_GraphSegmentation_setMinSize_10 (IntPtr nativeObj, int min_size);
  157. // C++: void cv::ximgproc::segmentation::GraphSegmentation::setSigma(double sigma)
  158. [DllImport (LIBNAME)]
  159. private static extern void ximgproc_GraphSegmentation_setSigma_10 (IntPtr nativeObj, double sigma);
  160. // native support for java finalize()
  161. [DllImport (LIBNAME)]
  162. private static extern void ximgproc_GraphSegmentation_delete (IntPtr nativeObj);
  163. }
  164. }