BackgroundSubtractorMOG2.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. //
  2. // This file is auto-generated. Please don't modify it!
  3. //
  4. #pragma once
  5. #ifdef __cplusplus
  6. //#import "opencv.hpp"
  7. #import "opencv2/video.hpp"
  8. #import "opencv2/video/background_segm.hpp"
  9. #else
  10. #define CV_EXPORTS
  11. #endif
  12. #import <Foundation/Foundation.h>
  13. #import "BackgroundSubtractor.h"
  14. @class Mat;
  15. NS_ASSUME_NONNULL_BEGIN
  16. // C++: class BackgroundSubtractorMOG2
  17. /**
  18. * Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
  19. *
  20. * The class implements the Gaussian mixture model background subtraction described in CITE: Zivkovic2004
  21. * and CITE: Zivkovic2006 .
  22. *
  23. * Member of `Video`
  24. */
  25. CV_EXPORTS @interface BackgroundSubtractorMOG2 : BackgroundSubtractor
  26. #ifdef __cplusplus
  27. @property(readonly)cv::Ptr<cv::BackgroundSubtractorMOG2> nativePtrBackgroundSubtractorMOG2;
  28. #endif
  29. #ifdef __cplusplus
  30. - (instancetype)initWithNativePtr:(cv::Ptr<cv::BackgroundSubtractorMOG2>)nativePtr;
  31. + (instancetype)fromNative:(cv::Ptr<cv::BackgroundSubtractorMOG2>)nativePtr;
  32. #endif
  33. #pragma mark - Methods
  34. //
  35. // int cv::BackgroundSubtractorMOG2::getHistory()
  36. //
  37. /**
  38. * Returns the number of last frames that affect the background model
  39. */
  40. - (int)getHistory NS_SWIFT_NAME(getHistory());
  41. //
  42. // void cv::BackgroundSubtractorMOG2::setHistory(int history)
  43. //
  44. /**
  45. * Sets the number of last frames that affect the background model
  46. */
  47. - (void)setHistory:(int)history NS_SWIFT_NAME(setHistory(history:));
  48. //
  49. // int cv::BackgroundSubtractorMOG2::getNMixtures()
  50. //
  51. /**
  52. * Returns the number of gaussian components in the background model
  53. */
  54. - (int)getNMixtures NS_SWIFT_NAME(getNMixtures());
  55. //
  56. // void cv::BackgroundSubtractorMOG2::setNMixtures(int nmixtures)
  57. //
  58. /**
  59. * Sets the number of gaussian components in the background model.
  60. *
  61. * The model needs to be reinitalized to reserve memory.
  62. */
  63. - (void)setNMixtures:(int)nmixtures NS_SWIFT_NAME(setNMixtures(nmixtures:));
  64. //
  65. // double cv::BackgroundSubtractorMOG2::getBackgroundRatio()
  66. //
  67. /**
  68. * Returns the "background ratio" parameter of the algorithm
  69. *
  70. * If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
  71. * considered background and added to the model as a center of a new component. It corresponds to TB
  72. * parameter in the paper.
  73. */
  74. - (double)getBackgroundRatio NS_SWIFT_NAME(getBackgroundRatio());
  75. //
  76. // void cv::BackgroundSubtractorMOG2::setBackgroundRatio(double ratio)
  77. //
  78. /**
  79. * Sets the "background ratio" parameter of the algorithm
  80. */
  81. - (void)setBackgroundRatio:(double)ratio NS_SWIFT_NAME(setBackgroundRatio(ratio:));
  82. //
  83. // double cv::BackgroundSubtractorMOG2::getVarThreshold()
  84. //
  85. /**
  86. * Returns the variance threshold for the pixel-model match
  87. *
  88. * The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
  89. * the background model or not. Related to Cthr from the paper.
  90. */
  91. - (double)getVarThreshold NS_SWIFT_NAME(getVarThreshold());
  92. //
  93. // void cv::BackgroundSubtractorMOG2::setVarThreshold(double varThreshold)
  94. //
  95. /**
  96. * Sets the variance threshold for the pixel-model match
  97. */
  98. - (void)setVarThreshold:(double)varThreshold NS_SWIFT_NAME(setVarThreshold(varThreshold:));
  99. //
  100. // double cv::BackgroundSubtractorMOG2::getVarThresholdGen()
  101. //
  102. /**
  103. * Returns the variance threshold for the pixel-model match used for new mixture component generation
  104. *
  105. * Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
  106. * existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
  107. * is considered foreground or added as a new component. 3 sigma =\> Tg=3\*3=9 is default. A smaller Tg
  108. * value generates more components. A higher Tg value may result in a small number of components but
  109. * they can grow too large.
  110. */
  111. - (double)getVarThresholdGen NS_SWIFT_NAME(getVarThresholdGen());
  112. //
  113. // void cv::BackgroundSubtractorMOG2::setVarThresholdGen(double varThresholdGen)
  114. //
  115. /**
  116. * Sets the variance threshold for the pixel-model match used for new mixture component generation
  117. */
  118. - (void)setVarThresholdGen:(double)varThresholdGen NS_SWIFT_NAME(setVarThresholdGen(varThresholdGen:));
  119. //
  120. // double cv::BackgroundSubtractorMOG2::getVarInit()
  121. //
  122. /**
  123. * Returns the initial variance of each gaussian component
  124. */
  125. - (double)getVarInit NS_SWIFT_NAME(getVarInit());
  126. //
  127. // void cv::BackgroundSubtractorMOG2::setVarInit(double varInit)
  128. //
  129. /**
  130. * Sets the initial variance of each gaussian component
  131. */
  132. - (void)setVarInit:(double)varInit NS_SWIFT_NAME(setVarInit(varInit:));
  133. //
  134. // double cv::BackgroundSubtractorMOG2::getVarMin()
  135. //
  136. - (double)getVarMin NS_SWIFT_NAME(getVarMin());
  137. //
  138. // void cv::BackgroundSubtractorMOG2::setVarMin(double varMin)
  139. //
  140. - (void)setVarMin:(double)varMin NS_SWIFT_NAME(setVarMin(varMin:));
  141. //
  142. // double cv::BackgroundSubtractorMOG2::getVarMax()
  143. //
  144. - (double)getVarMax NS_SWIFT_NAME(getVarMax());
  145. //
  146. // void cv::BackgroundSubtractorMOG2::setVarMax(double varMax)
  147. //
  148. - (void)setVarMax:(double)varMax NS_SWIFT_NAME(setVarMax(varMax:));
  149. //
  150. // double cv::BackgroundSubtractorMOG2::getComplexityReductionThreshold()
  151. //
  152. /**
  153. * Returns the complexity reduction threshold
  154. *
  155. * This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
  156. * is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
  157. * standard Stauffer&Grimson algorithm.
  158. */
  159. - (double)getComplexityReductionThreshold NS_SWIFT_NAME(getComplexityReductionThreshold());
  160. //
  161. // void cv::BackgroundSubtractorMOG2::setComplexityReductionThreshold(double ct)
  162. //
  163. /**
  164. * Sets the complexity reduction threshold
  165. */
  166. - (void)setComplexityReductionThreshold:(double)ct NS_SWIFT_NAME(setComplexityReductionThreshold(ct:));
  167. //
  168. // bool cv::BackgroundSubtractorMOG2::getDetectShadows()
  169. //
  170. /**
  171. * Returns the shadow detection flag
  172. *
  173. * If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
  174. * details.
  175. */
  176. - (BOOL)getDetectShadows NS_SWIFT_NAME(getDetectShadows());
  177. //
  178. // void cv::BackgroundSubtractorMOG2::setDetectShadows(bool detectShadows)
  179. //
  180. /**
  181. * Enables or disables shadow detection
  182. */
  183. - (void)setDetectShadows:(BOOL)detectShadows NS_SWIFT_NAME(setDetectShadows(detectShadows:));
  184. //
  185. // int cv::BackgroundSubtractorMOG2::getShadowValue()
  186. //
  187. /**
  188. * Returns the shadow value
  189. *
  190. * Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
  191. * in the mask always means background, 255 means foreground.
  192. */
  193. - (int)getShadowValue NS_SWIFT_NAME(getShadowValue());
  194. //
  195. // void cv::BackgroundSubtractorMOG2::setShadowValue(int value)
  196. //
  197. /**
  198. * Sets the shadow value
  199. */
  200. - (void)setShadowValue:(int)value NS_SWIFT_NAME(setShadowValue(value:));
  201. //
  202. // double cv::BackgroundSubtractorMOG2::getShadowThreshold()
  203. //
  204. /**
  205. * Returns the shadow threshold
  206. *
  207. * A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
  208. * the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
  209. * is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
  210. * Detecting Moving Shadows...*, IEEE PAMI,2003.
  211. */
  212. - (double)getShadowThreshold NS_SWIFT_NAME(getShadowThreshold());
  213. //
  214. // void cv::BackgroundSubtractorMOG2::setShadowThreshold(double threshold)
  215. //
  216. /**
  217. * Sets the shadow threshold
  218. */
  219. - (void)setShadowThreshold:(double)threshold NS_SWIFT_NAME(setShadowThreshold(threshold:));
  220. //
  221. // void cv::BackgroundSubtractorMOG2::apply(Mat image, Mat& fgmask, double learningRate = -1)
  222. //
  223. /**
  224. * Computes a foreground mask.
  225. *
  226. * @param image Next video frame. Floating point frame will be used without scaling and should be in range `$$[0,255]$$`.
  227. * @param fgmask The output foreground mask as an 8-bit binary image.
  228. * @param learningRate The value between 0 and 1 that indicates how fast the background model is
  229. * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
  230. * rate. 0 means that the background model is not updated at all, 1 means that the background model
  231. * is completely reinitialized from the last frame.
  232. */
  233. - (void)apply:(Mat*)image fgmask:(Mat*)fgmask learningRate:(double)learningRate NS_SWIFT_NAME(apply(image:fgmask:learningRate:));
  234. /**
  235. * Computes a foreground mask.
  236. *
  237. * @param image Next video frame. Floating point frame will be used without scaling and should be in range `$$[0,255]$$`.
  238. * @param fgmask The output foreground mask as an 8-bit binary image.
  239. * learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
  240. * rate. 0 means that the background model is not updated at all, 1 means that the background model
  241. * is completely reinitialized from the last frame.
  242. */
  243. - (void)apply:(Mat*)image fgmask:(Mat*)fgmask NS_SWIFT_NAME(apply(image:fgmask:));
  244. @end
  245. NS_ASSUME_NONNULL_END