提交 1cb87da0 编写于 作者: G Gary Bradski

added docs and minor program changes

上级 28bca0ad
......@@ -6,6 +6,15 @@
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)
{
......@@ -52,6 +61,8 @@ int main(int argc, char** argv)
VideoCapture cap;
bool update_bg_model = true;
help();
if( argc < 2 )
cap.open(0);
else
......@@ -59,7 +70,7 @@ int main(int argc, char** argv)
if( !cap.isOpened() )
{
printf("can not open camera or video file\n");
printf("\nCan not open camera or video file\n");
return -1;
}
......@@ -93,7 +104,10 @@ int main(int argc, char** argv)
if( keycode == 27 )
break;
if( keycode == ' ' )
{
update_bg_model = !update_bg_model;
printf("Learn background is in state = %d\n",update_bg_model);
}
}
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册