GraphSegmentation.cs 5.8 KB

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