diff --git a/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp b/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp index b96a3438..f912063c 100644 --- a/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp +++ b/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp @@ -546,7 +546,7 @@ void algoThread::run() Camera1_Algo(data); break; } - oriSaveThread->saveOriImg(data);//ä¿�存原图 + //oriSaveThread->saveOriImg(data);//ä¿�存原图 auto end = std::chrono::high_resolution_clock::now(); auto duration = std::chrono::duration_cast(end - start); @@ -556,7 +556,7 @@ void algoThread::run() // data->SNcode = snDatas->waitForSn(data->timeCode); if (data->resultImgs.size() > 0) { - resSaveThread->saveResImg(data);//ä¿�存结果图 + //resSaveThread->saveResImg(data);//ä¿�存结果图 bridge.front.showImg("Algorithm", data->resultImgs[0], threadId);//显示原图 //cout << "algoEnd" << data->algoThreadIndex; } diff --git a/HanddleAI/HandleAiUi-new/back/algorithmThread.h b/HanddleAI/HandleAiUi-new/back/algorithmThread.h index 49c396b0..ec13055c 100644 --- a/HanddleAI/HandleAiUi-new/back/algorithmThread.h +++ b/HanddleAI/HandleAiUi-new/back/algorithmThread.h @@ -715,10 +715,7 @@ public: handleAiModel* modelPtr; sqlController* sql; threadConroller* tController; - imgSaveThread* oriSaveThread; - imgSaveThread* resSaveThread; sncodeCls* snDatas; - cameraImages* cameraImgs; QMutex detQueueMutex; QQueue detQueue; @@ -736,10 +733,7 @@ public: tController = threadConroller; modelPtr = &threadConroller->models; sql = threadConroller->sql; - oriSaveThread = threadConroller->oriSaveThread; - resSaveThread = threadConroller->resSaveThread; snDatas = &threadConroller->snDatas; - cameraImgs = &threadConroller->cameraImgs; } bool addDetTask(detData*);//Ìí¼ÓÈÎÎñ diff --git a/HanddleAI/HandleAiUi-new/back/backEndController.cpp b/HanddleAI/HandleAiUi-new/back/backEndController.cpp index 5844785d..a9709bba 100644 --- a/HanddleAI/HandleAiUi-new/back/backEndController.cpp +++ b/HanddleAI/HandleAiUi-new/back/backEndController.cpp @@ -8,6 +8,7 @@ backEndController::backEndController() _jsonConfiguration = new jsonConfiguration(); _triggerController = new triggerController(); _cameraController = new cameraController(); + _threadConroller = new threadConroller(); std::vector> futures;//Òì²½³õʼ»¯ futures.push_back(std::async(std::launch::async, &triggerController::init, _triggerController, this)); futures.push_back(std::async(std::launch::async, &cameraController::init, _cameraController, this)); diff --git a/HanddleAI/HandleAiUi-new/back/backEndController.h b/HanddleAI/HandleAiUi-new/back/backEndController.h index 2338d776..dc7ed763 100644 --- a/HanddleAI/HandleAiUi-new/back/backEndController.h +++ b/HanddleAI/HandleAiUi-new/back/backEndController.h @@ -5,14 +5,17 @@ class triggerController; class cameraController; class jsonConfiguration; +class threadConroller; class backEndController :public QObject { Q_OBJECT public: bool init = false; + jsonConfiguration* _jsonConfiguration; + triggerController* _triggerController;//´¥·¢Æ÷ cameraController* _cameraController; - jsonConfiguration* _jsonConfiguration; + threadConroller* _threadConroller; backEndController(); ~backEndController(); signals: diff --git a/HanddleAI/HandleAiUi-new/back/backStruct.h b/HanddleAI/HandleAiUi-new/back/backStruct.h index c359208b..6a58e714 100644 --- a/HanddleAI/HandleAiUi-new/back/backStruct.h +++ b/HanddleAI/HandleAiUi-new/back/backStruct.h @@ -1,9 +1,10 @@ #include +#include typedef Base* (*CreateFunction)(); typedef void (*ReleaseFunction)(Base* animal); -struct correctionStructx +struct correctionStruct { std::vector in_X_X0Y; std::vector in_Y_X0Y; @@ -29,4 +30,30 @@ typedef struct { ReleaseFunction destory_ptr; // ÊÍ·Å int showIndex; }cameraModule; + +static void createDirectoryIfNotExists(const std::string& path) { + // ¼ì²é·¾¶ÊÇ·ñ´æÔÚ + if (!std::filesystem::exists(path)) { + // ´´½¨Â·¾¶ + + std::filesystem::create_directories(path); + //std::cout << "ÒÑ´´½¨Îļþ¼Ð: " << path << std::endl; + } + else {/* + std::cout << "Îļþ¼ÐÒÑ´æÔÚ: " << path << std::endl;*/ + } +} +static std::string getCurrentDateTime() { + + // »ñÈ¡µ±Ç°Ê±¼äµã + auto now = std::chrono::system_clock::now(); + + // ת»»Îª×Ö·û´® + auto currentTime = std::chrono::system_clock::to_time_t(now); + auto ms = std::chrono::duration_cast(now.time_since_epoch()) % 100; + std::tm* localTime = std::localtime(¤tTime); + std::stringstream ss; + ss << std::put_time(localTime, "%H-%M-%S") << "-" << std::setfill('0') << std::setw(2) << ms.count(); + return ss.str(); +} #pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/back/cameraController.cpp b/HanddleAI/HandleAiUi-new/back/cameraController.cpp index de01354a..166c769b 100644 --- a/HanddleAI/HandleAiUi-new/back/cameraController.cpp +++ b/HanddleAI/HandleAiUi-new/back/cameraController.cpp @@ -44,14 +44,13 @@ void camera::run() while (runFlag) { getCameraImg(camera_mat); - if (camera_mat.size() > 0) + while(camera_mat.size()>0) { int size = imgQueue.size(); for (auto img : camera_mat) { imgQueue.enqueue(img); - //emit _backEndController->sendPixmapImageWidgetByIndex(cvMatToQPixMap(img), imgWidgetOri, index); - if (lastUpdateTime.elapsed() > 200) + if (lastUpdateTime.elapsed() > 200)//ÏÔʾÔÚ½çÃæ { lastUpdateTime.start(); // ¼Ç¼±¾´Î¸üÐÂʱ¼ä QPixmap pixmap; @@ -62,13 +61,37 @@ void camera::run() pack->index = index; emit S1(pack); } + else + { + showLost++; + qDebug() << cameraModulePtr.moduleName << "Lost show"; + } + camera_mat.clear(); } //·ÀÖ¹¹ý´ó - //while (imgQueue.size() > 0) - //{ - // imgQueue.dequeue(); - //} + while (imgQueue.size() > 5) + { + imgQueue.dequeue(); + imgLost++; + qDebug() << cameraModulePtr.moduleName << "Lost img"; + } + + getCameraImg(camera_mat); + } + if (data != nullptr) + { + data->mutex->lock(); + int imgCnt = data->imgAmountMin; + getCameraImg(camera_mat); + while (camera_mat.size() > 0) + { + for (auto img : camera_mat) + { + + } + } + data->mutex->unlock(); } QThread::msleep(100); } diff --git a/HanddleAI/HandleAiUi-new/back/cameraController.h b/HanddleAI/HandleAiUi-new/back/cameraController.h index aefb4371..e000139b 100644 --- a/HanddleAI/HandleAiUi-new/back/cameraController.h +++ b/HanddleAI/HandleAiUi-new/back/cameraController.h @@ -11,6 +11,8 @@ #include #include #include +#include +//Ó²´¥·¢ÒªÇóÔÚ´¥·¢Ïà»úǰ¸ø³ö´¥·¢ÐźŠclass backEndController; class camera : public QThread { @@ -25,12 +27,14 @@ public: QThread::msleep(2000); } void run(); - void getCameraImg(std::vector& mats) + void getImgQueueSize(); + + void Process(detData* dataIn) { - QByteArray task_name; - if (cameraModulePtr.module_ptr->sendData(mats, task_name)) - qDebug() << __FUNCTION__ << " line:" << __LINE__ << "camera_mat size:" << mats.size(); + data = dataIn; } + + //Ïà»ú²Ù×÷ bool trigger() { if (!cameraModulePtr.module_ptr->run()) @@ -40,15 +44,46 @@ public: } return true; } - void getImgQueueSize(); + void getCameraImg(std::vector& mats) + { + QByteArray task_name; + if (cameraModulePtr.module_ptr->sendData(mats, task_name)) + qDebug() << __FUNCTION__ << " line:" << __LINE__ << "camera_mat size:" << mats.size(); + } + void setDigitalShift(float value) + { + sendData("DigitalShift_" + std::to_string(value)); + } + void setExposureTime(float value) + { + sendData("exposure_" + std::to_string(value)); + } + void setUserSet(int value) + { + sendData("userset_" + std::to_string(value)); + } + signals: void S1(showImgPack*); private: + detData* data = nullptr; + void sendData(std::string str) + { + QByteArray task_name(QByteArray::fromStdString(str)); + std::vector camera_mat; + if (!cameraModulePtr.module_ptr->sendData(camera_mat, task_name)) + qCritical() << "[Error] " << "set exposure error!"; + } + int index = 0; + int timeout = 5000; cameraModule cameraModulePtr; QQueueimgQueue; backEndController* _backEndController; bool runFlag = true; + + int imgLost = 0;//δȡÓôӶø¶ªÊ§µÄͼƬÊýÁ¿ + int showLost = 0;//ÒòΪ´°¿ÚË¢ÐÂËÙÂʵͶøÎ´ÏÔʾµÄÊýÁ¿ }; class cameraController : public QThread { @@ -59,14 +94,14 @@ public: std::unordered_mapcameras;//key Ïà»úÃû void run() { - while (1) - { - QThread::msleep(300); - for (auto camera : cameras) - { - camera.second->trigger(); - } - } + //while (1) + //{ + // //QThread::msleep(300); + // //for (auto camera : cameras) + // //{ + // // camera.second->trigger(); + // //} + //} } private: bool loadModule(QString keyName, QString moduleName, QByteArray initByte); @@ -77,6 +112,15 @@ private: QList lib_list; public slots: void R1(showImgPack*); + void cameraTrigger(QString Name) + { + auto camera=cameras.find(Name); + if (camera != cameras.end()) + { + camera->second->trigger(); + } + } }; + #endif \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.cpp b/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.cpp new file mode 100644 index 00000000..dd777bda --- /dev/null +++ b/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.cpp @@ -0,0 +1,12 @@ +#include +#include +#include + +imgSaveThreadController::imgSaveThreadController(backEndController* backEndControllerIn) +{ + _backEndController = backEndControllerIn; + + QString str = _backEndController->_jsonConfiguration->imgSavePath; + oriSaveThread = new imgSaveThread(oriImgSaveThread,str); + resSaveThread = new imgSaveThread(resImgSaveThread,str); +} diff --git a/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.h b/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.h new file mode 100644 index 00000000..ea53b606 --- /dev/null +++ b/HanddleAI/HandleAiUi-new/back/imgSaveThreadController.h @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include +class backEndController; +enum imgSaveThreadType +{ + oriImgSaveThread, + resImgSaveThread +}; +class imgSaveThread :public QThread +{ +public: + struct imgSaveStruct { + std::string cameraKeyName; + std::string SNcode; + std::string customName; + std::string format;//Áô¿ÕÔò°´Ô­Í¼bmp£¬½á¹ûͼjpg + int showIndex = -1; + unsigned long long timeCode; + std::vectorimgs; + + }; + ~imgSaveThread() + { + runFlag = false; + while (this->isRunning() == true); + qDebug() << "imgSaveThread Ended"; + } + imgSaveThread(imgSaveThreadType typeIn,QString pathIn) + { + type = typeIn; + switch (type) + { + case oriImgSaveThread: + path = (pathIn).toStdString() + "//yuantu//"; + break; + case resImgSaveThread: + path = (pathIn).toStdString() + "//result//"; + break; + } + } + void run() + { + while (runFlag) + { + while (imgQueue.size()>0) + saveImg(imgQueue.dequeue()); + QThread::msleep(100); + } + } + void saveImg(imgSaveStruct& data) + { + try + { + //¸ù¾Ýʱ¼ä»ñÈ¡´ó¸Å·¾¶ + sqlTableDatas sqlRes = sql->selectSingleData("saveHour", data.SNcode);//²éÕÒ֮ǰµÄÊý¾Ý + std::string fileSavePath = path; + if (sqlRes.rowDatas.size() > 0 && sqlRes.rowDatas[0][0].value != "")//Êý¾Ý´æÔÚ + { + fileSavePath += sqlRes.tableName + "//" + sqlRes.rowDatas[0][0].value + "H//"; + } + else//Êý¾Ý²»´æÔÚ Ð½¨Êý¾Ý + { + QDateTime currentDateTime = QDateTime::currentDateTime(); + std::string ymd = currentDateTime.toString("yyyy-MM-dd").toStdString(); + int h = currentDateTime.time().hour(); + fileSavePath += ymd + "//" + std::to_string(h) + "H//"; + sql->addData(data.SNcode, { { "saveHour",std::to_string(h) } }); + } + + //ÓÐSNÂë¾Í´¢´æÔÚSNÂë·¾¶£¬ÎÞÔò´¢´æÔÚÏà»ú·¾¶ + if ((data.SNcode).length() != 0) + fileSavePath += data.SNcode + "//"; + else + fileSavePath += data.cameraKeyName + "//"; + + createDirectoryIfNotExists(fileSavePath);//Îļþ¼Ð´¦Àí + std::string fileName; + { + for (int i = 0; i < data.imgs.size(); i++) + { + fileName = data.cameraKeyName + "_" + getCurrentDateTime() + "_Count" + std::to_string(i) + ".jpg"; + cv::imwrite(fileSavePath + fileName, data.imgs[i]); + qInfo() << QString::fromStdString(data.cameraKeyName + " ori:" + fileSavePath + fileName); + } + } + } + catch (...) + { + return; + } + } + +private: + QQueue imgQueue; + + std::string path = ""; + std::string basicFormat = ""; + imgSaveThreadType type; + sqlController* sql; + bool runFlag = true; +}; +class imgSaveThreadController +{ +public: + imgSaveThreadController(backEndController* backEndControllerIn); +private: + backEndController* _backEndController; + imgSaveThread* oriSaveThread; + imgSaveThread* resSaveThread; +}; +#pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolController.cpp b/HanddleAI/HandleAiUi-new/back/threadPoolController.cpp index c2b97494..2f82beb5 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolController.cpp +++ b/HanddleAI/HandleAiUi-new/back/threadPoolController.cpp @@ -33,37 +33,6 @@ std::string getCurrentDateTime_2() { } int threadAmount = 0; int maxThread = 16; -/// -/// »ñÈ¡µ±Ç°Ê±¼äµã£¬ÒÔ"Сʱ-·ÖÖÓ-Ãë"·µ»Ø -/// -/// -std::string getCurrentDateTime() { - // »ñÈ¡µ±Ç°Ê±¼äµã - std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); - - // ת»»Îª×Ö·û´® - std::time_t currentTime = std::chrono::system_clock::to_time_t(now); - std::tm* localTime = std::localtime(¤tTime); - std::stringstream ss; - ss << std::put_time(localTime, "%H-%M-%S"); - - return ss.str(); -} -/// -/// ¼ì²éÄ¿±êÎļþ¼ÐÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò´´½¨ -/// -/// -void createDirectoryIfNotExists(const std::string& path) { - // ¼ì²é·¾¶ÊÇ·ñ´æÔÚ - if (!std::filesystem::exists(path)) { - // ´´½¨Â·¾¶ - std::filesystem::create_directories(path); - //std::cout << "ÒÑ´´½¨Îļþ¼Ð: " << path << std::endl; - } - else {/* - std::cout << "Îļþ¼ÐÒÑ´æÔÚ: " << path << std::endl;*/ - } -} ////////////THREAD//CONTROLLER//////////////////////// threadConroller::threadConroller(QObject* parent) : QThread(parent) @@ -72,10 +41,10 @@ threadConroller::threadConroller(QObject* parent) : QThread(parent) sql = new sqlController; sql->initPara(); //¸¨ÖúÏ̳߳õʼ»¯ - oriSaveThread->oriThread = true; - oriSaveThread->Init(this); + //oriSaveThread->oriThread = true; + //oriSaveThread->Init(this); - resSaveThread->Init(this); + //resSaveThread->Init(this); threadAmount = bridge.back.json.algoThreads.algoDataMap.size(); for (int i = 0; i < threadAmount; i++) { @@ -215,135 +184,6 @@ threadConroller::~threadConroller() delete thread; } } -////////////////SUBTHREAD//////////////////////// -bool folderExists(const std::string& folderPath) { - return std::filesystem::is_directory(folderPath); -} -void imgSaveThread::Init(threadConroller* tC) -{ - sql = tC->sql; - snDatas = &tC->snDatas; -} -void imgSaveThread::saveOriginalImg(imgSaveStruct& data) -{ - //¸ù¾Ýʱ¼ä»ñÈ¡´ó¸Å·¾¶ - sqlTableDatas sqlRes = sql->selectSingleData("saveHour", data.SNcode);//²éÕÒ֮ǰµÄÊý¾Ý - std::string fileSavePath = bridge.back.json.imgSavePath.toStdString(); - if (sqlRes.rowDatas.size() > 0 && sqlRes.rowDatas[0][0].value != "")//Êý¾Ý´æÔÚ - { - fileSavePath += "//yuantu//" + sqlRes.tableName + "//" + sqlRes.rowDatas[0][0].value + "H//"; - } - else//Êý¾Ý²»´æÔÚ Ð½¨Êý¾Ý - { - QDateTime currentDateTime = QDateTime::currentDateTime(); - std::string ymd = currentDateTime.toString("yyyy-MM-dd").toStdString(); - int h = currentDateTime.time().hour(); - fileSavePath += "//yuantu//" + ymd + "//" + to_string(h) + "H//"; - sql->addData(data.SNcode, { { "saveHour",to_string(h) } }); - } - - if ((data.SNcode).length() != 0) - fileSavePath += data.SNcode + "//"; - else - fileSavePath += "camera_" + data.cameraKeyName + "//"; - - createDirectoryIfNotExists_2(fileSavePath);//Îļþ¼Ð´¦Àí - std::string fileName; - //while (folderExists(resPath) != true); - //////////////// - if (data.cameraKeyName.find("3D") != -1 && data.imgs.size() == 2) - { - fileName = data.cameraKeyName + "-" + "_time" + getCurrentDateTime_2(); - cv::imwrite(fileSavePath + fileName + ".bmp", data.imgs[0]); - cv::imwrite(fileSavePath + fileName + ".tiff", data.imgs[1]); - } - else - { - std::string fileName; - data.cameraKeyName; - for (int i = 0; i < data.imgs.size(); i++) - { - fileName = data.cameraKeyName + "-" + to_string(i) + "_time" + getCurrentDateTime_2() + ".bmp"; - cv::imwrite(fileSavePath + fileName, data.imgs[i]); - qDebug() << "[Debug]" << QString::fromStdString(data.cameraKeyName + " res:" + fileSavePath + fileName); - //cout << resPath << fileName << endl; - } - } - return; -} -void imgSaveThread::saveResultImg(imgSaveStruct& data) -{ - try - { - //¸ù¾Ýʱ¼ä»ñÈ¡´ó¸Å·¾¶ - sqlTableDatas sqlRes = sql->selectSingleData("saveHour", data.SNcode);//²éÕÒ֮ǰµÄÊý¾Ý - std::string fileSavePath = bridge.back.json.imgSavePath.toStdString(); - if (sqlRes.rowDatas.size() > 0 && sqlRes.rowDatas[0][0].value != "")//Êý¾Ý´æÔÚ - { - fileSavePath += "//result//" + sqlRes.tableName + "//" + sqlRes.rowDatas[0][0].value + "H//"; - } - else//Êý¾Ý²»´æÔÚ Ð½¨Êý¾Ý - { - QDateTime currentDateTime = QDateTime::currentDateTime(); - std::string ymd = currentDateTime.toString("yyyy-MM-dd").toStdString(); - int h = currentDateTime.time().hour(); - fileSavePath += "//result//" + ymd + "//" + to_string(h) + "H//"; - sql->addData(data.SNcode, { { "saveHour",to_string(h) } }); - } - - //ÓÐSNÂë¾Í´¢´æÔÚSNÂë·¾¶£¬ÎÞÔò´¢´æÔÚÏà»ú·¾¶ - if ((data.SNcode).length() != 0) - fileSavePath += data.SNcode + "//"; - else - fileSavePath += "camera_" + data.cameraKeyName + "//"; - - createDirectoryIfNotExists_2(fileSavePath);//Îļþ¼Ð´¦Àí - std::string fileName; - //while (folderExists(resPath) != true); - - //else - { - for (int i = 0; i < data.imgs.size(); i++) - { - fileName = data.cameraKeyName + "_" + getCurrentDateTime_2() + "_time" + to_string(i) + ".jpg"; - cv::imwrite(fileSavePath + fileName, data.imgs[i]); - qDebug() << "[Debug]" << QString::fromStdString(data.cameraKeyName + " ori:" + fileSavePath + fileName); - } - } - } - catch (...) - { - return; - } -} -void imgSaveThread::run() -{ - if (oriThread == false) - while (m_runFlag == true) - { - while (resQueue.size() > 0) - { - resMutex.lock(); - imgSaveStruct data = resQueue.dequeue(); - resMutex.unlock(); - saveResultImg(data); - } - QThread::msleep(10); - } - else - while (m_runFlag == true) - { - while (oriQueue.size() > 0) - { - oriMutex.lock(); - imgSaveStruct data = oriQueue.dequeue(); - oriMutex.unlock(); - saveOriginalImg(data); - } - QThread::msleep(10); - } - -} ////////////////DET//DATA////////////////// sncodeCls::sncodeCls() { diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolController.h b/HanddleAI/HandleAiUi-new/back/threadPoolController.h index 99766e93..edfbb55f 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolController.h +++ b/HanddleAI/HandleAiUi-new/back/threadPoolController.h @@ -14,6 +14,8 @@ #include #include #include +#include +#include class threadConroller; class algoThread; class subThread; @@ -29,21 +31,7 @@ struct MatchResult { cv::Rect boundingRect; double confidence; }; -struct correctionStruct -{ - std::vector in_X_X0Y; - std::vector in_Y_X0Y; - std::vector in_Z_X0Y; - std::vector in_Z_X0Y_Value; - std::vector in_X_X0Z; - std::vector in_Y_X0Z;; - std::vector in_Z_X0Z; - std::vector in_Y_X0Z_Value; - std::vector in_X_Y0Z; - std::vector in_Y_Y0Z; - std::vector in_Z_Y0Z; - std::vector in_X_Y0Z_Value; -}; + class cameraImages { public: @@ -97,7 +85,7 @@ class detData { public: const unsigned long long timeCode = getTimeCode();//¸ù¾Ýʱ¼äºÍËæ»úÊýÉú³ÉµÄÖµ£¬Î¨Ò» - + QMutex* mutex; std::string SNcode; QString cameraKeyName; @@ -159,6 +147,7 @@ public: algoThreadName = IN_algoThreadName; oriShowIndex = IN_oriShowIndex; SNcode = IN_SN; + mutex = new QMutex(); } ~detData() { @@ -166,6 +155,7 @@ public: img.release(); for (auto img : resultImgs) img.release(); + delete mutex; //delete cameraImgPtr; } @@ -193,7 +183,7 @@ class detDataController public: std::unordered_mapmap; //std::maptstMap; - QLinkedList< detData> detDatas; + QLinkedList detDatas; QMutex dataMutex; detData* insertDetData(QString IN_cameraKeyName, QString IN_algoThreadName, std::string IN_SN, int IN_oriShowIndex) @@ -269,78 +259,6 @@ public: sncodeCls(); }; -/// -/// ¸¨ÖúÏß³Ì -/// -class imgSaveThread : public QThread -{ - Q_OBJECT -public: - bool oriThread = false; - std::string snErrorsnError2= std::string ("snErrNoSn"); - struct imgSaveStruct{ - std::string cameraKeyName; - std::string SNcode; - int showIndex = -1; - unsigned long long timeCode; - std::vectorimgs; - - }; - QMutex mutex; - bool m_runFlag = true; - std::vector>snWithHash; - - sncodeCls* snDatas; - sqlController* sql; - std::string fileNameTemp; - - QMutex oriMutex; - QQueueoriQueue; - QMutex resMutex; - QQueueresQueue; - QString dateTimeNow; - - void saveOriImg(detData* data) - { - imgSaveStruct saveStruct; - saveStruct.SNcode = data->SNcode; - //saveStruct.snCountIndex = data->snCountIndex; - saveStruct.cameraKeyName = data->cameraKeyName.toStdString(); - saveStruct.timeCode = data->timeCode; - saveStruct.showIndex = data->oriShowIndex; - for (auto mat : data->imgs) - saveStruct.imgs.push_back(mat); - oriMutex.lock(); - oriQueue.push_back(saveStruct); - oriMutex.unlock(); - this->start(); - } - void saveResImg(detData* data) - { - imgSaveStruct saveStruct; - saveStruct.SNcode = data->SNcode; - - //saveStruct.snCountIndex = data->snCountIndex; - saveStruct.cameraKeyName = data->cameraKeyName.toStdString(); - saveStruct.timeCode = data->timeCode; - saveStruct.showIndex = data->resShowIndex; - - for (auto mat : data->resultImgs) - saveStruct.imgs.push_back(mat); - - resMutex.lock(); - resQueue.push_back(saveStruct); - resMutex.unlock(); - this->start(); - } - - void Init(threadConroller* tC); - void run(); -private: - void saveOriginalImg(imgSaveStruct&); - void saveResultImg(imgSaveStruct&); -}; - /// /// Ï̳߳عÜÀí /// @@ -360,8 +278,6 @@ public: QMutex insertQueueMutex; QQueueinsertQueue; std::vectoralgoThreadList; - imgSaveThread* oriSaveThread = new imgSaveThread;//ԭͼ±£´æÏß³Ì - imgSaveThread* resSaveThread = new imgSaveThread;//½á¹ûͼ±£´æÏß³Ì void run(); void addTask(detData*); bool getFreeThread(); diff --git a/HanddleAI/HandleAiUi-new/back/toolkit.cpp b/HanddleAI/HandleAiUi-new/back/toolkit.cpp index be5ee490..d098bab5 100644 --- a/HanddleAI/HandleAiUi-new/back/toolkit.cpp +++ b/HanddleAI/HandleAiUi-new/back/toolkit.cpp @@ -92,7 +92,7 @@ bool QSetFileTimes(const QString & filepath, QDateTime& CreationTime) // int i=GetFileTime (hFile, &lpCreationTime, &lpLastAccessTime, &lpLastWriteTime); // 获å�–文件夹时间属性信æ�¯ // SYSTEMTIME stc; // FILETIME localTime; - // FileTimeToLocalFileTime(&lpCreationTime,&localTime); + // FileTimeToLocalFileTime(&lpCreatxionTime,&localTime); // FileTimeToSystemTime(&localTime,&stc);//UTC转本地时间 SYSTEMTIME newDay; newDay.wDayOfWeek=CreationTime.date().dayOfWeek(); diff --git a/HanddleAI/HandleAiUi-new/exe_main.cpp b/HanddleAI/HandleAiUi-new/exe_main.cpp deleted file mode 100644 index 07b087c3..00000000 --- a/HanddleAI/HandleAiUi-new/exe_main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "mainwindow.h" -#include -#include -#include -#include //日志 -#include -#include -#include -#include -#include -#include -#include -#include -#include -void connectSignalAndSlots(MainWindow* front, backEndController* back) -{ - QObject::connect(back, &backEndController::sendPixmapImageWidget, front, &MainWindow::recvPixmapImageWidget); -} -int main(int argc, char* argv[]) -{ - QApplication a(argc, argv); - - //检测是å�¦å·²è¿�行 - QSystemSemaphore sema("monkey", 1, QSystemSemaphore::Open); - sema.acquire(); - QSharedMemory mem("DetUi"); - if (mem.create(1) == false) - { - sema.release(); - //程åº�直接退出 - exit(0); - - } - sema.release(); - ////////// - qRegisterMetaType("imgWidgetShowType"); - qRegisterMetaType("showImgPack"); - backEndController _backEnd; - MainWindow w; - connectSignalAndSlots(&w,&_backEnd); - w.show(); - return a.exec(); - - -} diff --git a/lib/Hd_3DCameraLMI_module_PointLazer.exp b/lib/Hd_3DCameraLMI_module_PointLazer.exp index b0d66668..c128f721 100644 Binary files a/lib/Hd_3DCameraLMI_module_PointLazer.exp and b/lib/Hd_3DCameraLMI_module_PointLazer.exp differ diff --git a/lib/Hd_3DCameraLMI_module_PointLazer.lib b/lib/Hd_3DCameraLMI_module_PointLazer.lib index b04150d6..b506c2ad 100644 Binary files a/lib/Hd_3DCameraLMI_module_PointLazer.lib and b/lib/Hd_3DCameraLMI_module_PointLazer.lib differ diff --git a/lib/Hd_DalsaCamera_module.exp b/lib/Hd_DalsaCamera_module.exp index 9d36f208..d51dd347 100644 Binary files a/lib/Hd_DalsaCamera_module.exp and b/lib/Hd_DalsaCamera_module.exp differ diff --git a/lib/Hd_DalsaCamera_module.lib b/lib/Hd_DalsaCamera_module.lib index 9c451b2e..c271a24e 100644 Binary files a/lib/Hd_DalsaCamera_module.lib and b/lib/Hd_DalsaCamera_module.lib differ diff --git a/lib/Hd_FinsTcp_module.exp b/lib/Hd_FinsTcp_module.exp index 53c3f41b..63243947 100644 Binary files a/lib/Hd_FinsTcp_module.exp and b/lib/Hd_FinsTcp_module.exp differ diff --git a/lib/Hd_FinsTcp_module.lib b/lib/Hd_FinsTcp_module.lib index f679fdae..e7784b3e 100644 Binary files a/lib/Hd_FinsTcp_module.lib and b/lib/Hd_FinsTcp_module.lib differ diff --git a/lib/Hd_MvCamera_module_GENTL.exp b/lib/Hd_MvCamera_module_GENTL.exp index 588ebc79..f0a89b55 100644 Binary files a/lib/Hd_MvCamera_module_GENTL.exp and b/lib/Hd_MvCamera_module_GENTL.exp differ diff --git a/lib/Hd_MvCamera_module_GENTL.lib b/lib/Hd_MvCamera_module_GENTL.lib index 578b535e..4010f0a3 100644 Binary files a/lib/Hd_MvCamera_module_GENTL.lib and b/lib/Hd_MvCamera_module_GENTL.lib differ diff --git a/lib/Hd_MvCamera_module_GIGE.exp b/lib/Hd_MvCamera_module_GIGE.exp index 0c571208..baf010b9 100644 Binary files a/lib/Hd_MvCamera_module_GIGE.exp and b/lib/Hd_MvCamera_module_GIGE.exp differ diff --git a/lib/Hd_MvCamera_module_GIGE.lib b/lib/Hd_MvCamera_module_GIGE.lib index f5ba12df..110ae8d7 100644 Binary files a/lib/Hd_MvCamera_module_GIGE.lib and b/lib/Hd_MvCamera_module_GIGE.lib differ diff --git a/lib/Hd_ResultsSummary_module.exp b/lib/Hd_ResultsSummary_module.exp index 59f77271..72272a70 100644 Binary files a/lib/Hd_ResultsSummary_module.exp and b/lib/Hd_ResultsSummary_module.exp differ diff --git a/lib/Hd_ResultsSummary_module.lib b/lib/Hd_ResultsSummary_module.lib index ff33633f..8baafc1c 100644 Binary files a/lib/Hd_ResultsSummary_module.lib and b/lib/Hd_ResultsSummary_module.lib differ diff --git a/lib/Hd_SocketModule_ModbusTcp.exp b/lib/Hd_SocketModule_ModbusTcp.exp index b96d9533..25890329 100644 Binary files a/lib/Hd_SocketModule_ModbusTcp.exp and b/lib/Hd_SocketModule_ModbusTcp.exp differ diff --git a/lib/Hd_SocketModule_ModbusTcp.lib b/lib/Hd_SocketModule_ModbusTcp.lib index 7d987e79..b3ff8f19 100644 Binary files a/lib/Hd_SocketModule_ModbusTcp.lib and b/lib/Hd_SocketModule_ModbusTcp.lib differ diff --git a/lib/Hd_VirtualCamera_ReadFile.exp b/lib/Hd_VirtualCamera_ReadFile.exp index 2ab8a327..97564e7e 100644 Binary files a/lib/Hd_VirtualCamera_ReadFile.exp and b/lib/Hd_VirtualCamera_ReadFile.exp differ diff --git a/lib/Hd_VirtualCamera_ReadFile.lib b/lib/Hd_VirtualCamera_ReadFile.lib index 758ab845..6ea40c15 100644 Binary files a/lib/Hd_VirtualCamera_ReadFile.lib and b/lib/Hd_VirtualCamera_ReadFile.lib differ