mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 17:07:39 +08:00
Only accept filenames in daemon
This commit is contained in:
30
src/main.cpp
30
src/main.cpp
@@ -113,38 +113,12 @@ int main( int argc, const char** argv )
|
|||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
{
|
{
|
||||||
std::string line;
|
std::string filename;
|
||||||
while (std::getline(std::cin, line))
|
while (std::getline(std::cin, filename))
|
||||||
{
|
{
|
||||||
std::istringstream is(line);
|
|
||||||
std::vector<std::string> args;
|
|
||||||
args.push_back("tmp");
|
|
||||||
args.insert(args.end(), std::istream_iterator<std::string>(is), std::istream_iterator<std::string>());
|
|
||||||
try
|
|
||||||
{
|
|
||||||
cmd.reset();
|
|
||||||
cmd.parse(args);
|
|
||||||
|
|
||||||
filename = fileArg.getValue();
|
|
||||||
outputJson = jsonSwitch.getValue();
|
|
||||||
detectRegion = detectRegionSwitch.getValue();
|
|
||||||
templateRegion = templateRegionArg.getValue();
|
|
||||||
topn = topNArg.getValue();
|
|
||||||
|
|
||||||
alpr.setTopN(topn);
|
|
||||||
if (detectRegion)
|
|
||||||
alpr.setDetectRegion(detectRegion);
|
|
||||||
if (templateRegion.empty() == false)
|
|
||||||
alpr.setDefaultRegion(templateRegion);
|
|
||||||
|
|
||||||
frame = cv::imread( filename );
|
frame = cv::imread( filename );
|
||||||
detectandshow( &alpr, frame, "", outputJson);
|
detectandshow( &alpr, frame, "", outputJson);
|
||||||
}
|
}
|
||||||
catch (TCLAP::ArgException &e) // catch any exceptions
|
|
||||||
{
|
|
||||||
std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (filename == "webcam")
|
else if (filename == "webcam")
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user