#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};
int c_yoff[9] = {-1, 0, 1, -1, 1, -1, 0, 1, 0};
ViBe_BGS::ViBe_BGS(void)
{
}
ViBe_BGS::~ViBe_BGS(void)
{
}
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);
}
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++)
{