output得到的是灰色前景图,我是想用output作为copyTo的掩码(mask),但是得到的确实全黑前景m_dst,什么问题?
//转化为灰度图 
cvtColor(frame, gray, CV_BGR2GRAY);
// 对于第一帧,初始化背景
if (background.empty())
{
gray.convertTo(background, CV_32F);
}
      //背景转为CV_8U格式以便求取和当前帧差的绝对值
    background.convertTo(backImage, CV_8U);
// 计算当前图片和背景的差别
absdiff(backImage, gray, foreground);    // 对得到的前景进行阈值选取,去掉伪前景
threshold(foreground, output, nThreshold,255, THRESH_BINARY_INV);

// 实时更新背景
accumulateWeighted(gray, background, learningRate, output);
      //得到彩色前景
       frame.copyTo(m_dst,output);opencv