mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 02:52:50 +08:00
Merge branch 'master' of https://github.com/Kees-V/openalpr into Kees-V-master
This commit is contained in:
@@ -149,7 +149,10 @@ void imageCollectionThread(void* arg)
|
|||||||
// it returns so that the video capture can be recreated.
|
// it returns so that the video capture can be recreated.
|
||||||
void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
|
void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
|
||||||
{
|
{
|
||||||
cv::Mat frame;
|
cv::Mat frame1;
|
||||||
|
cv::Mat frame2;
|
||||||
|
cv::Mat* receiveframe;
|
||||||
|
bool receiveframeisframe1 = true;
|
||||||
|
|
||||||
while (dispatcher->active)
|
while (dispatcher->active)
|
||||||
{
|
{
|
||||||
@@ -159,9 +162,11 @@ void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
|
|||||||
bool hasImage = false;
|
bool hasImage = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
hasImage = cap.read(frame);
|
if (receiveframeisframe1) receiveframe = &frame1;
|
||||||
|
else receiveframe = &frame2;
|
||||||
|
hasImage = cap.read(*receiveframe);
|
||||||
// Double check the image to make sure it's valid.
|
// Double check the image to make sure it's valid.
|
||||||
if (!frame.data || frame.empty())
|
if (!(*receiveframe).data || (*receiveframe).empty())
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Stream " << dispatcher->mjpeg_url << " received invalid frame";
|
ss << "Stream " << dispatcher->mjpeg_url << " received invalid frame";
|
||||||
@@ -170,8 +175,9 @@ void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dispatcher->mMutex.lock();
|
dispatcher->mMutex.lock();
|
||||||
dispatcher->setLatestFrame(&frame);
|
dispatcher->setLatestFrame(receiveframe);
|
||||||
dispatcher->mMutex.unlock();
|
dispatcher->mMutex.unlock();
|
||||||
|
receiveframeisframe1 = !receiveframeisframe1;
|
||||||
}
|
}
|
||||||
catch (const std::runtime_error& error)
|
catch (const std::runtime_error& error)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user