added docs and minor program changes
This commit is contained in:
parent
28bca0ad8f
commit
1cb87da0e6
@ -6,6 +6,15 @@
|
|||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
void help()
|
||||||
|
{
|
||||||
|
printf("\n"
|
||||||
|
"This program demonstrated a simple method of connected components clean up of background subtraction\n"
|
||||||
|
"When the program starts, it begins learning the background. You can toggle background learning on and off\n"
|
||||||
|
"by hitting the space bar.\n"
|
||||||
|
"Call\n"
|
||||||
|
"./segment_objects [video file, else it reads camera 0]\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
void refineSegments(const Mat& img, Mat& mask, Mat& dst)
|
void refineSegments(const Mat& img, Mat& mask, Mat& dst)
|
||||||
{
|
{
|
||||||
@ -52,6 +61,8 @@ int main(int argc, char** argv)
|
|||||||
VideoCapture cap;
|
VideoCapture cap;
|
||||||
bool update_bg_model = true;
|
bool update_bg_model = true;
|
||||||
|
|
||||||
|
help();
|
||||||
|
|
||||||
if( argc < 2 )
|
if( argc < 2 )
|
||||||
cap.open(0);
|
cap.open(0);
|
||||||
else
|
else
|
||||||
@ -59,7 +70,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if( !cap.isOpened() )
|
if( !cap.isOpened() )
|
||||||
{
|
{
|
||||||
printf("can not open camera or video file\n");
|
printf("\nCan not open camera or video file\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +104,10 @@ int main(int argc, char** argv)
|
|||||||
if( keycode == 27 )
|
if( keycode == 27 )
|
||||||
break;
|
break;
|
||||||
if( keycode == ' ' )
|
if( keycode == ' ' )
|
||||||
|
{
|
||||||
update_bg_model = !update_bg_model;
|
update_bg_model = !update_bg_model;
|
||||||
|
printf("Learn background is in state = %d\n",update_bg_model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user