aihot  2017-04-27 09:27:31  OpenCV |   查看评论   
  
  •                 // Set background pixel to 0  
  •                 m_mask.at<uchar>(i, j) = 0;  
  •   
  •                 // 如果一个像素是背景点,那么它有 1 / defaultSubsamplingFactor 的概率去更新自己的模型样本值  
  •                 int random = rng.uniform(0, SUBSAMPLE_FACTOR);  
  •                 if (random == 0)  
  •                 {  
  •                     random = rng.uniform(0, NUM_SAMPLES);  
  •                     m_samples[random].at<uchar>(i, j) = _image.at<uchar>(i, j);  
  •                 }  
  •   
  •                 // 同时也有 1 / defaultSubsamplingFactor 的概率去更新它的邻居点的模型样本值  
  •                 random = rng.uniform(0, SUBSAMPLE_FACTOR);  
  •                 if (random == 0)  
  •                 {  
  •                     int row, col;  
  •                     random = rng.uniform(0, 9);  
  •                     row = i + c_yoff[random];  
  •                     if (row < 0)   
  •                         row = 0;  
  •                     if (row >= _image.rows)  
  •                         row = _image.rows - 1;  
  •   
  •                     random = rng.uniform(0, 9);  
  •                     col = j + c_xoff[random];  
  •                     if (col < 0)   
  •                         col = 0;  
  •                     if (col >= _image.cols)  
  •                         col = _image.cols - 1;  
  •   
  •                     random = rng.uniform(0, NUM_SAMPLES);  
  •                     m_samples[random].at<uchar>(row, col) = _image.at<uchar>(i, j);  
  •                 }  
  •             }  
  •             else  
  •             {  
  •                 // It is a foreground pixel  
  •                 m_foregroundMatchCount.at<uchar>(i, j)++;  
  •   
  •                 // Set background pixel to 255
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自运动检测(前景检测)之(一)ViBe

    留言与评论(共有 0 条评论)
       
    验证码:
    [lianlun]1[/lianlun]