StructuredEdgeDetection.cs 7.8 KB

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