Implements the Apprixmated Mean Filter for background modeling described in N. J. B. McFarlane1 and C. P. Schofield1, Segmentation and tracking of piglets in Images.
Median is better for background subtraction because it does better rejection of outliers. This algorithm recursively approximates the median image, and then subtracts the background model from the current frame to find foreground objects. Its disadvantage is that it takes a long time to update the background when an object starts moving after being still for a long time. Combine it with BackgroundSubtractionCheungKamath to reject that type of noise.