稳定输出帧率,调整异常说明
Signed-off-by: AiYangSky <1732570904@qq.com>
This commit is contained in:
parent
07f7cac7b7
commit
0d3ba503e4
|
@ -1121,17 +1121,22 @@ bool CameraBase::read(cv::Mat& image)
|
|||
bool ret = false;
|
||||
if (this->_type == CameraType::WEBCAM || this->_type == CameraType::G1 || this->_type == CameraType::MIPI)
|
||||
{
|
||||
static int falseCount=0;
|
||||
std::lock_guard<std::mutex> locker(this->_frame_mutex);
|
||||
if(this->_frame_empty.wait_for(this->_frame_mutex,std::chrono::milliseconds(2000)) == std::cv_status::no_timeout)
|
||||
if(this->_frame_empty.wait_for(this->_frame_mutex,std::chrono::milliseconds(10)) == std::cv_status::timeout)
|
||||
{
|
||||
falseCount ++;
|
||||
if(falseCount >= 1000)
|
||||
{
|
||||
throw std::runtime_error("SpireCV (101) Camera has offline, check CAMERA!");
|
||||
}
|
||||
}
|
||||
else{
|
||||
falseCount = 0;
|
||||
}
|
||||
this->_frame.copyTo(image);
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("SpireCV (101) Camera cannot OPEN, check CAMERA_ID!");
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
// if (this->_type == CameraType::WEBCAM || this->_type == CameraType::G1 || this->_type == CameraType::MIPI)
|
||||
|
|
Loading…
Reference in New Issue