Added clock parameter

This commit is contained in:
Matt Hill
2014-07-03 13:24:51 -04:00
parent 0562cf0f24
commit d31ff432cc

View File

@@ -41,6 +41,8 @@ struct CaptureThreadData
std::string site_id; std::string site_id;
int camera_id; int camera_id;
bool clock_on;
std::string config_file; std::string config_file;
std::string country_code; std::string country_code;
bool output_images; bool output_images;
@@ -62,6 +64,7 @@ int main( int argc, const char** argv )
daemon_active = true; daemon_active = true;
bool noDaemon = false; bool noDaemon = false;
bool clockOn = false;
std::string logFile; std::string logFile;
int topn; int topn;
@@ -76,6 +79,7 @@ int main( int argc, const char** argv )
TCLAP::ValueArg<std::string> logFileArg("l","log","Log file to write to. Default=" + DEFAULT_LOG_FILE_PATH,false, DEFAULT_LOG_FILE_PATH ,"topN"); TCLAP::ValueArg<std::string> logFileArg("l","log","Log file to write to. Default=" + DEFAULT_LOG_FILE_PATH,false, DEFAULT_LOG_FILE_PATH ,"topN");
TCLAP::SwitchArg daemonOffSwitch("f","foreground","Set this flag for debugging. Disables forking the process as a daemon and runs in the foreground. Default=off", cmd, false); TCLAP::SwitchArg daemonOffSwitch("f","foreground","Set this flag for debugging. Disables forking the process as a daemon and runs in the foreground. Default=off", cmd, false);
TCLAP::SwitchArg clockSwitch("","clock","Display timing information to log. Default=off", cmd, false);
try try
{ {
@@ -96,6 +100,7 @@ int main( int argc, const char** argv )
logFile = logFileArg.getValue(); logFile = logFileArg.getValue();
topn = topNArg.getValue(); topn = topNArg.getValue();
noDaemon = daemonOffSwitch.getValue(); noDaemon = daemonOffSwitch.getValue();
clockOn = clockSwitch.getValue();
} }
catch (TCLAP::ArgException &e) // catch any exceptions catch (TCLAP::ArgException &e) // catch any exceptions
{ {
@@ -184,6 +189,7 @@ int main( int argc, const char** argv )
tdata->country_code = country; tdata->country_code = country;
tdata->site_id = site_id; tdata->site_id = site_id;
tdata->top_n = topn; tdata->top_n = topn;
tdata->clock_on = clockOn;
tthread::thread* thread_recognize = new tthread::thread(streamRecognitionThread, (void*) tdata); tthread::thread* thread_recognize = new tthread::thread(streamRecognitionThread, (void*) tdata);
@@ -250,9 +256,10 @@ void streamRecognitionThread(void* arg)
getTime(&endTime); getTime(&endTime);
double totalProcessingTime = diffclock(startTime, endTime); double totalProcessingTime = diffclock(startTime, endTime);
std::stringstream ss; if (tdata->clock_on)
ss << "Processed frame in: " << totalProcessingTime << " ms."; {
LOG4CPLUS_INFO(logger, ss.str()); LOG4CPLUS_INFO(logger, "Camera " << tdata->camera_id << " processed frame in: " << totalProcessingTime << " ms.");
}
if (results.size() > 0) if (results.size() > 0)
{ {