/** * @file bg_sub.cpp * @brief Background subtraction tutorial sample code * @author Domenico D. Bloisi */ //opencv #include #include //C #include //C++ #include #include using namespace cv; using namespace std; // Global variables Mat frame; //current frame Mat fgMaskMOG; //fg mask generated by MOG method Mat fgMaskMOG2; //fg mask fg mask generated by MOG2 method Ptr pMOG; //MOG Background subtractor Ptr pMOG2; //MOG2 Background subtractor int keyboard; //input from keyboard /** Function Headers */ void help(); void processVideo(char* videoFilename); void processImages(char* firstFrameFilename); void help() { cout << "--------------------------------------------------------------------------" << endl << "This program shows how to use background subtraction methods provided by " << endl << " OpenCV. You can process both videos (-vid) and images (-img)." << endl << endl << "Usage:" << endl << "./bs {-vid