BackgroundSubtractorMOG.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. 
  2. using OpenCVForUnity.CoreModule;
  3. using OpenCVForUnity.VideoModule;
  4. using OpenCVForUnity.UtilsModule;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Runtime.InteropServices;
  8. namespace OpenCVForUnity.BgsegmModule
  9. {
  10. // C++: class BackgroundSubtractorMOG
  11. //javadoc: BackgroundSubtractorMOG
  12. public class BackgroundSubtractorMOG : BackgroundSubtractor
  13. {
  14. protected override void Dispose (bool disposing)
  15. {
  16. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  17. try {
  18. if (disposing) {
  19. }
  20. if (IsEnabledDispose) {
  21. if (nativeObj != IntPtr.Zero)
  22. bgsegm_BackgroundSubtractorMOG_delete(nativeObj);
  23. nativeObj = IntPtr.Zero;
  24. }
  25. } finally {
  26. base.Dispose (disposing);
  27. }
  28. #else
  29. return;
  30. #endif
  31. }
  32. protected internal BackgroundSubtractorMOG (IntPtr addr) : base (addr) { }
  33. // internal usage only
  34. public static new BackgroundSubtractorMOG __fromPtr__ (IntPtr addr) { return new BackgroundSubtractorMOG (addr); }
  35. //
  36. // C++: double cv::bgsegm::BackgroundSubtractorMOG::getBackgroundRatio()
  37. //
  38. //javadoc: BackgroundSubtractorMOG::getBackgroundRatio()
  39. public double getBackgroundRatio ()
  40. {
  41. ThrowIfDisposed ();
  42. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  43. double retVal = bgsegm_BackgroundSubtractorMOG_getBackgroundRatio_10(nativeObj);
  44. return retVal;
  45. #else
  46. return -1;
  47. #endif
  48. }
  49. //
  50. // C++: double cv::bgsegm::BackgroundSubtractorMOG::getNoiseSigma()
  51. //
  52. //javadoc: BackgroundSubtractorMOG::getNoiseSigma()
  53. public double getNoiseSigma ()
  54. {
  55. ThrowIfDisposed ();
  56. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  57. double retVal = bgsegm_BackgroundSubtractorMOG_getNoiseSigma_10(nativeObj);
  58. return retVal;
  59. #else
  60. return -1;
  61. #endif
  62. }
  63. //
  64. // C++: int cv::bgsegm::BackgroundSubtractorMOG::getHistory()
  65. //
  66. //javadoc: BackgroundSubtractorMOG::getHistory()
  67. public int getHistory ()
  68. {
  69. ThrowIfDisposed ();
  70. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  71. int retVal = bgsegm_BackgroundSubtractorMOG_getHistory_10(nativeObj);
  72. return retVal;
  73. #else
  74. return -1;
  75. #endif
  76. }
  77. //
  78. // C++: int cv::bgsegm::BackgroundSubtractorMOG::getNMixtures()
  79. //
  80. //javadoc: BackgroundSubtractorMOG::getNMixtures()
  81. public int getNMixtures ()
  82. {
  83. ThrowIfDisposed ();
  84. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  85. int retVal = bgsegm_BackgroundSubtractorMOG_getNMixtures_10(nativeObj);
  86. return retVal;
  87. #else
  88. return -1;
  89. #endif
  90. }
  91. //
  92. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setBackgroundRatio(double backgroundRatio)
  93. //
  94. //javadoc: BackgroundSubtractorMOG::setBackgroundRatio(backgroundRatio)
  95. public void setBackgroundRatio (double backgroundRatio)
  96. {
  97. ThrowIfDisposed ();
  98. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  99. bgsegm_BackgroundSubtractorMOG_setBackgroundRatio_10(nativeObj, backgroundRatio);
  100. return;
  101. #else
  102. return;
  103. #endif
  104. }
  105. //
  106. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setHistory(int nframes)
  107. //
  108. //javadoc: BackgroundSubtractorMOG::setHistory(nframes)
  109. public void setHistory (int nframes)
  110. {
  111. ThrowIfDisposed ();
  112. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  113. bgsegm_BackgroundSubtractorMOG_setHistory_10(nativeObj, nframes);
  114. return;
  115. #else
  116. return;
  117. #endif
  118. }
  119. //
  120. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setNMixtures(int nmix)
  121. //
  122. //javadoc: BackgroundSubtractorMOG::setNMixtures(nmix)
  123. public void setNMixtures (int nmix)
  124. {
  125. ThrowIfDisposed ();
  126. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  127. bgsegm_BackgroundSubtractorMOG_setNMixtures_10(nativeObj, nmix);
  128. return;
  129. #else
  130. return;
  131. #endif
  132. }
  133. //
  134. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setNoiseSigma(double noiseSigma)
  135. //
  136. //javadoc: BackgroundSubtractorMOG::setNoiseSigma(noiseSigma)
  137. public void setNoiseSigma (double noiseSigma)
  138. {
  139. ThrowIfDisposed ();
  140. #if ((UNITY_ANDROID || UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR) || UNITY_5 || UNITY_5_3_OR_NEWER
  141. bgsegm_BackgroundSubtractorMOG_setNoiseSigma_10(nativeObj, noiseSigma);
  142. return;
  143. #else
  144. return;
  145. #endif
  146. }
  147. #if (UNITY_IOS || UNITY_WEBGL) && !UNITY_EDITOR
  148. const string LIBNAME = "__Internal";
  149. #else
  150. const string LIBNAME = "opencvforunity";
  151. #endif
  152. // C++: double cv::bgsegm::BackgroundSubtractorMOG::getBackgroundRatio()
  153. [DllImport (LIBNAME)]
  154. private static extern double bgsegm_BackgroundSubtractorMOG_getBackgroundRatio_10 (IntPtr nativeObj);
  155. // C++: double cv::bgsegm::BackgroundSubtractorMOG::getNoiseSigma()
  156. [DllImport (LIBNAME)]
  157. private static extern double bgsegm_BackgroundSubtractorMOG_getNoiseSigma_10 (IntPtr nativeObj);
  158. // C++: int cv::bgsegm::BackgroundSubtractorMOG::getHistory()
  159. [DllImport (LIBNAME)]
  160. private static extern int bgsegm_BackgroundSubtractorMOG_getHistory_10 (IntPtr nativeObj);
  161. // C++: int cv::bgsegm::BackgroundSubtractorMOG::getNMixtures()
  162. [DllImport (LIBNAME)]
  163. private static extern int bgsegm_BackgroundSubtractorMOG_getNMixtures_10 (IntPtr nativeObj);
  164. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setBackgroundRatio(double backgroundRatio)
  165. [DllImport (LIBNAME)]
  166. private static extern void bgsegm_BackgroundSubtractorMOG_setBackgroundRatio_10 (IntPtr nativeObj, double backgroundRatio);
  167. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setHistory(int nframes)
  168. [DllImport (LIBNAME)]
  169. private static extern void bgsegm_BackgroundSubtractorMOG_setHistory_10 (IntPtr nativeObj, int nframes);
  170. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setNMixtures(int nmix)
  171. [DllImport (LIBNAME)]
  172. private static extern void bgsegm_BackgroundSubtractorMOG_setNMixtures_10 (IntPtr nativeObj, int nmix);
  173. // C++: void cv::bgsegm::BackgroundSubtractorMOG::setNoiseSigma(double noiseSigma)
  174. [DllImport (LIBNAME)]
  175. private static extern void bgsegm_BackgroundSubtractorMOG_setNoiseSigma_10 (IntPtr nativeObj, double noiseSigma);
  176. // native support for java finalize()
  177. [DllImport (LIBNAME)]
  178. private static extern void bgsegm_BackgroundSubtractorMOG_delete (IntPtr nativeObj);
  179. }
  180. }