123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using OpenCVForUnity.VideoModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.BgsegmModule
- {
- // C++: class BackgroundSubtractorGSOC
- /**
- * Implementation of the different yet better algorithm which is called GSOC, as it was implemented during GSOC and was not originated from any paper.
- *
- * This algorithm demonstrates better performance on CDNET 2014 dataset compared to other algorithms in OpenCV.
- */
- public class BackgroundSubtractorGSOC : BackgroundSubtractor
- {
- protected override void Dispose(bool disposing)
- {
- try
- {
- if (disposing)
- {
- }
- if (IsEnabledDispose)
- {
- if (nativeObj != IntPtr.Zero)
- bgsegm_BackgroundSubtractorGSOC_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
- protected internal BackgroundSubtractorGSOC(IntPtr addr) : base(addr) { }
- // internal usage only
- public static new BackgroundSubtractorGSOC __fromPtr__(IntPtr addr) { return new BackgroundSubtractorGSOC(addr); }
- //
- // C++: void cv::bgsegm::BackgroundSubtractorGSOC::apply(Mat image, Mat& fgmask, double learningRate = -1)
- //
- public override void apply(Mat image, Mat fgmask, double learningRate)
- {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- if (fgmask != null) fgmask.ThrowIfDisposed();
- bgsegm_BackgroundSubtractorGSOC_apply_10(nativeObj, image.nativeObj, fgmask.nativeObj, learningRate);
- }
- public override void apply(Mat image, Mat fgmask)
- {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- if (fgmask != null) fgmask.ThrowIfDisposed();
- bgsegm_BackgroundSubtractorGSOC_apply_11(nativeObj, image.nativeObj, fgmask.nativeObj);
- }
- //
- // C++: void cv::bgsegm::BackgroundSubtractorGSOC::getBackgroundImage(Mat& backgroundImage)
- //
- public override void getBackgroundImage(Mat backgroundImage)
- {
- ThrowIfDisposed();
- if (backgroundImage != null) backgroundImage.ThrowIfDisposed();
- bgsegm_BackgroundSubtractorGSOC_getBackgroundImage_10(nativeObj, backgroundImage.nativeObj);
- }
- #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
- const string LIBNAME = "__Internal";
- #else
- const string LIBNAME = "opencvforunity";
- #endif
- // C++: void cv::bgsegm::BackgroundSubtractorGSOC::apply(Mat image, Mat& fgmask, double learningRate = -1)
- [DllImport(LIBNAME)]
- private static extern void bgsegm_BackgroundSubtractorGSOC_apply_10(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr fgmask_nativeObj, double learningRate);
- [DllImport(LIBNAME)]
- private static extern void bgsegm_BackgroundSubtractorGSOC_apply_11(IntPtr nativeObj, IntPtr image_nativeObj, IntPtr fgmask_nativeObj);
- // C++: void cv::bgsegm::BackgroundSubtractorGSOC::getBackgroundImage(Mat& backgroundImage)
- [DllImport(LIBNAME)]
- private static extern void bgsegm_BackgroundSubtractorGSOC_getBackgroundImage_10(IntPtr nativeObj, IntPtr backgroundImage_nativeObj);
- // native support for java finalize()
- [DllImport(LIBNAME)]
- private static extern void bgsegm_BackgroundSubtractorGSOC_delete(IntPtr nativeObj);
- }
- }
|