diff --git a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h index 8730bfa2..8fdc73bf 100644 --- a/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h +++ b/HanddleAI/HandleAiUi-new/algo/ALGO_Inspection.h @@ -1,5 +1,6 @@ #include #include + static HalconCpp::HObject MatToHObject(cv::Mat& image) { HalconCpp::HObject Hobj; @@ -210,70 +211,142 @@ static void MatToHObjectV(cv::Mat& image, HalconCpp::HObject& Hobj) } } -void ALGO_Inspection(std::shared_ptr data) + + +void pinHandleAiEvaluate(cv::Mat& src, cv::Mat& Paint, + handdleAI::pSegmentation *segPtr, handdleAI::pClassification* clsPtr) +{ + cv::Mat segRes = ~segPtr->Evaluate(src); + std::vector> contours; + cv::findContours(segRes, contours, cv::RETR_EXTERNAL,cv::CHAIN_APPROX_NONE); + for (auto contour : contours) + { + cv::Rect rect = cv::boundingRect(contour); + rect += cv::Size(1, 1); + rect = cv::Rect( + max(0, rect.x), + max(0, rect.y), + min(rect.x + rect.width, src.rows), + min(rect.y + rect.height, src.cols) + ); + + int clsRes = clsPtr->Evaluate(src(rect)); + cv::Scalar color; + switch (clsRes) + { + case 0: + color = cv::Scalar(0, 255, 0, 128); + break; + case 1: + color = cv::Scalar(255, 0, 0, 128); + break; + default: + color = cv::Scalar(255, 255, 255, 128); + } + cv::rectangle(Paint, rect, color, 2); + } +} + +void pinHalconEvaluate(std::vector& Result,cv::Mat& src, cv::Mat& Paint) +{ + //hv_in_Parameter + //[0]-产品种类; 1A正面 2A反面 3B正面 4C正面 + //[1]-图像序号第一位; + //[2]-图像序号第二位; + //[3]-3d相机精度(mm); + //[4]-ping针偏移判NG阈值(mm); + //[5]-切图存图开关 +#pragma region halcon变量定义 + //测量 + HObject ho_in_Image; + HObject ho_in_Image2; + HTuple hv_in_ShapePath; + HTuple hv_in_Parameter; + HTuple hv_out_Pings_X; + HTuple hv_out_Pings_Y; + HTuple hv_out_NG_Pings_X; + HTuple hv_out_NG_Pings_Y; + HTuple hv_out_Pings_Num; + HTuple hv_out_NG_Pings_Num; + HTuple hv_out_Flag_INS; + + //ROI + HTuple hv_out_ROI_Value; + HTuple hv_out_Flag_ROI; +#pragma endregion + ho_in_Image = MatToHObject(src); + hv_in_Parameter.Append(3); + hv_in_Parameter.Append(5); + hv_in_Parameter.Append(1); + hv_in_Parameter.Append(0.0135); + hv_in_Parameter.Append(0.2); + hv_in_Parameter.Append(2); + + hv_in_ShapePath = "./halconModel"; + + + Pings_Inspection(ho_in_Image, hv_in_ShapePath, hv_in_Parameter, &hv_out_Pings_X, + &hv_out_Pings_Y, &hv_out_NG_Pings_X, &hv_out_NG_Pings_Y, &hv_out_Pings_Num, + &hv_out_NG_Pings_Num, &hv_out_Flag_INS); + + Pings_ROI(ho_in_Image, hv_in_ShapePath, hv_in_Parameter, &hv_out_ROI_Value, &hv_out_Flag_ROI); + for (int i = 0; i < hv_out_ROI_Value.Length() / 4; i++) + { + Result.push_back( + cv::Rect( + hv_out_ROI_Value[i * 4 + 1].D(), + hv_out_ROI_Value[i * 4].D(), + hv_out_ROI_Value[i * 4 + 3].D() - hv_out_ROI_Value[i * 4 + 1].D(), + hv_out_ROI_Value[i * 4 + 2].D() - hv_out_ROI_Value[i * 4].D() + )); + } +} + +void ALGO_Inspection(std::shared_ptr data, handleAiModelManager* _handleAiModelManager) { if (data->oriImgs.size() < 1) { qDebug() << __FUNCDNAME__ << __LINE__ << "camera Mat size is Error!"; return; } - //hv_in_Parameter - //[0]-产品种类; 1A正面 2A反面 3B正面 4C正面 - //[1]-图像序号第一位; - //[2]-图像序号第二位; - //[3]-3d相机精度(mm); - //[4]-ping针偏移判NG阈值(mm); - //[5]-切图存图开关 -#pragma region halcon变量定义 - //测量 - HObject ho_in_Image; - HObject ho_in_Image2; - HTuple hv_in_ShapePath; - HTuple hv_in_Parameter; - HTuple hv_out_Pings_X; - HTuple hv_out_Pings_Y; - HTuple hv_out_NG_Pings_X; - HTuple hv_out_NG_Pings_Y; - HTuple hv_out_Pings_Num; - HTuple hv_out_NG_Pings_Num; - HTuple hv_out_Flag_INS; + cv::Mat src = data->oriImgs[0]; + cv::Mat Paint; + cvtColor(src, Paint, cv::COLOR_GRAY2BGR); + std::vectorhalconResult; + //hv_in_Parameter + //[0]-产品种类; 1A正面 2A反面 3B正面 4C正面 + //[1]-图像序号第一位; + //[2]-图像序号第二位; + //[3]-3d相机精度(mm); + //[4]-ping针偏移判NG阈值(mm); + //[5]-切图存图开关 - //ROI - HTuple hv_out_ROI_Value; - HTuple hv_out_Flag_ROI; -#pragma endregion + //HALCON + pinHalconEvaluate(halconResult,src, Paint); - cv::Mat mat = cv::imread("C://NHMJDHNN78474-5_1-ASR1006X20240320-150822.BMP", -1); - ho_in_Image = MatToHObject(mat); - MatToHObjectV(mat, ho_in_Image); - hv_in_Parameter.Append(3); - hv_in_Parameter.Append(5); - hv_in_Parameter.Append(1); - hv_in_Parameter.Append(0.0135); - hv_in_Parameter.Append(0.2); - hv_in_Parameter.Append(2); + //HANDLEAI + int customIndex = 0; + switch(customIndex) + { + case 0: + pinHandleAiEvaluate(src(halconResult[0]), Paint(halconResult[0]), + _handleAiModelManager->largeSeg, _handleAiModelManager->largeCls); + break; + case 1: + pinHandleAiEvaluate(src(halconResult[0]), Paint(halconResult[0]), + _handleAiModelManager->largeSeg, _handleAiModelManager->largeCls); + break; + case 2: + pinHandleAiEvaluate(src(halconResult[0]), Paint(halconResult[0]), + _handleAiModelManager->midSeg, _handleAiModelManager->midCls); + break; + case 3: + pinHandleAiEvaluate(src(halconResult[0]), Paint(halconResult[0]), + _handleAiModelManager->smallSeg, _handleAiModelManager->smallCls); + break; + } - hv_in_ShapePath = "./halconModel"; - - - Pings_Inspection(ho_in_Image, hv_in_ShapePath, hv_in_Parameter, &hv_out_Pings_X, - &hv_out_Pings_Y, &hv_out_NG_Pings_X, &hv_out_NG_Pings_Y, &hv_out_Pings_Num, - &hv_out_NG_Pings_Num, &hv_out_Flag_INS); - - Pings_ROI(ho_in_Image, hv_in_ShapePath, hv_in_Parameter, &hv_out_ROI_Value, &hv_out_Flag_ROI); - std::vectorResult; - for (int i = 0; i < hv_out_ROI_Value.Length() / 4; i++) - { - Result.push_back( - cv::Rect( - hv_out_ROI_Value[i * 4 + 1].D(), - hv_out_ROI_Value[i * 4].D(), - hv_out_ROI_Value[i * 4 + 3].D() - hv_out_ROI_Value[i * 4 + 1].D(), - hv_out_ROI_Value[i * 4 + 2].D() - hv_out_ROI_Value[i * 4].D() - )); - } - cv::Mat Paint; - cvtColor(mat, Paint, cv::COLOR_GRAY2BGR); - rectangle(Paint, Result[0], cv::Scalar(0, 0, 255), 4); + rectangle(Paint, halconResult[0], cv::Scalar(0, 0, 255), 4); + data->resultImgs.push_back(Paint); _sleep(100); } \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/algo/ALGO_MAIN.h b/HanddleAI/HandleAiUi-new/algo/ALGO_MAIN.h new file mode 100644 index 00000000..4689022a --- /dev/null +++ b/HanddleAI/HandleAiUi-new/algo/ALGO_MAIN.h @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +bool processAlgo(std::shared_ptr data, handleAiModelManager* _handleAiModelManager) +{ + try + { + switch (data->algoThreadIndex) + { + case -1: + pinAioEvalute(data); + break; + case 0: + ALGO_Correction(data); + break; + case 1: + ALGO_Inspection(data, _handleAiModelManager); + break; + } + qDebug() << "algo end"; + return true; + } + catch (const std::exception& e) + { + std::cerr << "Caught exception: " << e.what() << std::endl; + return false; + } + return false; +} +#pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/algo/algo.zip b/HanddleAI/HandleAiUi-new/algo/algo.zip deleted file mode 100644 index ff411e37..00000000 Binary files a/HanddleAI/HandleAiUi-new/algo/algo.zip and /dev/null differ diff --git a/HanddleAI/HandleAiUi-new/back/cameraManager.h b/HanddleAI/HandleAiUi-new/back/cameraManager.h index 1e881ac8..aa9a6795 100644 --- a/HanddleAI/HandleAiUi-new/back/cameraManager.h +++ b/HanddleAI/HandleAiUi-new/back/cameraManager.h @@ -34,7 +34,7 @@ public: while (this->isRunning() == true); } void getImgQueueSize(); - void Process(std::shared_ptr dataIn) + void captureImage(std::shared_ptr dataIn) { requestQueue.enqueue(dataIn); } @@ -109,6 +109,13 @@ public: void init(backEndManager*); ~cameraManager(); std::unordered_mapcameras;//key 相机名 + camera* getCamera(std::string cameraName) + { + auto camera = cameras.find(cameraName); + if (camera != cameras.end()) + return camera->second; + return nullptr; + } void run() { //while (1) diff --git a/HanddleAI/HandleAiUi-new/back/logmsg.cpp b/HanddleAI/HandleAiUi-new/back/logmsg.cpp index 957a8a3e..c07747b6 100644 --- a/HanddleAI/HandleAiUi-new/back/logmsg.cpp +++ b/HanddleAI/HandleAiUi-new/back/logmsg.cpp @@ -1,4 +1,4 @@ -锘� #include "logmsg.h" +锘�#include "logmsg.h" #include key_sendMsg m_key_callback = NULL; diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp index 9b337575..9e6361b4 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp +++ b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp @@ -2,12 +2,9 @@ #include #include #include +#include +#include -#include -#include -#include - -using namespace std; void createDirectoryIfNotExists_2(const std::string& path) { // 检查路径是否存在 if (!std::filesystem::exists(path)) { @@ -50,6 +47,8 @@ void threadManager::init(backEndManager* _backEndManagerIn) _backEndManager = _backEndManagerIn; sql = &_backEndManager->_sqlManager; _imgSaveThreadManager = _backEndManagerIn->_imgSaveThreadManager; + _triggerManager = _backEndManagerIn->_triggerManager; + _handleAiModelManager = _backEndManager->_handleAiModelManager; this->start(); } void threadManager::process() @@ -67,7 +66,7 @@ void threadManager::process() std::shared_ptr ptr = *it; if (ptr->oriImgs.size() >= ptr->imgAmountMin) { - algoFutures.insert(std::make_pair(ptr->timeCode, std::async(std::launch::async, ALGO_Inspection, ptr))); + algoFutures.insert(std::make_pair(ptr->timeCode, std::async(std::launch::async, processAlgo, ptr,_handleAiModelManager))); processData.push_back(ptr); it = waitImgData.erase(it); @@ -81,10 +80,12 @@ void threadManager::process() { std::shared_ptr ptr = *it; futrueIte = algoFutures.find(ptr->timeCode); - if (futrueIte->second.wait_for(zeroSec)== std::future_status::ready) + if (futrueIte->second.wait_for(zeroSec) == std::future_status::ready) { - resultData.push_back(ptr); - resultFutures.insert(std::make_pair(ptr->timeCode, std::async(std::launch::async, &threadManager::resultHandle, this, ptr))); + bool res= futrueIte->second.get(); + //resultData.push_back(ptr); + //resultFutures.insert(std::make_pair(ptr->timeCode, std::async(std::launch::async, &threadManager::resultHandle, this, ptr))); + std::async(std::launch::async, &threadManager::resultHandle, this, ptr); it = processData.erase(it); algoFutures.erase(futrueIte); @@ -94,19 +95,19 @@ void threadManager::process() } #pragma endregion #pragma region 等待结果并执行显示图片等操作 - for (auto it = resultData.begin(); it != resultData.end();) - { - std::shared_ptr ptr = *it; - futrueIte = resultFutures.find(ptr->timeCode); - if (futrueIte->second.wait_for(zeroSec) == std::future_status::ready) - { + //for (auto it = resultData.begin(); it != resultData.end();) + //{ + // std::shared_ptr ptr = *it; + // futrueIte = resultFutures.find(ptr->timeCode); + // if (futrueIte->second.wait_for(zeroSec) == std::future_status::ready) + // { - it = resultData.erase(it); - resultFutures.erase(futrueIte); - } - else - ++it; - } + // it = resultData.erase(it); + // resultFutures.erase(futrueIte); + // } + // else + // ++it; + //} #pragma endregion } @@ -115,13 +116,16 @@ void threadManager::resultHandle(std::shared_ptr data) //储存结果图 _imgSaveThreadManager->resSaveThread->imgDataQueue.append(data); //发送图片 - QPixmap pixmap; - cvMatToQPixMap(data->resultImgs[0], pixmap); - showImgPack* pack = new showImgPack(); - pack->img = pixmap; - pack->type = imgWidgetRes; - pack->index = data->oriShowIndex; - emit _backEndManager->sendPixmapImageWidget(pack); + if(data->resultImgs.size()>0) + { + QPixmap pixmap; + cvMatToQPixMap(data->resultImgs[0], pixmap); + showImgPack* pack = new showImgPack(); + pack->img = pixmap; + pack->type = imgWidgetRes; + pack->index = data->oriShowIndex; + emit _backEndManager->sendPixmapImageWidget(pack); + } //SQL std::vector sqlDatas; @@ -129,6 +133,10 @@ void threadManager::resultHandle(std::shared_ptr data) sqlDatas.push_back({ sqlData.first, std::to_string(sqlData.second) }); sql->addData(data->SNcode, sqlDatas); + //写入plc + for (auto writeBackStr : data->writeBackData) + _triggerManager->sendFinsMsg(writeBackStr); + //提交清理申请 detDataManager* dManager = data->dManager; data->dManager->deleteDetData(data->timeCode); @@ -143,14 +151,9 @@ void threadManager::run() } void threadManager::addTask(std::shared_ptr data) { - //{ - // CameraListCls::datastruct _struct = bridge.back.json.camera.getData(data->cameraKeyName); - // data->oriShowIndex = _struct.showIndex; - //} insertQueueMutex.lock(); insertQueue.enqueue(data); insertQueueMutex.unlock(); - //this->start(); } threadManager::~threadManager() { @@ -182,12 +185,12 @@ bool sncodeCls::clearSameSnRequestData() } return true; } -void sncodeCls::checkSnFromWaittingVec(QByteArray byte) +void sncodeCls::checkSnFromWaittingVec(QByteArray plcByte) { while (clearSameSnRequestData() == false); for (int i = 0; i < snWaittingVec.size(); i++) {//第一位是hash,第二位是index - string SN = readSnFromQByteArray(byte, snWaittingVec[i].startpos, false, true, 0); + std::string SN = readSnFromQByteArray(plcByte, snWaittingVec[i].startpos, false, true, 0); if (SN.compare(snErrorsnError))//不为空 { snResList.push_back({ snWaittingVec[i].timecode,SN,snWaittingVec[i].startpos }); @@ -199,28 +202,28 @@ void sncodeCls::checkSnFromWaittingVec(QByteArray byte) } //FINSEDIT -string sncodeCls::readSnFromQByteArray(QByteArray byte, int dmPos, +std::string sncodeCls::readSnFromQByteArray(QByteArray plcByte, int dmPos, bool highLowConversion, bool clearAfterRead, long long timeCode, int Size) { int triggerPos = (dmPos - tcpStartPos) * 2; if (triggerPos < 0) { - cout << "Read SN error,trigger is DM:" << dmPos << ",but read start at DM:" << tcpStartPos << endl; + std::cout << "Read SN error,trigger is DM:" << dmPos << ",but read start at DM:" << tcpStartPos << endl; return snErrorsnError; } QString str; - if (byte.at(triggerPos + 1) == 0 && byte.at(triggerPos) == 0) + if (plcByte.at(triggerPos + 1) == 0 && plcByte.at(triggerPos) == 0) return snErrorsnError; int snCount = 0; - while (byte.at(snCount + triggerPos) != 0 || byte.at(snCount + triggerPos + 1) != 0) + while (plcByte.at(snCount + triggerPos) != 0 || plcByte.at(snCount + triggerPos + 1) != 0) { - if (byte.at(snCount + triggerPos) == 0) + if (plcByte.at(snCount + triggerPos) == 0) { snCount++; continue; } - str += QChar(byte.at(snCount + triggerPos)); + str += QChar(plcByte.at(snCount + triggerPos)); snCount++; } if (highLowConversion == true) @@ -244,7 +247,7 @@ QString sncodeCls::snHex(QString sn) } return resultStr; } -string sncodeCls::getData(unsigned long long timeCode) +std::string sncodeCls::getData(unsigned long long timeCode) { for (int i = snResList.size() - 1; i >= 0; i--) { @@ -253,10 +256,10 @@ string sncodeCls::getData(unsigned long long timeCode) } return snErrorsnError; } -string sncodeCls::waitForSn(unsigned long long timeCode, int timeOut) +std::string sncodeCls::waitForSn(unsigned long long timeCode, int timeOut) { int cnt = 0; - string sn = getData(timeCode); + std::string sn = getData(timeCode); if (!sn.compare(snErrorsnError)) { diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolManager.h b/HanddleAI/HandleAiUi-new/back/threadPoolManager.h index 5f5ae1cb..e06df734 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolManager.h +++ b/HanddleAI/HandleAiUi-new/back/threadPoolManager.h @@ -21,7 +21,8 @@ class threadManager; class algoThread; class subThread; class detDataManager; -//class detData; +class triggerManager; + class backEndManager; class detData { @@ -37,6 +38,7 @@ public: double camera1Width = 0, camera1Height = 0; int cameraIndex = -1; //是第几次拍照 int imgAmountMin = 1; + int algoThreadIndex = -1; std::vector> sqlVec; @@ -79,22 +81,7 @@ public: //algoThreadIndex = _struct.threadIndex; //resShowIndex = _struct.showIndex; } - static std::shared_ptr CreateDetData(QString IN_cameraKeyName, QString IN_algoThreadName, - std::string IN_SN, int IN_oriShowIndex) - { - std::shared_ptr data(new detData(IN_cameraKeyName, IN_algoThreadName, IN_SN, IN_oriShowIndex)); - return data; - } - detData(QString IN_cameraKeyName, QString IN_algoThreadName, - std::string IN_SN, int IN_oriShowIndex) - { - cameraKeyName = IN_cameraKeyName; - algoThreadName = IN_algoThreadName; - oriShowIndex = IN_oriShowIndex; - SNcode = IN_SN; - //imgMutex = new QMutex(); - } ~detData() { for (auto img : oriImgs) @@ -107,35 +94,40 @@ class detDataManager { public: std::unordered_map>map; - - //QLinkedList detDatas; QMutex dataMutex; - //std::shared_ptr insertDetData(QString IN_cameraKeyName, QString IN_algoThreadName, - // std::string IN_SN, int IN_oriShowIndex) - //{ - // dataMutex.lock(); - // std::shared_ptr data = new detData(IN_cameraKeyName, IN_algoThreadName, IN_SN, IN_oriShowIndex); - // data->dManager = this; - // //detDatas.push_back(data); - // map.insert({ data->timeCode,data }); - // dataMutex.unlock(); - // std::shared_ptr dataPtr = getDetData(data->timeCode); - // - // if (dataPtr == nullptr) - // qDebug() << "创建新容器失败"; - // return dataPtr; - //} - std::shared_ptr insertDetData(QString IN_cameraKeyName, QString IN_algoThreadName, + + /* std::shared_ptr insertDetData(QString IN_cameraKeyName, QString IN_algoThreadName, std::string IN_SN, int IN_oriShowIndex) { dataMutex.lock(); std::shared_ptr data(new detData(IN_cameraKeyName, IN_algoThreadName, IN_SN, IN_oriShowIndex)); data->dManager = this; - //detDatas.push_back(data); map.insert({ data->timeCode,data }); dataMutex.unlock(); std::shared_ptr dataPtr = getDetData(data->timeCode); + if (dataPtr == nullptr) + qDebug() << "创建新容器失败"; + return dataPtr; + }*/ + std::shared_ptr insertDetData( + QString IN_cameraKeyName, + std::string IN_SN, + int IN_oriShowIndex, + int IN_algoThreadIndex) + { + dataMutex.lock(); + std::shared_ptr dataPtr(new detData()); + + dataPtr->cameraKeyName = IN_cameraKeyName; + dataPtr->SNcode = IN_SN; + dataPtr->oriShowIndex = IN_oriShowIndex; + dataPtr->algoThreadIndex = IN_algoThreadIndex; + + dataPtr->dManager = this; + map.insert({ dataPtr->timeCode,dataPtr }); + dataMutex.unlock(); + if (dataPtr == nullptr) qDebug() << "创建新容器失败"; return dataPtr; @@ -201,6 +193,9 @@ public: sqlManager* sql; imgSaveThreadManager* _imgSaveThreadManager; + triggerManager* _triggerManager; + handleAiModelManager* _handleAiModelManager; + QQueue> detDataQueue; autoDelete* autoDeleteThread; void init(backEndManager* _backEndManagerIn); @@ -227,11 +222,11 @@ private: std::list> processData;//处理中 std::list> resultData;//等待结果 - std::unordered_map> algoFutures; + std::unordered_map> algoFutures; std::unordered_map> resultFutures; std::chrono::seconds zeroSec = std::chrono::seconds(0); - std::unordered_map>::iterator futrueIte; + std::unordered_map>::iterator futrueIte; bool runFlag = true; QList>imgWaitList; diff --git a/HanddleAI/HandleAiUi-new/back/triggerManager.cpp b/HanddleAI/HandleAiUi-new/back/triggerManager.cpp index 06f2e39e..a724bf87 100644 --- a/HanddleAI/HandleAiUi-new/back/triggerManager.cpp +++ b/HanddleAI/HandleAiUi-new/back/triggerManager.cpp @@ -11,21 +11,22 @@ void triggerManager::decodeCameraCMD(QByteArray byte) #if debugTesting //if (checkTrigger(1, 2, byte) == true) { - std::shared_ptr data = dManager->insertDetData("Camera1", "Thread3", "TEST", 0); - data->correctionData = correctionData; - _threadManager->addTask(data);//添加任务 - auto camera = _cameraManager->cameras.find("123"); - if(camera != _cameraManager->cameras.end()) - camera->second->Process(data); + //std::shared_ptr data = dManager->insertDetData("Camera1" , "TEST", 0 , 0); + //data->correctionData = correctionData; + //_threadManager->addTask(data);//添加任务 + //auto camera = _cameraManager->getCamera("123"); + //if(camera != nullptr) + // camera->captureImage(data); } //if (checkTrigger(2, 2, byte) == true) { - std::shared_ptr data = dManager->insertDetData("Camera1", "Thread2", "TEST", 1); + std::shared_ptr data = dManager->insertDetData("Camera1", "TEST", 1, 1); data->correctionData = correctionData; + data->oriImgs.push_back(cv::imread("C://Users//RCi//Downloads//20240526-202606.bmp",-1)); _threadManager->addTask(data);//添加任务 - //auto camera = _cameraManager->cameras.find("456"); - //if (camera != _cameraManager->cameras.end()) - // camera->second->Process(data); + //auto camera = _cameraManager->getCamera("123"); + //if (camera != nullptr) + // camera->captureImage(data); } return; #endif diff --git a/HanddleAI/HandleAiUi-new/back/triggerManager.h b/HanddleAI/HandleAiUi-new/back/triggerManager.h index a8945385..e5247452 100644 --- a/HanddleAI/HandleAiUi-new/back/triggerManager.h +++ b/HanddleAI/HandleAiUi-new/back/triggerManager.h @@ -7,7 +7,6 @@ #include #include -using namespace std; class backEndManager; class cameraManager; class jsonConfiguration; diff --git a/HanddleAI/HandleAiUi-new/handleAi/handleAiModel.h b/HanddleAI/HandleAiUi-new/handleAi/handleAiModel.h index 473823ae..593e69a9 100644 --- a/HanddleAI/HandleAiUi-new/handleAi/handleAiModel.h +++ b/HanddleAI/HandleAiUi-new/handleAi/handleAiModel.h @@ -4,6 +4,8 @@ #include #include #include + +#if 0 class handleAiModelBase { public: @@ -120,4 +122,47 @@ private: std::vectorgpuMutex; int gpuCnt = 1;//gpu数量 }; +#endif +class handleAiModelManager :public QObject +{ +public: + handdleAI::pSegmentation* largeSeg; + handdleAI::pClassification* largeCls; + + handdleAI::pSegmentation* midSeg; + handdleAI::pClassification* midCls; + + handdleAI::pSegmentation* smallSeg; + handdleAI::pClassification* smallCls; + + ////////模型放这里/////// + handleAiModelManager() + { + + } + ///////////END///////// + + void init(backEndManager* _backEndManagerIn) + { + return; + largeSeg = handdleAI::CreateSegObj("./HandleAiModels/large-seg.BHD", 0); + midSeg = handdleAI::CreateSegObj("./HandleAiModels/mid-seg.BHD", 0); + smallSeg = handdleAI::CreateSegObj("./HandleAiModels/small-seg.BHD", 0); + + largeCls = handdleAI::CreateClsObjVT("./HandleAiModels/large-cls.BHD", 0); + midCls = handdleAI::CreateClsObjVT("./HandleAiModels/mid-cls.BHD", 0); + smallCls = handdleAI::CreateClsObjVT("./HandleAiModels/small_cls.BHD", 0); + } + ~handleAiModelManager() + { + handdleAI::DestroySegObj(largeSeg); + handdleAI::DestroySegObj(midSeg); + handdleAI::DestroySegObj(smallSeg); + + handdleAI::DestroyClsObj(largeCls); + handdleAI::DestroyClsObj(midCls); + handdleAI::DestroyClsObj(smallCls); + } + +}; #pragma once \ No newline at end of file diff --git a/lib/Hd_3DCameraLMI_module_PointLazer.exp b/lib/Hd_3DCameraLMI_module_PointLazer.exp index c128f721..b0d66668 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 b506c2ad..b04150d6 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 d51dd347..9d36f208 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 c271a24e..9c451b2e 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 63243947..53c3f41b 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 e7784b3e..f679fdae 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 f0a89b55..588ebc79 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 4010f0a3..578b535e 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 baf010b9..0c571208 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 110ae8d7..f5ba12df 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 72272a70..59f77271 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 8baafc1c..ff33633f 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 25890329..b96d9533 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 b3ff8f19..7d987e79 100644 Binary files a/lib/Hd_SocketModule_ModbusTcp.lib and b/lib/Hd_SocketModule_ModbusTcp.lib differ