123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.ImgprocModule
- {
-
-
- public class LineSegmentDetector : Algorithm
- {
- protected override void Dispose (bool disposing)
- {
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
- try {
- if (disposing) {
- }
- if (IsEnabledDispose) {
- if (nativeObj != IntPtr.Zero)
- imgproc_LineSegmentDetector_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose (disposing);
- }
- #else
- return;
- #endif
- }
- protected internal LineSegmentDetector (IntPtr addr) : base (addr) { }
-
- public static new LineSegmentDetector __fromPtr__ (IntPtr addr) { return new LineSegmentDetector (addr); }
-
-
-
-
- public int compareSegments (Size size, Mat lines1, Mat lines2, Mat _image)
- {
- ThrowIfDisposed ();
- if (lines1 != null) lines1.ThrowIfDisposed ();
- if (lines2 != null) lines2.ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = imgproc_LineSegmentDetector_compareSegments_10(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj, _image.nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
-
- public int compareSegments (Size size, Mat lines1, Mat lines2)
- {
- ThrowIfDisposed ();
- if (lines1 != null) lines1.ThrowIfDisposed ();
- if (lines2 != null) lines2.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- int retVal = imgproc_LineSegmentDetector_compareSegments_11(nativeObj, size.width, size.height, lines1.nativeObj, lines2.nativeObj);
-
- return retVal;
- #else
- return -1;
- #endif
- }
-
-
-
-
- public void detect (Mat _image, Mat _lines, Mat width, Mat prec, Mat nfa)
- {
- ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- if (_lines != null) _lines.ThrowIfDisposed ();
- if (width != null) width.ThrowIfDisposed ();
- if (prec != null) prec.ThrowIfDisposed ();
- if (nfa != null) nfa.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- imgproc_LineSegmentDetector_detect_10(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj, nfa.nativeObj);
-
- return;
- #else
- return;
- #endif
- }
-
- public void detect (Mat _image, Mat _lines, Mat width, Mat prec)
- {
- ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- if (_lines != null) _lines.ThrowIfDisposed ();
- if (width != null) width.ThrowIfDisposed ();
- if (prec != null) prec.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- imgproc_LineSegmentDetector_detect_11(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj, prec.nativeObj);
-
- return;
- #else
- return;
- #endif
- }
-
- public void detect (Mat _image, Mat _lines, Mat width)
- {
- ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- if (_lines != null) _lines.ThrowIfDisposed ();
- if (width != null) width.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- imgproc_LineSegmentDetector_detect_12(nativeObj, _image.nativeObj, _lines.nativeObj, width.nativeObj);
-
- return;
- #else
- return;
- #endif
- }
-
- public void detect (Mat _image, Mat _lines)
- {
- ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- if (_lines != null) _lines.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- imgproc_LineSegmentDetector_detect_13(nativeObj, _image.nativeObj, _lines.nativeObj);
-
- return;
- #else
- return;
- #endif
- }
-
-
-
-
- public void drawSegments (Mat _image, Mat lines)
- {
- ThrowIfDisposed ();
- if (_image != null) _image.ThrowIfDisposed ();
- if (lines != null) lines.ThrowIfDisposed ();
- #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
-
- imgproc_LineSegmentDetector_drawSegments_10(nativeObj, _image.nativeObj, lines.nativeObj);
-
- return;
- #else
- return;
- #endif
- }
- #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
- const string LIBNAME = "__Internal";
- #else
- const string LIBNAME = "opencvforunity";
- #endif
-
- [DllImport (LIBNAME)]
- private static extern int imgproc_LineSegmentDetector_compareSegments_10 (IntPtr nativeObj, double size_width, double size_height, IntPtr lines1_nativeObj, IntPtr lines2_nativeObj, IntPtr _image_nativeObj);
- [DllImport (LIBNAME)]
- private static extern int imgproc_LineSegmentDetector_compareSegments_11 (IntPtr nativeObj, double size_width, double size_height, IntPtr lines1_nativeObj, IntPtr lines2_nativeObj);
-
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_detect_10 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr _lines_nativeObj, IntPtr width_nativeObj, IntPtr prec_nativeObj, IntPtr nfa_nativeObj);
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_detect_11 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr _lines_nativeObj, IntPtr width_nativeObj, IntPtr prec_nativeObj);
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_detect_12 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr _lines_nativeObj, IntPtr width_nativeObj);
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_detect_13 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr _lines_nativeObj);
-
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_drawSegments_10 (IntPtr nativeObj, IntPtr _image_nativeObj, IntPtr lines_nativeObj);
-
- [DllImport (LIBNAME)]
- private static extern void imgproc_LineSegmentDetector_delete (IntPtr nativeObj);
- }
- }
|