稳定备份 更新顶盖逻辑

This commit is contained in:
2025-08-31 16:51:18 +08:00
parent aae60af637
commit 22e6be7afb
162 changed files with 4420 additions and 145154 deletions
@@ -337,7 +337,8 @@ void CloseDevice()
{
unsigned int nRet = MV_CC_StopGrabbing(handle);
CloseHandle(handle);
if(nRet == 0)
CloseHandle(handle);
//nRet = MV_CC_CloseDevice(handle);
//nRet = MV_CC_DestroyHandle(handle);
}
@@ -363,6 +364,7 @@ bool Hd_CameraModule_HIK_hard_PCIE::readData(std::vector<cv::Mat>& mat, QByteArr
n_mutex->lock();
cv::Mat img = queuepic.dequeue();
mat.push_back(img);
queuepic.clear();
n_mutex->unlock();
qDebug() << "[INFO] " << __FUNCTION__ << " line:" << __LINE__ << " checkImg readData--CameraName:" << QString::fromStdString(Username) << "--imgIndex : " << imgIndex;
@@ -502,7 +504,7 @@ bool Hd_CameraModule_HIK_hard_PCIE::initParas(QByteArray& initData)
bool Hd_CameraModule_HIK_hard_PCIE::run()
{
queuepic.clear();
qDebug() << "[INFO] " << " run start" << QString::fromStdString(Username);
bool result = false;
ifRunning = true;
@@ -511,17 +513,6 @@ bool Hd_CameraModule_HIK_hard_PCIE::run()
{
m_flag = false;
int mytime = 0;
if (imgShouldGetIndex < imgShouldGetVec.size()) {
if (imgShouldGetVec[imgShouldGetIndex] == 0) {
n_mutex->lock();
queuepic.push_back(cv::Mat(200, 200, CV_8UC3, cv::Scalar(0, 0, 255))); //返回空图
std::cout << "red" << std::endl;
n_mutex->unlock();
imgShouldGetIndex++;
return true;
}
imgShouldGetIndex++;
}
int cnt = 0;
while (true)
{
@@ -530,22 +521,22 @@ bool Hd_CameraModule_HIK_hard_PCIE::run()
result = false;
break;
}*/
n_mutex->lock();
cnt++;
if (queuepic.size() > 1)
if (queuepic.size() > 0)
{
n_mutex->unlock();
result = true;
std::cout << "\n gotImg" << std::endl;
break;
}
if (cnt > 2000) {
queuepic.push_back(cv::Mat(200, 200, CV_8UC3, cv::Scalar(0, 255, 0))); //返回空图
n_mutex->lock();
queuepic.push_back(cv::imread("D://Image_20250809202445856.bmp", -1));
//queuepic.push_back(cv::Mat(200, 200, CV_8UC3, cv::Scalar(0, 255, 0))); //返回空图
std::cout << "timeout" << std::endl;
n_mutex->unlock();
return true;
}
n_mutex->unlock();
QThread::msleep(1);
}
//考虑到误触发、漏触发的图,在这里进行设置。