BackgroundSubtractorMOG.cs 6.6 KB

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