described
This commit is contained in:
parent
fb67186351
commit
84cd509639
@ -2,6 +2,14 @@
|
|||||||
#include <opencv2/highgui/highgui.hpp>
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
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"
|
||||||
|
"Call:\n"
|
||||||
|
"./ bgfg_segm [file name -- if no name, read from camera]\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
//this is a sample for foreground detection functions
|
//this is a sample for foreground detection functions
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
@ -14,6 +22,7 @@ int main(int argc, char** argv)
|
|||||||
cap = cvCaptureFromCAM(0);
|
cap = cvCaptureFromCAM(0);
|
||||||
else
|
else
|
||||||
cap = cvCaptureFromFile(argv[1]);
|
cap = cvCaptureFromFile(argv[1]);
|
||||||
|
help();
|
||||||
|
|
||||||
if( !cap )
|
if( !cap )
|
||||||
{
|
{
|
||||||
@ -52,7 +61,13 @@ int main(int argc, char** argv)
|
|||||||
char k = cvWaitKey(5);
|
char k = cvWaitKey(5);
|
||||||
if( k == 27 ) break;
|
if( k == 27 ) break;
|
||||||
if( k == ' ' )
|
if( k == ' ' )
|
||||||
|
{
|
||||||
update_bg_model = !update_bg_model;
|
update_bg_model = !update_bg_model;
|
||||||
|
if(update_bg_model)
|
||||||
|
printf("Background update is on\n");
|
||||||
|
else
|
||||||
|
printf("Background update is off\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user