mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 22:32:43 +08:00
Added error message when input image/video file is not found
This commit is contained in:
15
src/main.cpp
15
src/main.cpp
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <valarray>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
@@ -138,6 +139,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hasEnding(filename, ".avi") || hasEnding(filename, ".mp4") || hasEnding(filename, ".webm") || hasEnding(filename, ".flv"))
|
else if (hasEnding(filename, ".avi") || hasEnding(filename, ".mp4") || hasEnding(filename, ".webm") || hasEnding(filename, ".flv"))
|
||||||
|
{
|
||||||
|
if (fileExists(filename.c_str()))
|
||||||
{
|
{
|
||||||
int framenum = 0;
|
int framenum = 0;
|
||||||
|
|
||||||
@@ -158,13 +161,25 @@
|
|||||||
cv::waitKey(1);
|
cv::waitKey(1);
|
||||||
framenum++;
|
framenum++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Video file not found: " << filename << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (hasEnding(filename, ".png") || hasEnding(filename, ".jpg") || hasEnding(filename, ".gif"))
|
else if (hasEnding(filename, ".png") || hasEnding(filename, ".jpg") || hasEnding(filename, ".gif"))
|
||||||
|
{
|
||||||
|
if (fileExists(filename.c_str()))
|
||||||
{
|
{
|
||||||
frame = cv::imread( filename );
|
frame = cv::imread( filename );
|
||||||
|
|
||||||
detectandshow( &alpr, frame, "", outputJson);
|
detectandshow( &alpr, frame, "", outputJson);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Image file not found: " << filename << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user