aihot  2017-04-27 09:27:31  OpenCV |   查看评论   
  • #include <opencv2/opencv.hpp>  
  • #include <iostream>  
  • #include "ViBe.h"  
  •   
  • using namespace std;  
  • using namespace cv;  
  •   
  • int c_xoff[9] = {-1,  0,  1, -1, 1, -1, 0, 1, 0};  //x的邻居点  
  • int c_yoff[9] = {-1,  0,  1, -1, 1, -1, 0, 1, 0};  //y的邻居点  
  •   
  • ViBe_BGS::ViBe_BGS(void)  
  • {  
  •   
  • }  
  • ViBe_BGS::~ViBe_BGS(void)  
  • {  
  •   
  • }  
  •   
  • /**************** Assign space and init ***************************/  
  • void ViBe_BGS::init(const Mat _image)  
  • {  
  •      for(int i = 0; i < NUM_SAMPLES; i++)  
  •      {  
  •          m_samples[i] = Mat::zeros(_image.size(), CV_8UC1);  
  •      }  
  •      m_mask = Mat::zeros(_image.size(),CV_8UC1);  
  •      m_foregroundMatchCount = Mat::zeros(_image.size(),CV_8UC1);  
  • }  
  •   
  • /**************** Init model from first frame ********************/  
  • void ViBe_BGS::processFirstFrame(const Mat _image)  
  • {  
  •     RNG rng;  
  •     int row, col;  
  •   
  •     for(int i = 0; i < _image.rows; i++)  
  •     {  
  •         for(int j = 0; j < _image.cols; j++)  
  •         {  
  •              for(int k = 0 ; k < NUM_SAMPLES; k++)  
  •              {  
  •                  // Random pick up NUM_SAMPLES pixel in neighbourhood to construct the model  
  •                  
  •  

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

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