mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Normalize line endings and whitespace
This commit is contained in:
committed by
Andrey Kamaev
parent
69020da607
commit
04384a71e4
+16
-16
@@ -16,53 +16,53 @@ static void help()
|
||||
" ./bgfg_segm [--camera]=<use camera, if this key is present>, [--file_name]=<path to movie file> \n\n");
|
||||
}
|
||||
|
||||
const char* keys =
|
||||
const char* keys =
|
||||
{
|
||||
"{c |camera |true | use camera or not}"
|
||||
"{fn|file_name|tree.avi | movie file }"
|
||||
"{c |camera |true | use camera or not}"
|
||||
"{fn|file_name|tree.avi | movie file }"
|
||||
};
|
||||
|
||||
//this is a sample for foreground detection functions
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
help();
|
||||
help();
|
||||
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
bool useCamera = parser.get<bool>("camera");
|
||||
string file = parser.get<string>("file_name");
|
||||
CommandLineParser parser(argc, argv, keys);
|
||||
bool useCamera = parser.get<bool>("camera");
|
||||
string file = parser.get<string>("file_name");
|
||||
VideoCapture cap;
|
||||
bool update_bg_model = true;
|
||||
|
||||
if( useCamera )
|
||||
cap.open(0);
|
||||
else
|
||||
cap.open(file.c_str());
|
||||
parser.printParams();
|
||||
cap.open(file.c_str());
|
||||
parser.printParams();
|
||||
|
||||
if( !cap.isOpened() )
|
||||
{
|
||||
printf("can not open camera or video file\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
namedWindow("image", CV_WINDOW_NORMAL);
|
||||
namedWindow("foreground mask", CV_WINDOW_NORMAL);
|
||||
namedWindow("foreground image", CV_WINDOW_NORMAL);
|
||||
namedWindow("mean background image", CV_WINDOW_NORMAL);
|
||||
|
||||
BackgroundSubtractorMOG2 bg_model;//(100, 3, 0.3, 5);
|
||||
|
||||
|
||||
Mat img, fgmask, fgimg;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
cap >> img;
|
||||
|
||||
|
||||
if( img.empty() )
|
||||
break;
|
||||
|
||||
|
||||
//cvtColor(_img, img, COLOR_BGR2GRAY);
|
||||
|
||||
|
||||
if( fgimg.empty() )
|
||||
fgimg.create(img.size(), img.type());
|
||||
|
||||
@@ -87,9 +87,9 @@ int main(int argc, const char** argv)
|
||||
{
|
||||
update_bg_model = !update_bg_model;
|
||||
if(update_bg_model)
|
||||
printf("Background update is on\n");
|
||||
printf("Background update is on\n");
|
||||
else
|
||||
printf("Background update is off\n");
|
||||
printf("Background update is off\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user