Super awesome foreground segmentation, based on the paper by Cheung and Kamath (2005). I just copied the paper. Short story: Take a short term background model, like frame differencing, and a long term background model, like median, and combine them. Short-term subtraction gives you leading edges of moving objects. Long-term subtraction gets you filled in forground objects, but also "ghosts" and "shadows" trailing behind them, that are really background. By combining them you do really well. The long-term background model comes from mDataStructureImageBinary, and it does the short term model itself with frame differencing. I use AdaptiveBackgroundSubtractionMedian for the long term model.



Threshold to use when computing the short-term forground model (which is done with frame differencing.)