forked from floratest1/SpireCV
fix video reading skipping
This commit is contained in:
@@ -1185,8 +1185,11 @@ void CameraBase::_run()
|
||||
{
|
||||
while (this->_is_running && this->_cap.isOpened())
|
||||
{
|
||||
this->_cap >> this->_frame;
|
||||
this->_is_updated = true;
|
||||
if (this->_type != CameraType::VIDEO || this->_is_updated == false)
|
||||
{
|
||||
this->_cap >> this->_frame;
|
||||
this->_is_updated = true;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
||||
}
|
||||
}
|
||||
@@ -1199,8 +1202,8 @@ bool CameraBase::read(cv::Mat& image)
|
||||
{
|
||||
if (this->_is_updated)
|
||||
{
|
||||
this->_is_updated = false;
|
||||
this->_frame.copyTo(image);
|
||||
this->_is_updated = false;
|
||||
break;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
|
||||
Reference in New Issue
Block a user