FastLineDetector.cs 3.7 KB

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