mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2024-05-30 09:34:03 +08:00
Merge pull request #398 from Max13/read_pipe
Added read from piped standard input support
This commit is contained in:
commit
ab1a9e20ab
22
src/main.cpp
22
src/main.cpp
@ -145,7 +145,27 @@ int main( int argc, const char** argv )
|
||||
{
|
||||
std::string filename = filenames[i];
|
||||
|
||||
if (filename == "stdin")
|
||||
if (filename == "-")
|
||||
{
|
||||
std::vector<uchar> data;
|
||||
int c;
|
||||
|
||||
while ((c = fgetc(stdin)) != EOF)
|
||||
{
|
||||
data.push_back((uchar) c);
|
||||
}
|
||||
|
||||
frame = cv::imdecode(cv::Mat(data), 1);
|
||||
if (!frame.empty())
|
||||
{
|
||||
detectandshow(&alpr, frame, "", outputJson);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Image invalid: " << filename << std::endl;
|
||||
}
|
||||
}
|
||||
else if (filename == "stdin")
|
||||
{
|
||||
std::string filename;
|
||||
while (std::getline(std::cin, filename))
|
||||
|
Loading…
Reference in New Issue
Block a user