reverted samples with new command argument parser. will be continued after OpenCV release.
This commit is contained in:
@@ -1,40 +1,32 @@
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/video/background_segm.hpp"
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
void help()
|
||||
{
|
||||
printf("\nDo background segmentation, especially demonstrating the use of cvUpdateBGStatModel().\n"
|
||||
" Learns the background at the start and then segments.\n"
|
||||
" Learning is togged by the space key. Will read from file or camera\n"
|
||||
"Usage: \n"
|
||||
" ./bgfg_segm [--file_name]=<input file, camera as defautl>\n\n");
|
||||
"Learns the background at the start and then segments.\n"
|
||||
"Learning is togged by the space key. Will read from file or camera\n"
|
||||
"Call:\n"
|
||||
"./ bgfg_segm [file name -- if no name, read from camera]\n\n");
|
||||
}
|
||||
|
||||
//this is a sample for foreground detection functions
|
||||
int main(int argc, const char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv);
|
||||
|
||||
string fileName = parser.get<string>("file_name", "0");
|
||||
VideoCapture cap;
|
||||
bool update_bg_model = true;
|
||||
|
||||
|
||||
if(fileName == "0" )
|
||||
if( argc < 2 )
|
||||
cap.open(0);
|
||||
else
|
||||
cap.open(fileName.c_str());
|
||||
|
||||
cap.open(argv[1]);
|
||||
help();
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
help();
|
||||
printf("can not open camera or video file\n");
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user