Set stricter warning rules for gcc
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
// Background average sample code done with averages and done with codebooks
|
||||
// (adapted from the OpenCV book sample)
|
||||
//
|
||||
//
|
||||
// NOTE: To get the keyboard to work, you *have* to have one of the video windows be active
|
||||
// and NOT the consule window.
|
||||
//
|
||||
// Gary Bradski Oct 3, 2008.
|
||||
//
|
||||
//
|
||||
/* *************** License:**************************
|
||||
Oct. 3, 2008
|
||||
Right to use this code in any way you want without warrenty, support or any guarentee of it working.
|
||||
@@ -14,11 +14,11 @@
|
||||
Learning OpenCV: Computer Vision with the OpenCV Library
|
||||
by Gary Bradski and Adrian Kaehler
|
||||
Published by O'Reilly Media, October 3, 2008
|
||||
|
||||
AVAILABLE AT:
|
||||
|
||||
AVAILABLE AT:
|
||||
http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134
|
||||
Or: http://oreilly.com/catalog/9780596516130/
|
||||
ISBN-10: 0596516134 or: ISBN-13: 978-0596516130
|
||||
ISBN-10: 0596516134 or: ISBN-13: 978-0596516130
|
||||
************************************************** */
|
||||
#include "opencv2/core/core.hpp"
|
||||
#include "opencv2/video/background_segm.hpp"
|
||||
@@ -38,19 +38,19 @@ CvBGCodeBookModel* model = 0;
|
||||
const int NCHANNELS = 3;
|
||||
bool ch[NCHANNELS]={true,true,true}; // This sets what channels should be adjusted for background bounds
|
||||
|
||||
void help()
|
||||
static void help()
|
||||
{
|
||||
printf("\nLearn background and find foreground using simple average and average difference learning method:\n"
|
||||
"Originally from the book: Learning OpenCV by O'Reilly press\n"
|
||||
"Originally from the book: Learning OpenCV by O'Reilly press\n"
|
||||
"\nUSAGE:\n"
|
||||
" bgfg_codebook [--nframes(-nf)=300] [--movie_filename(-mf)=tree.avi] [--camera(-c), use camera or not]\n"
|
||||
"***Keep the focus on the video windows, NOT the consol***\n\n"
|
||||
"INTERACTIVE PARAMETERS:\n"
|
||||
"\tESC,q,Q - quit the program\n"
|
||||
"\th - print this help\n"
|
||||
"\tp - pause toggle\n"
|
||||
"\ts - single step\n"
|
||||
"\tr - run mode (single step off)\n"
|
||||
"\th - print this help\n"
|
||||
"\tp - pause toggle\n"
|
||||
"\ts - single step\n"
|
||||
"\tr - run mode (single step off)\n"
|
||||
"=== AVG PARAMS ===\n"
|
||||
"\t- - bump high threshold UP by 0.25\n"
|
||||
"\t= - bump high threshold DOWN by 0.25\n"
|
||||
@@ -58,10 +58,10 @@ void help()
|
||||
"\t] - bump low threshold DOWN by 0.25\n"
|
||||
"=== CODEBOOK PARAMS ===\n"
|
||||
"\ty,u,v- only adjust channel 0(y) or 1(u) or 2(v) respectively\n"
|
||||
"\ta - adjust all 3 channels at once\n"
|
||||
"\tb - adjust both 2 and 3 at once\n"
|
||||
"\ti,o - bump upper threshold up,down by 1\n"
|
||||
"\tk,l - bump lower threshold up,down by 1\n"
|
||||
"\ta - adjust all 3 channels at once\n"
|
||||
"\tb - adjust both 2 and 3 at once\n"
|
||||
"\ti,o - bump upper threshold up,down by 1\n"
|
||||
"\tk,l - bump lower threshold up,down by 1\n"
|
||||
"\tSPACE - reset the model\n"
|
||||
);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ int main(int argc, const char** argv)
|
||||
int c, n, nframes = 0;
|
||||
|
||||
model = cvCreateBGCodeBookModel();
|
||||
|
||||
|
||||
//Set color thresholds to default values
|
||||
model->modMin[0] = 3;
|
||||
model->modMin[1] = model->modMin[2] = 3;
|
||||
@@ -127,12 +127,12 @@ int main(int argc, const char** argv)
|
||||
{
|
||||
rawImage = cvQueryFrame( capture );
|
||||
++nframes;
|
||||
if(!rawImage)
|
||||
if(!rawImage)
|
||||
break;
|
||||
}
|
||||
if( singlestep )
|
||||
pause = true;
|
||||
|
||||
|
||||
//First time:
|
||||
if( nframes == 1 && rawImage )
|
||||
{
|
||||
@@ -141,13 +141,13 @@ int main(int argc, const char** argv)
|
||||
ImaskCodeBook = cvCreateImage( cvGetSize(rawImage), IPL_DEPTH_8U, 1 );
|
||||
ImaskCodeBookCC = cvCreateImage( cvGetSize(rawImage), IPL_DEPTH_8U, 1 );
|
||||
cvSet(ImaskCodeBook,cvScalar(255));
|
||||
|
||||
|
||||
cvNamedWindow( "Raw", 1 );
|
||||
cvNamedWindow( "ForegroundCodeBook",1);
|
||||
cvNamedWindow( "CodeBook_ConnectComp",1);
|
||||
}
|
||||
|
||||
// If we've got an rawImage and are good to go:
|
||||
// If we've got an rawImage and are good to go:
|
||||
if( rawImage )
|
||||
{
|
||||
cvCvtColor( rawImage, yuvImage, CV_BGR2YCrCb );//YUV For codebook method
|
||||
@@ -157,14 +157,14 @@ int main(int argc, const char** argv)
|
||||
|
||||
if( nframes-1 == nframesToLearnBG )
|
||||
cvBGCodeBookClearStale( model, model->t/2 );
|
||||
|
||||
|
||||
//Find the foreground if any
|
||||
if( nframes-1 >= nframesToLearnBG )
|
||||
{
|
||||
// Find foreground by codebook method
|
||||
cvBGCodeBookDiff( model, yuvImage, ImaskCodeBook );
|
||||
// This part just to visualize bounding boxes and centers if desired
|
||||
cvCopy(ImaskCodeBook,ImaskCodeBookCC);
|
||||
cvCopy(ImaskCodeBook,ImaskCodeBookCC);
|
||||
cvSegmentFGMask( ImaskCodeBookCC );
|
||||
}
|
||||
//Display
|
||||
@@ -205,7 +205,7 @@ int main(int argc, const char** argv)
|
||||
case 'u': case '1':
|
||||
case 'v': case '2':
|
||||
case 'a': case '3':
|
||||
case 'b':
|
||||
case 'b':
|
||||
ch[0] = c == 'y' || c == '0' || c == 'a' || c == '3';
|
||||
ch[1] = c == 'u' || c == '1' || c == 'a' || c == '3' || c == 'b';
|
||||
ch[2] = c == 'v' || c == '2' || c == 'a' || c == '3' || c == 'b';
|
||||
@@ -230,8 +230,8 @@ int main(int argc, const char** argv)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cvReleaseCapture( &capture );
|
||||
cvDestroyWindow( "Raw" );
|
||||
cvDestroyWindow( "ForegroundCodeBook");
|
||||
|
Reference in New Issue
Block a user