今晚将测试一晚上如果不显示是否还是会导致卡顿

This commit is contained in:
2024-05-21 01:26:00 +08:00
parent ed55e511ec
commit cc59a989b1
31 changed files with 287 additions and 245 deletions
@@ -3,7 +3,6 @@
#include <jsonParsing.h>
#include <qlibrary.h>
#include <windows.h>
#include <MvCameraControl.h>
#include <CameraParams.h>
static QByteArray MV_CC_DeviceInfoListToQByteArray(const MV_CC_DEVICE_INFO_LIST& deviceInfoList) {
@@ -30,6 +29,46 @@ static MV_CC_DEVICE_INFO_LIST searchMvDevice()
return m_stDevList;
}
camera::camera(cameraModule cameraModulePtrIn, backEndController* backEndControllerIn, int indexIn)
{
cameraModulePtr = cameraModulePtrIn;
cameraName = cameraModulePtr.key;
index = indexIn;
this->start();
}
void camera::run()
{
QThread::msleep(2000);
std::vector<cv::Mat>camera_mat;
while (runFlag)
{
getCameraImg(camera_mat);
if (camera_mat.size() > 0)
{
int size = imgQueue.size();
for (auto img : camera_mat)
{
imgQueue.enqueue(img);
//emit _backEndController->sendPixmapImageWidgetByIndex(cvMatToQPixMap(img), imgWidgetOri, index);
QPixmap pixmap;
cvMatToQPixMap(img, pixmap);
showImgPack* pack = new showImgPack();
pack->img = pixmap;
pack->type = imgWidgetOri;
pack->index = index;
emit S1(pack);
}
//防止过大
//while (imgQueue.size() > 0)
//{
// imgQueue.dequeue();
//}
}
QThread::msleep(100);
}
}
cameraController::~cameraController()
{
for (auto camera : cameras)
@@ -93,13 +132,16 @@ void cameraController::init(backEndController* input)
if (m_module.module_ptr->initParas(initByte))
{
camera* _camera = new camera(m_module);
camera* _camera = new camera(m_module,_backEndController, cameras.size());
QObject::connect(_camera, &camera::S1, this, &cameraController::R1);
cameras.insert(std::make_pair(m_module.key, _camera));
qDebug() << "[INFO] " << " initParas success!";
}
else
qCritical() << "[Error] " << " moduleName:" << m_module.moduleName << " initParas failed!";
}
this->start();
}
bool cameraController::loadModule(QString keyName, QString moduleName, QByteArray initByte)
{
@@ -163,4 +205,8 @@ bool cameraController::loadModule(QString keyName, QString moduleName, QByteArra
}
return true;
}
void cameraController::R1(showImgPack* pack)
{
emit _backEndController->sendPixmapImageWidget(pack);
}