mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 23:06:56 +08:00
Fix for alprd to allow input as /dev/video* where * is a number that corolate to the webcam on the system.
Tested on OSX and Debian system (Ubuntu and RPI).
This commit is contained in:
25
src/main.cpp
25
src/main.cpp
@@ -161,6 +161,31 @@ int main( int argc, const char** argv )
|
||||
|
||||
}
|
||||
}
|
||||
else if (startsWith(filename, "/dev/video"))
|
||||
{
|
||||
int webcamnumber = 0;
|
||||
if(filename.length() > 10)
|
||||
{
|
||||
std::string webcam_str_num;
|
||||
for(int a = 11; a <= filename.length(); a=a+1)
|
||||
{
|
||||
webcam_str_num.append(filename,a,1);
|
||||
}
|
||||
int webcamnumber = atoi(webcam_str_num.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Incorrect Webcam Address" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
int framenum = 0;
|
||||
cv::VideoCapture cap(webcamnumber);
|
||||
if (!cap.isOpened())
|
||||
{
|
||||
std::cout << "Error opening webcam" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (filename == "webcam")
|
||||
{
|
||||
int framenum = 0;
|
||||
|
Reference in New Issue
Block a user