mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-11-03 11:50:51 +08:00
Added support for webcam in the form of /dev/video[number] to alprd
This commit is contained in:
@@ -108,7 +108,17 @@ void imageCollectionThread(void* arg)
|
||||
cv::VideoCapture cap=cv::VideoCapture();
|
||||
dispatcher->log_info("Video stream connecting...");
|
||||
|
||||
if (dispatcher->mjpeg_url == "webcam")
|
||||
// Check if it's a webcam, if so, pass the device ID
|
||||
std::string video_prefix = "/dev/video";
|
||||
if (startsWith(dispatcher->mjpeg_url, video_prefix))
|
||||
{
|
||||
std::string device_number_str = dispatcher->mjpeg_url.substr(video_prefix.length());
|
||||
dispatcher->log_info("Opening webcam video device " + device_number_str);
|
||||
|
||||
int webcam_number = atoi(device_number_str.c_str());
|
||||
cap.open(webcam_number);
|
||||
}
|
||||
else if (dispatcher->mjpeg_url == "webcam")
|
||||
{
|
||||
cap.open(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user