From dd01af3146055523e543154fd89d1b0d3d06dab6 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 14 Jan 2016 21:50:30 -0500 Subject: [PATCH] Added debug flag to toggle debug options without having to edit config --- src/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 1fc1183..c21bcff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -63,6 +63,7 @@ int main( int argc, const char** argv ) bool detectRegion = false; std::string country; int topn; + bool debug_mode = false; TCLAP::CmdLine cmd("OpenAlpr Command Line Utility", ' ', Alpr::getVersion()); @@ -76,6 +77,7 @@ int main( int argc, const char** argv ) TCLAP::ValueArg topNArg("n","topn","Max number of possible plate numbers to return. Default=10",false, 10 ,"topN"); TCLAP::SwitchArg jsonSwitch("j","json","Output recognition results in JSON format. Default=off", cmd, false); + TCLAP::SwitchArg debugSwitch("","debug","Enable debug output. Default=off", cmd, false); TCLAP::SwitchArg detectRegionSwitch("d","detect_region","Attempt to detect the region of the plate image. [Experimental] Default=off", cmd, false); TCLAP::SwitchArg clockSwitch("","clock","Measure/print the total time to process image and all plates. Default=off", cmd, false); TCLAP::SwitchArg motiondetect("", "motion", "Use motion detection on video file or stream. Default=off", cmd, false); @@ -101,6 +103,7 @@ int main( int argc, const char** argv ) country = countryCodeArg.getValue(); seektoms = seekToMsArg.getValue(); outputJson = jsonSwitch.getValue(); + debug_mode = debugSwitch.getValue(); configFile = configFileArg.getValue(); detectRegion = detectRegionSwitch.getValue(); templatePattern = templatePatternArg.getValue(); @@ -119,6 +122,11 @@ int main( int argc, const char** argv ) Alpr alpr(country, configFile); alpr.setTopN(topn); + + if (debug_mode) + { + alpr.getConfig()->setDebug(true); + } if (detectRegion) alpr.setDetectRegion(detectRegion);