谁知道accumulateWeighted什么原理?

accumulateWeighted

accumulateWeighted(frame, background, learningRate, output);
函数原型:http://docs.opencv.org/3.2.0/d7/df3/group__imgproc__motion.html#ga4f9552b541187f61f6818e8d2d826bc7

第一帧采用frame做背景的;
但是明显没更新啊,程序无语法错误。
车有重影,切一直不消失,应该消失的吧,如果我一直叠加背景的话。
cvtColor(frame, gray, CV_BGR2GRAY);

    if (background.empty())
        gray.convertTo(background, CV_32F);
    //背景转CV_8U  
    background.convertTo(backImage, CV_8U);
    //求差  
    absdiff(backImage, gray, foreground);
    //过滤扰点  
    cv::threshold(foreground, output, threshold, 255, THRESH_BINARY_INV);
    //更新背景
    accumulateWeighted(gray, background, learningRate, output);

图片说明

http://blog.csdn.net/sunshine_in_moon/article/details/45823939