BackgroundSubtractorMOG2.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!-- NewPage -->
  3. <html lang="en">
  4. <head>
  5. <!-- Generated by javadoc (1.8.0_312) on Wed Jun 28 12:47:23 UTC 2023 -->
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  7. <title>BackgroundSubtractorMOG2 (OpenCV 4.8.0 Java documentation)</title>
  8. <meta name="date" content="2023-06-28">
  9. <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
  10. <script type="text/javascript" src="../../../script.js"></script>
  11. </head>
  12. <body>
  13. <script type="text/javascript"><!--
  14. try {
  15. if (location.href.indexOf('is-external=true') == -1) {
  16. parent.document.title="BackgroundSubtractorMOG2 (OpenCV 4.8.0 Java documentation)";
  17. }
  18. }
  19. catch(err) {
  20. }
  21. //-->
  22. var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10};
  23. var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
  24. var altColor = "altColor";
  25. var rowColor = "rowColor";
  26. var tableTab = "tableTab";
  27. var activeTableTab = "activeTableTab";
  28. </script>
  29. <noscript>
  30. <div>JavaScript is disabled on your browser.</div>
  31. </noscript>
  32. <!-- ========= START OF TOP NAVBAR ======= -->
  33. <div class="topNav"><a name="navbar.top">
  34. <!-- -->
  35. </a>
  36. <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
  37. <a name="navbar.top.firstrow">
  38. <!-- -->
  39. </a>
  40. <ul class="navList" title="Navigation">
  41. <li><a href="../../../overview-summary.html">Overview</a></li>
  42. <li><a href="package-summary.html">Package</a></li>
  43. <li class="navBarCell1Rev">Class</li>
  44. <li><a href="package-tree.html">Tree</a></li>
  45. <li><a href="../../../index-all.html">Index</a></li>
  46. <li><a href="../../../help-doc.html">Help</a></li>
  47. </ul>
  48. <div class="aboutLanguage">
  49. <script>
  50. var url = window.location.href;
  51. var pos = url.lastIndexOf('/javadoc/');
  52. url = pos >= 0 ? (url.substring(0, pos) + '/javadoc/mymath.js') : (window.location.origin + '/mymath.js');
  53. var script = document.createElement('script');
  54. script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML,' + url;
  55. document.getElementsByTagName('head')[0].appendChild(script);
  56. </script>
  57. </div>
  58. </div>
  59. <div class="subNav">
  60. <ul class="navList">
  61. <li><a href="../../../org/opencv/video/BackgroundSubtractorKNN.html" title="class in org.opencv.video"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  62. <li><a href="../../../org/opencv/video/DenseOpticalFlow.html" title="class in org.opencv.video"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  63. </ul>
  64. <ul class="navList">
  65. <li><a href="../../../index.html?org/opencv/video/BackgroundSubtractorMOG2.html" target="_top">Frames</a></li>
  66. <li><a href="BackgroundSubtractorMOG2.html" target="_top">No&nbsp;Frames</a></li>
  67. </ul>
  68. <ul class="navList" id="allclasses_navbar_top">
  69. <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  70. </ul>
  71. <div>
  72. <script type="text/javascript"><!--
  73. allClassesLink = document.getElementById("allclasses_navbar_top");
  74. if(window==top) {
  75. allClassesLink.style.display = "block";
  76. }
  77. else {
  78. allClassesLink.style.display = "none";
  79. }
  80. //-->
  81. </script>
  82. </div>
  83. <div>
  84. <ul class="subNavList">
  85. <li>Summary:&nbsp;</li>
  86. <li>Nested&nbsp;|&nbsp;</li>
  87. <li>Field&nbsp;|&nbsp;</li>
  88. <li>Constr&nbsp;|&nbsp;</li>
  89. <li><a href="#method.summary">Method</a></li>
  90. </ul>
  91. <ul class="subNavList">
  92. <li>Detail:&nbsp;</li>
  93. <li>Field&nbsp;|&nbsp;</li>
  94. <li>Constr&nbsp;|&nbsp;</li>
  95. <li><a href="#method.detail">Method</a></li>
  96. </ul>
  97. </div>
  98. <a name="skip.navbar.top">
  99. <!-- -->
  100. </a></div>
  101. <!-- ========= END OF TOP NAVBAR ========= -->
  102. <!-- ======== START OF CLASS DATA ======== -->
  103. <div class="header">
  104. <div class="subTitle">org.opencv.video</div>
  105. <h2 title="Class BackgroundSubtractorMOG2" class="title">Class BackgroundSubtractorMOG2</h2>
  106. </div>
  107. <div class="contentContainer">
  108. <ul class="inheritance">
  109. <li>java.lang.Object</li>
  110. <li>
  111. <ul class="inheritance">
  112. <li><a href="../../../org/opencv/core/Algorithm.html" title="class in org.opencv.core">org.opencv.core.Algorithm</a></li>
  113. <li>
  114. <ul class="inheritance">
  115. <li><a href="../../../org/opencv/video/BackgroundSubtractor.html" title="class in org.opencv.video">org.opencv.video.BackgroundSubtractor</a></li>
  116. <li>
  117. <ul class="inheritance">
  118. <li>org.opencv.video.BackgroundSubtractorMOG2</li>
  119. </ul>
  120. </li>
  121. </ul>
  122. </li>
  123. </ul>
  124. </li>
  125. </ul>
  126. <div class="description">
  127. <ul class="blockList">
  128. <li class="blockList">
  129. <hr>
  130. <br>
  131. <pre>public class <span class="typeNameLabel">BackgroundSubtractorMOG2</span>
  132. extends <a href="../../../org/opencv/video/BackgroundSubtractor.html" title="class in org.opencv.video">BackgroundSubtractor</a></pre>
  133. <div class="block">Gaussian Mixture-based Background/Foreground Segmentation Algorithm.
  134. The class implements the Gaussian mixture model background subtraction described in CITE: Zivkovic2004
  135. and CITE: Zivkovic2006 .</div>
  136. </li>
  137. </ul>
  138. </div>
  139. <div class="summary">
  140. <ul class="blockList">
  141. <li class="blockList">
  142. <!-- ========== METHOD SUMMARY =========== -->
  143. <ul class="blockList">
  144. <li class="blockList"><a name="method.summary">
  145. <!-- -->
  146. </a>
  147. <h3>Method Summary</h3>
  148. <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
  149. <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
  150. <tr>
  151. <th class="colFirst" scope="col">Modifier and Type</th>
  152. <th class="colLast" scope="col">Method and Description</th>
  153. </tr>
  154. <tr id="i0" class="altColor">
  155. <td class="colFirst"><code>static <a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html" title="class in org.opencv.video">BackgroundSubtractorMOG2</a></code></td>
  156. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#Z:Z__fromPtr__-long-">__fromPtr__</a></span>(long&nbsp;addr)</code>&nbsp;</td>
  157. </tr>
  158. <tr id="i1" class="rowColor">
  159. <td class="colFirst"><code>void</code></td>
  160. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#apply-org.opencv.core.Mat-org.opencv.core.Mat-">apply</a></span>(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;image,
  161. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;fgmask)</code>
  162. <div class="block">Computes a foreground mask.</div>
  163. </td>
  164. </tr>
  165. <tr id="i2" class="altColor">
  166. <td class="colFirst"><code>void</code></td>
  167. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#apply-org.opencv.core.Mat-org.opencv.core.Mat-double-">apply</a></span>(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;image,
  168. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;fgmask,
  169. double&nbsp;learningRate)</code>
  170. <div class="block">Computes a foreground mask.</div>
  171. </td>
  172. </tr>
  173. <tr id="i3" class="rowColor">
  174. <td class="colFirst"><code>double</code></td>
  175. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getBackgroundRatio--">getBackgroundRatio</a></span>()</code>
  176. <div class="block">Returns the "background ratio" parameter of the algorithm
  177. If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
  178. considered background and added to the model as a center of a new component.</div>
  179. </td>
  180. </tr>
  181. <tr id="i4" class="altColor">
  182. <td class="colFirst"><code>double</code></td>
  183. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getComplexityReductionThreshold--">getComplexityReductionThreshold</a></span>()</code>
  184. <div class="block">Returns the complexity reduction threshold
  185. This parameter defines the number of samples needed to accept to prove the component exists.</div>
  186. </td>
  187. </tr>
  188. <tr id="i5" class="rowColor">
  189. <td class="colFirst"><code>boolean</code></td>
  190. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getDetectShadows--">getDetectShadows</a></span>()</code>
  191. <div class="block">Returns the shadow detection flag
  192. If true, the algorithm detects shadows and marks them.</div>
  193. </td>
  194. </tr>
  195. <tr id="i6" class="altColor">
  196. <td class="colFirst"><code>int</code></td>
  197. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getHistory--">getHistory</a></span>()</code>
  198. <div class="block">Returns the number of last frames that affect the background model</div>
  199. </td>
  200. </tr>
  201. <tr id="i7" class="rowColor">
  202. <td class="colFirst"><code>int</code></td>
  203. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getNMixtures--">getNMixtures</a></span>()</code>
  204. <div class="block">Returns the number of gaussian components in the background model</div>
  205. </td>
  206. </tr>
  207. <tr id="i8" class="altColor">
  208. <td class="colFirst"><code>double</code></td>
  209. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getShadowThreshold--">getShadowThreshold</a></span>()</code>
  210. <div class="block">Returns the shadow threshold
  211. A shadow is detected if pixel is a darker version of the background.</div>
  212. </td>
  213. </tr>
  214. <tr id="i9" class="rowColor">
  215. <td class="colFirst"><code>int</code></td>
  216. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getShadowValue--">getShadowValue</a></span>()</code>
  217. <div class="block">Returns the shadow value
  218. Shadow value is the value used to mark shadows in the foreground mask.</div>
  219. </td>
  220. </tr>
  221. <tr id="i10" class="altColor">
  222. <td class="colFirst"><code>double</code></td>
  223. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getVarInit--">getVarInit</a></span>()</code>
  224. <div class="block">Returns the initial variance of each gaussian component</div>
  225. </td>
  226. </tr>
  227. <tr id="i11" class="rowColor">
  228. <td class="colFirst"><code>double</code></td>
  229. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getVarMax--">getVarMax</a></span>()</code>&nbsp;</td>
  230. </tr>
  231. <tr id="i12" class="altColor">
  232. <td class="colFirst"><code>double</code></td>
  233. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getVarMin--">getVarMin</a></span>()</code>&nbsp;</td>
  234. </tr>
  235. <tr id="i13" class="rowColor">
  236. <td class="colFirst"><code>double</code></td>
  237. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getVarThreshold--">getVarThreshold</a></span>()</code>
  238. <div class="block">Returns the variance threshold for the pixel-model match
  239. The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
  240. the background model or not.</div>
  241. </td>
  242. </tr>
  243. <tr id="i14" class="altColor">
  244. <td class="colFirst"><code>double</code></td>
  245. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#getVarThresholdGen--">getVarThresholdGen</a></span>()</code>
  246. <div class="block">Returns the variance threshold for the pixel-model match used for new mixture component generation
  247. Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
  248. existing components (corresponds to Tg in the paper).</div>
  249. </td>
  250. </tr>
  251. <tr id="i15" class="rowColor">
  252. <td class="colFirst"><code>void</code></td>
  253. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setBackgroundRatio-double-">setBackgroundRatio</a></span>(double&nbsp;ratio)</code>
  254. <div class="block">Sets the "background ratio" parameter of the algorithm</div>
  255. </td>
  256. </tr>
  257. <tr id="i16" class="altColor">
  258. <td class="colFirst"><code>void</code></td>
  259. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setComplexityReductionThreshold-double-">setComplexityReductionThreshold</a></span>(double&nbsp;ct)</code>
  260. <div class="block">Sets the complexity reduction threshold</div>
  261. </td>
  262. </tr>
  263. <tr id="i17" class="rowColor">
  264. <td class="colFirst"><code>void</code></td>
  265. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setDetectShadows-boolean-">setDetectShadows</a></span>(boolean&nbsp;detectShadows)</code>
  266. <div class="block">Enables or disables shadow detection</div>
  267. </td>
  268. </tr>
  269. <tr id="i18" class="altColor">
  270. <td class="colFirst"><code>void</code></td>
  271. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setHistory-int-">setHistory</a></span>(int&nbsp;history)</code>
  272. <div class="block">Sets the number of last frames that affect the background model</div>
  273. </td>
  274. </tr>
  275. <tr id="i19" class="rowColor">
  276. <td class="colFirst"><code>void</code></td>
  277. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setNMixtures-int-">setNMixtures</a></span>(int&nbsp;nmixtures)</code>
  278. <div class="block">Sets the number of gaussian components in the background model.</div>
  279. </td>
  280. </tr>
  281. <tr id="i20" class="altColor">
  282. <td class="colFirst"><code>void</code></td>
  283. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setShadowThreshold-double-">setShadowThreshold</a></span>(double&nbsp;threshold)</code>
  284. <div class="block">Sets the shadow threshold</div>
  285. </td>
  286. </tr>
  287. <tr id="i21" class="rowColor">
  288. <td class="colFirst"><code>void</code></td>
  289. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setShadowValue-int-">setShadowValue</a></span>(int&nbsp;value)</code>
  290. <div class="block">Sets the shadow value</div>
  291. </td>
  292. </tr>
  293. <tr id="i22" class="altColor">
  294. <td class="colFirst"><code>void</code></td>
  295. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setVarInit-double-">setVarInit</a></span>(double&nbsp;varInit)</code>
  296. <div class="block">Sets the initial variance of each gaussian component</div>
  297. </td>
  298. </tr>
  299. <tr id="i23" class="rowColor">
  300. <td class="colFirst"><code>void</code></td>
  301. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setVarMax-double-">setVarMax</a></span>(double&nbsp;varMax)</code>&nbsp;</td>
  302. </tr>
  303. <tr id="i24" class="altColor">
  304. <td class="colFirst"><code>void</code></td>
  305. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setVarMin-double-">setVarMin</a></span>(double&nbsp;varMin)</code>&nbsp;</td>
  306. </tr>
  307. <tr id="i25" class="rowColor">
  308. <td class="colFirst"><code>void</code></td>
  309. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setVarThreshold-double-">setVarThreshold</a></span>(double&nbsp;varThreshold)</code>
  310. <div class="block">Sets the variance threshold for the pixel-model match</div>
  311. </td>
  312. </tr>
  313. <tr id="i26" class="altColor">
  314. <td class="colFirst"><code>void</code></td>
  315. <td class="colLast"><code><span class="memberNameLink"><a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html#setVarThresholdGen-double-">setVarThresholdGen</a></span>(double&nbsp;varThresholdGen)</code>
  316. <div class="block">Sets the variance threshold for the pixel-model match used for new mixture component generation</div>
  317. </td>
  318. </tr>
  319. </table>
  320. <ul class="blockList">
  321. <li class="blockList"><a name="methods.inherited.from.class.org.opencv.video.BackgroundSubtractor">
  322. <!-- -->
  323. </a>
  324. <h3>Methods inherited from class&nbsp;org.opencv.video.<a href="../../../org/opencv/video/BackgroundSubtractor.html" title="class in org.opencv.video">BackgroundSubtractor</a></h3>
  325. <code><a href="../../../org/opencv/video/BackgroundSubtractor.html#getBackgroundImage-org.opencv.core.Mat-">getBackgroundImage</a></code></li>
  326. </ul>
  327. <ul class="blockList">
  328. <li class="blockList"><a name="methods.inherited.from.class.org.opencv.core.Algorithm">
  329. <!-- -->
  330. </a>
  331. <h3>Methods inherited from class&nbsp;org.opencv.core.<a href="../../../org/opencv/core/Algorithm.html" title="class in org.opencv.core">Algorithm</a></h3>
  332. <code><a href="../../../org/opencv/core/Algorithm.html#clear--">clear</a>, <a href="../../../org/opencv/core/Algorithm.html#empty--">empty</a>, <a href="../../../org/opencv/core/Algorithm.html#getDefaultName--">getDefaultName</a>, <a href="../../../org/opencv/core/Algorithm.html#getNativeObjAddr--">getNativeObjAddr</a>, <a href="../../../org/opencv/core/Algorithm.html#save-java.lang.String-">save</a></code></li>
  333. </ul>
  334. <ul class="blockList">
  335. <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
  336. <!-- -->
  337. </a>
  338. <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
  339. <code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
  340. </ul>
  341. </li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </div>
  346. <div class="details">
  347. <ul class="blockList">
  348. <li class="blockList">
  349. <!-- ============ METHOD DETAIL ========== -->
  350. <ul class="blockList">
  351. <li class="blockList"><a name="method.detail">
  352. <!-- -->
  353. </a>
  354. <h3>Method Detail</h3>
  355. <a name="Z:Z__fromPtr__-long-">
  356. <!-- -->
  357. </a>
  358. <ul class="blockList">
  359. <li class="blockList">
  360. <h4>__fromPtr__</h4>
  361. <pre>public static&nbsp;<a href="../../../org/opencv/video/BackgroundSubtractorMOG2.html" title="class in org.opencv.video">BackgroundSubtractorMOG2</a>&nbsp;__fromPtr__(long&nbsp;addr)</pre>
  362. </li>
  363. </ul>
  364. <a name="apply-org.opencv.core.Mat-org.opencv.core.Mat-">
  365. <!-- -->
  366. </a>
  367. <ul class="blockList">
  368. <li class="blockList">
  369. <h4>apply</h4>
  370. <pre>public&nbsp;void&nbsp;apply(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;image,
  371. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;fgmask)</pre>
  372. <div class="block">Computes a foreground mask.</div>
  373. <dl>
  374. <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
  375. <dd><code><a href="../../../org/opencv/video/BackgroundSubtractor.html#apply-org.opencv.core.Mat-org.opencv.core.Mat-">apply</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/opencv/video/BackgroundSubtractor.html" title="class in org.opencv.video">BackgroundSubtractor</a></code></dd>
  376. <dt><span class="paramLabel">Parameters:</span></dt>
  377. <dd><code>image</code> - Next video frame. Floating point frame will be used without scaling and should be in range \([0,255]\).</dd>
  378. <dd><code>fgmask</code> - The output foreground mask as an 8-bit binary image.
  379. learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
  380. rate. 0 means that the background model is not updated at all, 1 means that the background model
  381. is completely reinitialized from the last frame.</dd>
  382. </dl>
  383. </li>
  384. </ul>
  385. <a name="apply-org.opencv.core.Mat-org.opencv.core.Mat-double-">
  386. <!-- -->
  387. </a>
  388. <ul class="blockList">
  389. <li class="blockList">
  390. <h4>apply</h4>
  391. <pre>public&nbsp;void&nbsp;apply(<a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;image,
  392. <a href="../../../org/opencv/core/Mat.html" title="class in org.opencv.core">Mat</a>&nbsp;fgmask,
  393. double&nbsp;learningRate)</pre>
  394. <div class="block">Computes a foreground mask.</div>
  395. <dl>
  396. <dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
  397. <dd><code><a href="../../../org/opencv/video/BackgroundSubtractor.html#apply-org.opencv.core.Mat-org.opencv.core.Mat-double-">apply</a></code>&nbsp;in class&nbsp;<code><a href="../../../org/opencv/video/BackgroundSubtractor.html" title="class in org.opencv.video">BackgroundSubtractor</a></code></dd>
  398. <dt><span class="paramLabel">Parameters:</span></dt>
  399. <dd><code>image</code> - Next video frame. Floating point frame will be used without scaling and should be in range \([0,255]\).</dd>
  400. <dd><code>fgmask</code> - The output foreground mask as an 8-bit binary image.</dd>
  401. <dd><code>learningRate</code> - The value between 0 and 1 that indicates how fast the background model is
  402. learnt. Negative parameter value makes the algorithm to use some automatically chosen learning
  403. rate. 0 means that the background model is not updated at all, 1 means that the background model
  404. is completely reinitialized from the last frame.</dd>
  405. </dl>
  406. </li>
  407. </ul>
  408. <a name="getBackgroundRatio--">
  409. <!-- -->
  410. </a>
  411. <ul class="blockList">
  412. <li class="blockList">
  413. <h4>getBackgroundRatio</h4>
  414. <pre>public&nbsp;double&nbsp;getBackgroundRatio()</pre>
  415. <div class="block">Returns the "background ratio" parameter of the algorithm
  416. If a foreground pixel keeps semi-constant value for about backgroundRatio\*history frames, it's
  417. considered background and added to the model as a center of a new component. It corresponds to TB
  418. parameter in the paper.</div>
  419. <dl>
  420. <dt><span class="returnLabel">Returns:</span></dt>
  421. <dd>automatically generated</dd>
  422. </dl>
  423. </li>
  424. </ul>
  425. <a name="getComplexityReductionThreshold--">
  426. <!-- -->
  427. </a>
  428. <ul class="blockList">
  429. <li class="blockList">
  430. <h4>getComplexityReductionThreshold</h4>
  431. <pre>public&nbsp;double&nbsp;getComplexityReductionThreshold()</pre>
  432. <div class="block">Returns the complexity reduction threshold
  433. This parameter defines the number of samples needed to accept to prove the component exists. CT=0.05
  434. is a default value for all the samples. By setting CT=0 you get an algorithm very similar to the
  435. standard Stauffer&amp;Grimson algorithm.</div>
  436. <dl>
  437. <dt><span class="returnLabel">Returns:</span></dt>
  438. <dd>automatically generated</dd>
  439. </dl>
  440. </li>
  441. </ul>
  442. <a name="getDetectShadows--">
  443. <!-- -->
  444. </a>
  445. <ul class="blockList">
  446. <li class="blockList">
  447. <h4>getDetectShadows</h4>
  448. <pre>public&nbsp;boolean&nbsp;getDetectShadows()</pre>
  449. <div class="block">Returns the shadow detection flag
  450. If true, the algorithm detects shadows and marks them. See createBackgroundSubtractorMOG2 for
  451. details.</div>
  452. <dl>
  453. <dt><span class="returnLabel">Returns:</span></dt>
  454. <dd>automatically generated</dd>
  455. </dl>
  456. </li>
  457. </ul>
  458. <a name="getHistory--">
  459. <!-- -->
  460. </a>
  461. <ul class="blockList">
  462. <li class="blockList">
  463. <h4>getHistory</h4>
  464. <pre>public&nbsp;int&nbsp;getHistory()</pre>
  465. <div class="block">Returns the number of last frames that affect the background model</div>
  466. <dl>
  467. <dt><span class="returnLabel">Returns:</span></dt>
  468. <dd>automatically generated</dd>
  469. </dl>
  470. </li>
  471. </ul>
  472. <a name="getNMixtures--">
  473. <!-- -->
  474. </a>
  475. <ul class="blockList">
  476. <li class="blockList">
  477. <h4>getNMixtures</h4>
  478. <pre>public&nbsp;int&nbsp;getNMixtures()</pre>
  479. <div class="block">Returns the number of gaussian components in the background model</div>
  480. <dl>
  481. <dt><span class="returnLabel">Returns:</span></dt>
  482. <dd>automatically generated</dd>
  483. </dl>
  484. </li>
  485. </ul>
  486. <a name="getShadowThreshold--">
  487. <!-- -->
  488. </a>
  489. <ul class="blockList">
  490. <li class="blockList">
  491. <h4>getShadowThreshold</h4>
  492. <pre>public&nbsp;double&nbsp;getShadowThreshold()</pre>
  493. <div class="block">Returns the shadow threshold
  494. A shadow is detected if pixel is a darker version of the background. The shadow threshold (Tau in
  495. the paper) is a threshold defining how much darker the shadow can be. Tau= 0.5 means that if a pixel
  496. is more than twice darker then it is not shadow. See Prati, Mikic, Trivedi and Cucchiara,
  497. Detecting Moving Shadows...*, IEEE PAMI,2003.</div>
  498. <dl>
  499. <dt><span class="returnLabel">Returns:</span></dt>
  500. <dd>automatically generated</dd>
  501. </dl>
  502. </li>
  503. </ul>
  504. <a name="getShadowValue--">
  505. <!-- -->
  506. </a>
  507. <ul class="blockList">
  508. <li class="blockList">
  509. <h4>getShadowValue</h4>
  510. <pre>public&nbsp;int&nbsp;getShadowValue()</pre>
  511. <div class="block">Returns the shadow value
  512. Shadow value is the value used to mark shadows in the foreground mask. Default value is 127. Value 0
  513. in the mask always means background, 255 means foreground.</div>
  514. <dl>
  515. <dt><span class="returnLabel">Returns:</span></dt>
  516. <dd>automatically generated</dd>
  517. </dl>
  518. </li>
  519. </ul>
  520. <a name="getVarInit--">
  521. <!-- -->
  522. </a>
  523. <ul class="blockList">
  524. <li class="blockList">
  525. <h4>getVarInit</h4>
  526. <pre>public&nbsp;double&nbsp;getVarInit()</pre>
  527. <div class="block">Returns the initial variance of each gaussian component</div>
  528. <dl>
  529. <dt><span class="returnLabel">Returns:</span></dt>
  530. <dd>automatically generated</dd>
  531. </dl>
  532. </li>
  533. </ul>
  534. <a name="getVarMax--">
  535. <!-- -->
  536. </a>
  537. <ul class="blockList">
  538. <li class="blockList">
  539. <h4>getVarMax</h4>
  540. <pre>public&nbsp;double&nbsp;getVarMax()</pre>
  541. </li>
  542. </ul>
  543. <a name="getVarMin--">
  544. <!-- -->
  545. </a>
  546. <ul class="blockList">
  547. <li class="blockList">
  548. <h4>getVarMin</h4>
  549. <pre>public&nbsp;double&nbsp;getVarMin()</pre>
  550. </li>
  551. </ul>
  552. <a name="getVarThreshold--">
  553. <!-- -->
  554. </a>
  555. <ul class="blockList">
  556. <li class="blockList">
  557. <h4>getVarThreshold</h4>
  558. <pre>public&nbsp;double&nbsp;getVarThreshold()</pre>
  559. <div class="block">Returns the variance threshold for the pixel-model match
  560. The main threshold on the squared Mahalanobis distance to decide if the sample is well described by
  561. the background model or not. Related to Cthr from the paper.</div>
  562. <dl>
  563. <dt><span class="returnLabel">Returns:</span></dt>
  564. <dd>automatically generated</dd>
  565. </dl>
  566. </li>
  567. </ul>
  568. <a name="getVarThresholdGen--">
  569. <!-- -->
  570. </a>
  571. <ul class="blockList">
  572. <li class="blockList">
  573. <h4>getVarThresholdGen</h4>
  574. <pre>public&nbsp;double&nbsp;getVarThresholdGen()</pre>
  575. <div class="block">Returns the variance threshold for the pixel-model match used for new mixture component generation
  576. Threshold for the squared Mahalanobis distance that helps decide when a sample is close to the
  577. existing components (corresponds to Tg in the paper). If a pixel is not close to any component, it
  578. is considered foreground or added as a new component. 3 sigma =&gt; Tg=3\*3=9 is default. A smaller Tg
  579. value generates more components. A higher Tg value may result in a small number of components but
  580. they can grow too large.</div>
  581. <dl>
  582. <dt><span class="returnLabel">Returns:</span></dt>
  583. <dd>automatically generated</dd>
  584. </dl>
  585. </li>
  586. </ul>
  587. <a name="setBackgroundRatio-double-">
  588. <!-- -->
  589. </a>
  590. <ul class="blockList">
  591. <li class="blockList">
  592. <h4>setBackgroundRatio</h4>
  593. <pre>public&nbsp;void&nbsp;setBackgroundRatio(double&nbsp;ratio)</pre>
  594. <div class="block">Sets the "background ratio" parameter of the algorithm</div>
  595. <dl>
  596. <dt><span class="paramLabel">Parameters:</span></dt>
  597. <dd><code>ratio</code> - automatically generated</dd>
  598. </dl>
  599. </li>
  600. </ul>
  601. <a name="setComplexityReductionThreshold-double-">
  602. <!-- -->
  603. </a>
  604. <ul class="blockList">
  605. <li class="blockList">
  606. <h4>setComplexityReductionThreshold</h4>
  607. <pre>public&nbsp;void&nbsp;setComplexityReductionThreshold(double&nbsp;ct)</pre>
  608. <div class="block">Sets the complexity reduction threshold</div>
  609. <dl>
  610. <dt><span class="paramLabel">Parameters:</span></dt>
  611. <dd><code>ct</code> - automatically generated</dd>
  612. </dl>
  613. </li>
  614. </ul>
  615. <a name="setDetectShadows-boolean-">
  616. <!-- -->
  617. </a>
  618. <ul class="blockList">
  619. <li class="blockList">
  620. <h4>setDetectShadows</h4>
  621. <pre>public&nbsp;void&nbsp;setDetectShadows(boolean&nbsp;detectShadows)</pre>
  622. <div class="block">Enables or disables shadow detection</div>
  623. <dl>
  624. <dt><span class="paramLabel">Parameters:</span></dt>
  625. <dd><code>detectShadows</code> - automatically generated</dd>
  626. </dl>
  627. </li>
  628. </ul>
  629. <a name="setHistory-int-">
  630. <!-- -->
  631. </a>
  632. <ul class="blockList">
  633. <li class="blockList">
  634. <h4>setHistory</h4>
  635. <pre>public&nbsp;void&nbsp;setHistory(int&nbsp;history)</pre>
  636. <div class="block">Sets the number of last frames that affect the background model</div>
  637. <dl>
  638. <dt><span class="paramLabel">Parameters:</span></dt>
  639. <dd><code>history</code> - automatically generated</dd>
  640. </dl>
  641. </li>
  642. </ul>
  643. <a name="setNMixtures-int-">
  644. <!-- -->
  645. </a>
  646. <ul class="blockList">
  647. <li class="blockList">
  648. <h4>setNMixtures</h4>
  649. <pre>public&nbsp;void&nbsp;setNMixtures(int&nbsp;nmixtures)</pre>
  650. <div class="block">Sets the number of gaussian components in the background model.
  651. The model needs to be reinitalized to reserve memory.</div>
  652. <dl>
  653. <dt><span class="paramLabel">Parameters:</span></dt>
  654. <dd><code>nmixtures</code> - automatically generated</dd>
  655. </dl>
  656. </li>
  657. </ul>
  658. <a name="setShadowThreshold-double-">
  659. <!-- -->
  660. </a>
  661. <ul class="blockList">
  662. <li class="blockList">
  663. <h4>setShadowThreshold</h4>
  664. <pre>public&nbsp;void&nbsp;setShadowThreshold(double&nbsp;threshold)</pre>
  665. <div class="block">Sets the shadow threshold</div>
  666. <dl>
  667. <dt><span class="paramLabel">Parameters:</span></dt>
  668. <dd><code>threshold</code> - automatically generated</dd>
  669. </dl>
  670. </li>
  671. </ul>
  672. <a name="setShadowValue-int-">
  673. <!-- -->
  674. </a>
  675. <ul class="blockList">
  676. <li class="blockList">
  677. <h4>setShadowValue</h4>
  678. <pre>public&nbsp;void&nbsp;setShadowValue(int&nbsp;value)</pre>
  679. <div class="block">Sets the shadow value</div>
  680. <dl>
  681. <dt><span class="paramLabel">Parameters:</span></dt>
  682. <dd><code>value</code> - automatically generated</dd>
  683. </dl>
  684. </li>
  685. </ul>
  686. <a name="setVarInit-double-">
  687. <!-- -->
  688. </a>
  689. <ul class="blockList">
  690. <li class="blockList">
  691. <h4>setVarInit</h4>
  692. <pre>public&nbsp;void&nbsp;setVarInit(double&nbsp;varInit)</pre>
  693. <div class="block">Sets the initial variance of each gaussian component</div>
  694. <dl>
  695. <dt><span class="paramLabel">Parameters:</span></dt>
  696. <dd><code>varInit</code> - automatically generated</dd>
  697. </dl>
  698. </li>
  699. </ul>
  700. <a name="setVarMax-double-">
  701. <!-- -->
  702. </a>
  703. <ul class="blockList">
  704. <li class="blockList">
  705. <h4>setVarMax</h4>
  706. <pre>public&nbsp;void&nbsp;setVarMax(double&nbsp;varMax)</pre>
  707. </li>
  708. </ul>
  709. <a name="setVarMin-double-">
  710. <!-- -->
  711. </a>
  712. <ul class="blockList">
  713. <li class="blockList">
  714. <h4>setVarMin</h4>
  715. <pre>public&nbsp;void&nbsp;setVarMin(double&nbsp;varMin)</pre>
  716. </li>
  717. </ul>
  718. <a name="setVarThreshold-double-">
  719. <!-- -->
  720. </a>
  721. <ul class="blockList">
  722. <li class="blockList">
  723. <h4>setVarThreshold</h4>
  724. <pre>public&nbsp;void&nbsp;setVarThreshold(double&nbsp;varThreshold)</pre>
  725. <div class="block">Sets the variance threshold for the pixel-model match</div>
  726. <dl>
  727. <dt><span class="paramLabel">Parameters:</span></dt>
  728. <dd><code>varThreshold</code> - automatically generated</dd>
  729. </dl>
  730. </li>
  731. </ul>
  732. <a name="setVarThresholdGen-double-">
  733. <!-- -->
  734. </a>
  735. <ul class="blockListLast">
  736. <li class="blockList">
  737. <h4>setVarThresholdGen</h4>
  738. <pre>public&nbsp;void&nbsp;setVarThresholdGen(double&nbsp;varThresholdGen)</pre>
  739. <div class="block">Sets the variance threshold for the pixel-model match used for new mixture component generation</div>
  740. <dl>
  741. <dt><span class="paramLabel">Parameters:</span></dt>
  742. <dd><code>varThresholdGen</code> - automatically generated</dd>
  743. </dl>
  744. </li>
  745. </ul>
  746. </li>
  747. </ul>
  748. </li>
  749. </ul>
  750. </div>
  751. </div>
  752. <!-- ========= END OF CLASS DATA ========= -->
  753. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  754. <div class="bottomNav"><a name="navbar.bottom">
  755. <!-- -->
  756. </a>
  757. <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
  758. <a name="navbar.bottom.firstrow">
  759. <!-- -->
  760. </a>
  761. <ul class="navList" title="Navigation">
  762. <li><a href="../../../overview-summary.html">Overview</a></li>
  763. <li><a href="package-summary.html">Package</a></li>
  764. <li class="navBarCell1Rev">Class</li>
  765. <li><a href="package-tree.html">Tree</a></li>
  766. <li><a href="../../../index-all.html">Index</a></li>
  767. <li><a href="../../../help-doc.html">Help</a></li>
  768. </ul>
  769. <div class="aboutLanguage">
  770. <script>
  771. var url = window.location.href;
  772. var pos = url.lastIndexOf('/javadoc/');
  773. url = pos >= 0 ? (url.substring(0, pos) + '/javadoc/mymath.js') : (window.location.origin + '/mymath.js');
  774. var script = document.createElement('script');
  775. script.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML,' + url;
  776. document.getElementsByTagName('head')[0].appendChild(script);
  777. </script>
  778. </div>
  779. </div>
  780. <div class="subNav">
  781. <ul class="navList">
  782. <li><a href="../../../org/opencv/video/BackgroundSubtractorKNN.html" title="class in org.opencv.video"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
  783. <li><a href="../../../org/opencv/video/DenseOpticalFlow.html" title="class in org.opencv.video"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
  784. </ul>
  785. <ul class="navList">
  786. <li><a href="../../../index.html?org/opencv/video/BackgroundSubtractorMOG2.html" target="_top">Frames</a></li>
  787. <li><a href="BackgroundSubtractorMOG2.html" target="_top">No&nbsp;Frames</a></li>
  788. </ul>
  789. <ul class="navList" id="allclasses_navbar_bottom">
  790. <li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
  791. </ul>
  792. <div>
  793. <script type="text/javascript"><!--
  794. allClassesLink = document.getElementById("allclasses_navbar_bottom");
  795. if(window==top) {
  796. allClassesLink.style.display = "block";
  797. }
  798. else {
  799. allClassesLink.style.display = "none";
  800. }
  801. //-->
  802. </script>
  803. </div>
  804. <div>
  805. <ul class="subNavList">
  806. <li>Summary:&nbsp;</li>
  807. <li>Nested&nbsp;|&nbsp;</li>
  808. <li>Field&nbsp;|&nbsp;</li>
  809. <li>Constr&nbsp;|&nbsp;</li>
  810. <li><a href="#method.summary">Method</a></li>
  811. </ul>
  812. <ul class="subNavList">
  813. <li>Detail:&nbsp;</li>
  814. <li>Field&nbsp;|&nbsp;</li>
  815. <li>Constr&nbsp;|&nbsp;</li>
  816. <li><a href="#method.detail">Method</a></li>
  817. </ul>
  818. </div>
  819. <a name="skip.navbar.bottom">
  820. <!-- -->
  821. </a></div>
  822. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  823. <p class="legalCopy"><small>Generated on 2023-06-28 12:47:21 / OpenCV 4.8.0</small></p>
  824. </body>
  825. </html>