StructuredEdgeDetection.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 StructuredEdgeDetection
  10. //javadoc: StructuredEdgeDetection
  11. public class StructuredEdgeDetection : 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_StructuredEdgeDetection_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal StructuredEdgeDetection (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new StructuredEdgeDetection __fromPtr__ (IntPtr addr) { return new StructuredEdgeDetection (addr); }
  34. //
  35. // C++: void cv::ximgproc::StructuredEdgeDetection::computeOrientation(Mat _src, Mat& _dst)
  36. //
  37. //javadoc: StructuredEdgeDetection::computeOrientation(_src, _dst)
  38. public void computeOrientation (Mat _src, Mat _dst)
  39. {
  40. ThrowIfDisposed ();
  41. if (_src != null) _src.ThrowIfDisposed ();
  42. if (_dst != null) _dst.ThrowIfDisposed ();
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. ximgproc_StructuredEdgeDetection_computeOrientation_10(nativeObj, _src.nativeObj, _dst.nativeObj);
  45. return;
  46. #else
  47. return;
  48. #endif
  49. }
  50. //
  51. // C++: void cv::ximgproc::StructuredEdgeDetection::detectEdges(Mat _src, Mat& _dst)
  52. //
  53. //javadoc: StructuredEdgeDetection::detectEdges(_src, _dst)
  54. public void detectEdges (Mat _src, Mat _dst)
  55. {
  56. ThrowIfDisposed ();
  57. if (_src != null) _src.ThrowIfDisposed ();
  58. if (_dst != null) _dst.ThrowIfDisposed ();
  59. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  60. ximgproc_StructuredEdgeDetection_detectEdges_10(nativeObj, _src.nativeObj, _dst.nativeObj);
  61. return;
  62. #else
  63. return;
  64. #endif
  65. }
  66. //
  67. // C++: void cv::ximgproc::StructuredEdgeDetection::edgesNms(Mat edge_image, Mat orientation_image, Mat& _dst, int r = 2, int s = 0, float m = 1, bool isParallel = true)
  68. //
  69. //javadoc: StructuredEdgeDetection::edgesNms(edge_image, orientation_image, _dst, r, s, m, isParallel)
  70. public void edgesNms (Mat edge_image, Mat orientation_image, Mat _dst, int r, int s, float m, bool isParallel)
  71. {
  72. ThrowIfDisposed ();
  73. if (edge_image != null) edge_image.ThrowIfDisposed ();
  74. if (orientation_image != null) orientation_image.ThrowIfDisposed ();
  75. if (_dst != null) _dst.ThrowIfDisposed ();
  76. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  77. ximgproc_StructuredEdgeDetection_edgesNms_10(nativeObj, edge_image.nativeObj, orientation_image.nativeObj, _dst.nativeObj, r, s, m, isParallel);
  78. return;
  79. #else
  80. return;
  81. #endif
  82. }
  83. //javadoc: StructuredEdgeDetection::edgesNms(edge_image, orientation_image, _dst, r, s, m)
  84. public void edgesNms (Mat edge_image, Mat orientation_image, Mat _dst, int r, int s, float m)
  85. {
  86. ThrowIfDisposed ();
  87. if (edge_image != null) edge_image.ThrowIfDisposed ();
  88. if (orientation_image != null) orientation_image.ThrowIfDisposed ();
  89. if (_dst != null) _dst.ThrowIfDisposed ();
  90. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  91. ximgproc_StructuredEdgeDetection_edgesNms_11(nativeObj, edge_image.nativeObj, orientation_image.nativeObj, _dst.nativeObj, r, s, m);
  92. return;
  93. #else
  94. return;
  95. #endif
  96. }
  97. //javadoc: StructuredEdgeDetection::edgesNms(edge_image, orientation_image, _dst, r, s)
  98. public void edgesNms (Mat edge_image, Mat orientation_image, Mat _dst, int r, int s)
  99. {
  100. ThrowIfDisposed ();
  101. if (edge_image != null) edge_image.ThrowIfDisposed ();
  102. if (orientation_image != null) orientation_image.ThrowIfDisposed ();
  103. if (_dst != null) _dst.ThrowIfDisposed ();
  104. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  105. ximgproc_StructuredEdgeDetection_edgesNms_12(nativeObj, edge_image.nativeObj, orientation_image.nativeObj, _dst.nativeObj, r, s);
  106. return;
  107. #else
  108. return;
  109. #endif
  110. }
  111. //javadoc: StructuredEdgeDetection::edgesNms(edge_image, orientation_image, _dst, r)
  112. public void edgesNms (Mat edge_image, Mat orientation_image, Mat _dst, int r)
  113. {
  114. ThrowIfDisposed ();
  115. if (edge_image != null) edge_image.ThrowIfDisposed ();
  116. if (orientation_image != null) orientation_image.ThrowIfDisposed ();
  117. if (_dst != null) _dst.ThrowIfDisposed ();
  118. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  119. ximgproc_StructuredEdgeDetection_edgesNms_13(nativeObj, edge_image.nativeObj, orientation_image.nativeObj, _dst.nativeObj, r);
  120. return;
  121. #else
  122. return;
  123. #endif
  124. }
  125. //javadoc: StructuredEdgeDetection::edgesNms(edge_image, orientation_image, _dst)
  126. public void edgesNms (Mat edge_image, Mat orientation_image, Mat _dst)
  127. {
  128. ThrowIfDisposed ();
  129. if (edge_image != null) edge_image.ThrowIfDisposed ();
  130. if (orientation_image != null) orientation_image.ThrowIfDisposed ();
  131. if (_dst != null) _dst.ThrowIfDisposed ();
  132. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  133. ximgproc_StructuredEdgeDetection_edgesNms_14(nativeObj, edge_image.nativeObj, orientation_image.nativeObj, _dst.nativeObj);
  134. return;
  135. #else
  136. return;
  137. #endif
  138. }
  139. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  140. const string LIBNAME = "__Internal";
  141. #else
  142. const string LIBNAME = "opencvforunity";
  143. #endif
  144. // C++: void cv::ximgproc::StructuredEdgeDetection::computeOrientation(Mat _src, Mat& _dst)
  145. [DllImport (LIBNAME)]
  146. private static extern void ximgproc_StructuredEdgeDetection_computeOrientation_10 (IntPtr nativeObj, IntPtr _src_nativeObj, IntPtr _dst_nativeObj);
  147. // C++: void cv::ximgproc::StructuredEdgeDetection::detectEdges(Mat _src, Mat& _dst)
  148. [DllImport (LIBNAME)]
  149. private static extern void ximgproc_StructuredEdgeDetection_detectEdges_10 (IntPtr nativeObj, IntPtr _src_nativeObj, IntPtr _dst_nativeObj);
  150. // C++: void cv::ximgproc::StructuredEdgeDetection::edgesNms(Mat edge_image, Mat orientation_image, Mat& _dst, int r = 2, int s = 0, float m = 1, bool isParallel = true)
  151. [DllImport (LIBNAME)]
  152. private static extern void ximgproc_StructuredEdgeDetection_edgesNms_10 (IntPtr nativeObj, IntPtr edge_image_nativeObj, IntPtr orientation_image_nativeObj, IntPtr _dst_nativeObj, int r, int s, float m, bool isParallel);
  153. [DllImport (LIBNAME)]
  154. private static extern void ximgproc_StructuredEdgeDetection_edgesNms_11 (IntPtr nativeObj, IntPtr edge_image_nativeObj, IntPtr orientation_image_nativeObj, IntPtr _dst_nativeObj, int r, int s, float m);
  155. [DllImport (LIBNAME)]
  156. private static extern void ximgproc_StructuredEdgeDetection_edgesNms_12 (IntPtr nativeObj, IntPtr edge_image_nativeObj, IntPtr orientation_image_nativeObj, IntPtr _dst_nativeObj, int r, int s);
  157. [DllImport (LIBNAME)]
  158. private static extern void ximgproc_StructuredEdgeDetection_edgesNms_13 (IntPtr nativeObj, IntPtr edge_image_nativeObj, IntPtr orientation_image_nativeObj, IntPtr _dst_nativeObj, int r);
  159. [DllImport (LIBNAME)]
  160. private static extern void ximgproc_StructuredEdgeDetection_edgesNms_14 (IntPtr nativeObj, IntPtr edge_image_nativeObj, IntPtr orientation_image_nativeObj, IntPtr _dst_nativeObj);
  161. // native support for java finalize()
  162. [DllImport (LIBNAME)]
  163. private static extern void ximgproc_StructuredEdgeDetection_delete (IntPtr nativeObj);
  164. }
  165. }