SelectiveSearchSegmentationStrategy.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 SelectiveSearchSegmentationStrategy
  10. //javadoc: SelectiveSearchSegmentationStrategy
  11. public class SelectiveSearchSegmentationStrategy : 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_SelectiveSearchSegmentationStrategy_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal SelectiveSearchSegmentationStrategy (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new SelectiveSearchSegmentationStrategy __fromPtr__ (IntPtr addr) { return new SelectiveSearchSegmentationStrategy (addr); }
  34. //
  35. // C++: float cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::get(int r1, int r2)
  36. //
  37. //javadoc: SelectiveSearchSegmentationStrategy::get(r1, r2)
  38. public float get (int r1, int r2)
  39. {
  40. ThrowIfDisposed ();
  41. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  42. float retVal = ximgproc_SelectiveSearchSegmentationStrategy_get_10(nativeObj, r1, r2);
  43. return retVal;
  44. #else
  45. return -1;
  46. #endif
  47. }
  48. //
  49. // C++: void cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::merge(int r1, int r2)
  50. //
  51. //javadoc: SelectiveSearchSegmentationStrategy::merge(r1, r2)
  52. public void merge (int r1, int r2)
  53. {
  54. ThrowIfDisposed ();
  55. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  56. ximgproc_SelectiveSearchSegmentationStrategy_merge_10(nativeObj, r1, r2);
  57. return;
  58. #else
  59. return;
  60. #endif
  61. }
  62. //
  63. // C++: void cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::setImage(Mat img, Mat regions, Mat sizes, int image_id = -1)
  64. //
  65. //javadoc: SelectiveSearchSegmentationStrategy::setImage(img, regions, sizes, image_id)
  66. public void setImage (Mat img, Mat regions, Mat sizes, int image_id)
  67. {
  68. ThrowIfDisposed ();
  69. if (img != null) img.ThrowIfDisposed ();
  70. if (regions != null) regions.ThrowIfDisposed ();
  71. if (sizes != null) sizes.ThrowIfDisposed ();
  72. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  73. ximgproc_SelectiveSearchSegmentationStrategy_setImage_10(nativeObj, img.nativeObj, regions.nativeObj, sizes.nativeObj, image_id);
  74. return;
  75. #else
  76. return;
  77. #endif
  78. }
  79. //javadoc: SelectiveSearchSegmentationStrategy::setImage(img, regions, sizes)
  80. public void setImage (Mat img, Mat regions, Mat sizes)
  81. {
  82. ThrowIfDisposed ();
  83. if (img != null) img.ThrowIfDisposed ();
  84. if (regions != null) regions.ThrowIfDisposed ();
  85. if (sizes != null) sizes.ThrowIfDisposed ();
  86. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  87. ximgproc_SelectiveSearchSegmentationStrategy_setImage_11(nativeObj, img.nativeObj, regions.nativeObj, sizes.nativeObj);
  88. return;
  89. #else
  90. return;
  91. #endif
  92. }
  93. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  94. const string LIBNAME = "__Internal";
  95. #else
  96. const string LIBNAME = "opencvforunity";
  97. #endif
  98. // C++: float cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::get(int r1, int r2)
  99. [DllImport (LIBNAME)]
  100. private static extern float ximgproc_SelectiveSearchSegmentationStrategy_get_10 (IntPtr nativeObj, int r1, int r2);
  101. // C++: void cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::merge(int r1, int r2)
  102. [DllImport (LIBNAME)]
  103. private static extern void ximgproc_SelectiveSearchSegmentationStrategy_merge_10 (IntPtr nativeObj, int r1, int r2);
  104. // C++: void cv::ximgproc::segmentation::SelectiveSearchSegmentationStrategy::setImage(Mat img, Mat regions, Mat sizes, int image_id = -1)
  105. [DllImport (LIBNAME)]
  106. private static extern void ximgproc_SelectiveSearchSegmentationStrategy_setImage_10 (IntPtr nativeObj, IntPtr img_nativeObj, IntPtr regions_nativeObj, IntPtr sizes_nativeObj, int image_id);
  107. [DllImport (LIBNAME)]
  108. private static extern void ximgproc_SelectiveSearchSegmentationStrategy_setImage_11 (IntPtr nativeObj, IntPtr img_nativeObj, IntPtr regions_nativeObj, IntPtr sizes_nativeObj);
  109. // native support for java finalize()
  110. [DllImport (LIBNAME)]
  111. private static extern void ximgproc_SelectiveSearchSegmentationStrategy_delete (IntPtr nativeObj);
  112. }
  113. }