FastLineDetector.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 FastLineDetector
  10. //javadoc: FastLineDetector
  11. public class FastLineDetector : 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_FastLineDetector_delete(nativeObj);
  22. nativeObj = IntPtr.Zero;
  23. }
  24. } finally {
  25. base.Dispose (disposing);
  26. }
  27. #else
  28. return;
  29. #endif
  30. }
  31. protected internal FastLineDetector (IntPtr addr) : base (addr) { }
  32. // internal usage only
  33. public static new FastLineDetector __fromPtr__ (IntPtr addr) { return new FastLineDetector (addr); }
  34. //
  35. // C++: void cv::ximgproc::FastLineDetector::detect(Mat _image, Mat& _lines)
  36. //
  37. //javadoc: FastLineDetector::detect(_image, _lines)
  38. public void detect (Mat _image, Mat _lines)
  39. {
  40. ThrowIfDisposed ();
  41. if (_image != null) _image.ThrowIfDisposed ();
  42. if (_lines != null) _lines.ThrowIfDisposed ();
  43. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  44. ximgproc_FastLineDetector_detect_10(nativeObj, _image.nativeObj, _lines.nativeObj);
  45. return;
  46. #else
  47. return;
  48. #endif
  49. }
  50. //
  51. // C++: void cv::ximgproc::FastLineDetector::drawSegments(Mat& _image, Mat lines, bool draw_arrow = false)
  52. //
  53. //javadoc: FastLineDetector::drawSegments(_image, lines, draw_arrow)
  54. public void drawSegments (Mat _image, Mat lines, bool draw_arrow)
  55. {
  56. ThrowIfDisposed ();
  57. if (_image != null) _image.ThrowIfDisposed ();
  58. if (lines != null) lines.ThrowIfDisposed ();
  59. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  60. ximgproc_FastLineDetector_drawSegments_10(nativeObj, _image.nativeObj, lines.nativeObj, draw_arrow);
  61. return;
  62. #else
  63. return;
  64. #endif
  65. }
  66. //javadoc: FastLineDetector::drawSegments(_image, lines)
  67. public void drawSegments (Mat _image, Mat lines)
  68. {
  69. ThrowIfDisposed ();
  70. if (_image != null) _image.ThrowIfDisposed ();
  71. if (lines != null) lines.ThrowIfDisposed ();
  72. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  73. ximgproc_FastLineDetector_drawSegments_11(nativeObj, _image.nativeObj, lines.nativeObj);
  74. return;
  75. #else
  76. return;
  77. #endif
  78. }
  79. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  80. const string LIBNAME = "__Internal";
  81. #else
  82. const string LIBNAME = "opencvforunity";
  83. #endif
  84. // C++: void cv::ximgproc::FastLineDetector::detect(Mat _image, Mat& _lines)
  85. [DllImport (LIBNAME)]
  86. private static extern void ximgproc_FastLineDetector_detect_10 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr _lines_nativeObj);
  87. // C++: void cv::ximgproc::FastLineDetector::drawSegments(Mat& _image, Mat lines, bool draw_arrow = false)
  88. [DllImport (LIBNAME)]
  89. private static extern void ximgproc_FastLineDetector_drawSegments_10 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr lines_nativeObj, bool draw_arrow);
  90. [DllImport (LIBNAME)]
  91. private static extern void ximgproc_FastLineDetector_drawSegments_11 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr lines_nativeObj);
  92. // native support for java finalize()
  93. [DllImport (LIBNAME)]
  94. private static extern void ximgproc_FastLineDetector_delete (IntPtr nativeObj);
  95. }
  96. }