/**
 * @author David Corvoysier / Copyright Orange 2013
 * 
 * Average background Subtraction
 * 
 * Parameters:
 * - alpha
 * - threshold
 *
 */
(function(global) {

    global.addBGsubtractor (
        // Background Subtractor Name
        'average',
        // Mask function
        function (frameIn,fgmask,bgmodel,alpha,threshold) {
            // Use the generic colormask filter
            global.colormask(frameIn,fgmask,bgmodel,threshold);
        },
        // Update function
        function (frameIn,bgmodel,alpha,threshold) {
            // Use the generic mix function 
            global.mix(frameIn,bgmodel,bgmodel,alpha);
        }
    );        

})(glimp);

@@ -602,24 +602,16 @@
 bal.mix(
-frameIn,
 bgmodel,
@@ -614,24 +614,32 @@
 del,bgmodel,
+frameIn,
 alpha);%0A    

update bgmodel with alpha*frameIn, and not the other way round