diff --git a/BaseModules/Hd_VirtualCamera_ReadFile.zip b/BaseModules/Hd_VirtualCamera_ReadFile.zip new file mode 100644 index 00000000..790db069 Binary files /dev/null and b/BaseModules/Hd_VirtualCamera_ReadFile.zip differ diff --git a/BaseModules/Hd_VirtualCamera_ReadFile/CMakeLists.txt b/BaseModules/Hd_VirtualCamera_ReadFile/CMakeLists.txt deleted file mode 100644 index e86c65b8..00000000 --- a/BaseModules/Hd_VirtualCamera_ReadFile/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -# 获取获取当前目录名 -get_filename_component(CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -string(TIMESTAMP RUN_TIME) -message( " model start : " ${CURRENT_FOLDER}:${RUN_TIME}) - -set(DLL_NAMES "mvs" "opencv") -foreach(child ${DLL_NAMES}) - LIST(APPEND ENV_INCLUDE ${${child}_include}) - LIST(APPEND ENV_LIB ${${child}_lib}) - LIST(APPEND ENV_TARGET ${${child}_target_link}) -endforeach() -message(" ENV_INCLUDE : " ${ENV_INCLUDE} ) -message(" ENV_LIB : " ${ENV_LIB} ) -message(" ENV_TARGET : " ${ENV_TARGET} ) -include_directories( - - ${ENV_INCLUDE} - ) - -link_directories ( - ${ENV_LIB} - - ) - - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -SET(CMAKE_CXX_STANDARD 11) -SET(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(CMAKE_AUTOMOC ON) -SET(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -FILE(GLOB HEAD_FILES "./*.h" ) -FILE(GLOB SRC_FILES "./*.cpp") -FILE(GLOB UI_FILES "./*.ui") - - -#find_package(Qt5 COMPONENTS Core REQUIRED) -find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED) -find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) - -add_library(${CURRENT_FOLDER} SHARED - ${HEAD_FILES} - ${SRC_FILES} - ${UI_FILES} - ) - - - -set_target_properties(${CURRENT_FOLDER} PROPERTIES LINKER_LANGUAGE C - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} - ) - - -target_link_libraries(${CURRENT_FOLDER} PRIVATE - ${ENV_TARGET} - Qt${QT_VERSION_MAJOR}::Core - ) - - -# target_compile_definitions(${CURRENT_FOLDER} PRIVATE HD_AIDEMO_MODULE_LIBRARY) - - - - -string(TIMESTAMP RUN_TIME) -message( " model end : " ${CURRENT_FOLDER}:${RUN_TIME}) diff --git a/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.cpp b/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.cpp deleted file mode 100644 index c770ea0e..00000000 --- a/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include "Hd_VirtualCamera_ReadFile.h" -namespace fs = std::filesystem; -/// -/// 初始化时读取目录的文件 -/// -std::vectorfiles; -string filePath; -string cameraName; -int fileIndex = 0; -/// -/// 一次读几张照片 -/// -int numOfGroup = 1; -string mode; -/// -/// 输出的图片的容器 -/// -std::vector srcImages; -std::vector folders; -Hd_VirtualCamera_ReadFile* create() -{ - qDebug() << "[INFO] " << "Hd_VirtualCamera_ReadFile create success!"; - return new Hd_VirtualCamera_ReadFile; -} -void destory(Hd_VirtualCamera_ReadFile* ptr) -{ - if (ptr) - { - delete ptr; - ptr = nullptr; - } - qDebug() << "[INFO] " << "Hd_VirtualCamera_ReadFile destory success!"; -} - -Hd_VirtualCamera_ReadFile::Hd_VirtualCamera_ReadFile() -{ - m_thread = new MyThread; -} - -Hd_VirtualCamera_ReadFile::~Hd_VirtualCamera_ReadFile() -{ - if (m_thread) - { - m_thread->exit(); - m_thread->wait(1); - delete m_thread; - m_thread = nullptr; - } - - qDebug() << "[INFO] " << " delete success!"; -} - -bool Hd_VirtualCamera_ReadFile::sendData(std::vector& mat, QByteArray& data) -{ - - if (srcImages.size() == 0) - { - return false; - } - for (auto img : srcImages) - mat.push_back(img); - srcImages.clear(); - return true; -} -void findFolders(const std::string& path, std::vector& folders) { - for (const auto& entry : fs::directory_iterator(path)) { - if (fs::is_directory(entry)) { - std::string folderPath = entry.path().string(); - folders.push_back(folderPath); - findFolders(folderPath, folders); // 递归调用,查找子文件夹 - } - } -} -void getAllFiles(string path, vector& files, string format) -{ - intptr_t hFile = 0;//恅璃曆梟 - struct _finddata_t fileinfo;//恅璃陓洘 - string p; - if ((hFile = _findfirst(p.assign(path).append("\\*" + format).c_str(), &fileinfo)) != -1) //恅璃湔婓 - { - do - { - if ((fileinfo.attrib & _A_SUBDIR))//瓚剿岆瘁峈恅璃標 - { - if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)//恅璃標靡笢祥漪"."睿".." - { - files.push_back(p.assign(path).append("\\").append(fileinfo.name)); //悵湔恅璃標靡 - getAllFiles(p.assign(path).append("\\").append(fileinfo.name), files, format); //菰寥梢盪恅璃標 - } - } - else - { - files.push_back(p.assign(path).append("\\").append(fileinfo.name));//彆祥岆恅璃標ㄛ揣湔恅璃靡 - } - } while (_findnext(hFile, &fileinfo) == 0); - _findclose(hFile); - } -} - -bool Hd_VirtualCamera_ReadFile::reciveData(std::vector& mat, QByteArray& data) -{ - m_flag = false; - Username = data.toStdString(); - return true; -} - -bool Hd_VirtualCamera_ReadFile::initParas(QByteArray&) -{ - if (Username.find_last_of(",") != 0 && Username.find_first_of(",") != 0 && Username.find_first_of(",") != Username.find_last_of(",")) - { - { - size_t comma1Pos = Username.find(','); - if (comma1Pos == std::string::npos) { - std::cout << "输入字符串格式错误,找不到第一个逗号。" << std::endl; - return 1; - } - - // 提取第一个参数 - cameraName = Username.substr(0, comma1Pos); - - // 从逗号后的位置继续找到第二个逗号的位置 - size_t comma2Pos = Username.find(',', comma1Pos + 1); - if (comma2Pos == std::string::npos) { - std::cout << "输入字符串格式错误,找不到第二个逗号。" << std::endl; - return 1; - } - - // 提取第二个参数 - mode = Username.substr(comma1Pos + 1, comma2Pos - comma1Pos - 1); - - // 从第二个逗号后的位置继续找到第三个逗号的位置 - size_t comma3Pos = Username.find(',', comma2Pos + 1); - if (comma3Pos == std::string::npos) { - std::cout << "输入字符串格式错误,找不到第三个逗号。" << std::endl; - return 1; - } - - // 提取第三个参数 - numOfGroup = stoi(Username.substr(comma2Pos + 1, comma3Pos - comma2Pos - 1)); - - // 第四个参数是最后一个逗号后的部分 - filePath = Username.substr(comma3Pos + 1); - } - //filePath = Username.substr(Username.find_last_of(",")+1, Username.size() - Username.find_last_of(",")); - //mode = Username.substr(0, Username.find_first_of(",")); - //numOfGroup = stoi(Username.substr(Username.find_first_of(",") + 1, Username.find_last_of(","))); - findFolders(filePath, folders); - return true; - } - else - return false; -} - -bool Hd_VirtualCamera_ReadFile::run() -{ - qDebug() << "[INFO] " << " run start" << QString::fromStdString(Username); - try - { - m_thread->start(); - while (true) - { - if (m_flag) - { - break; - } - QThread::msleep(1); - } - m_flag = false; - } - catch (QString ev) - { - qDebug() << "[Error] " << " ev:" << ev; - } - qDebug() << "[INFO] " << __LINE__ << " run end"; - return true; -} - - -void MyThread::run() -{ - if (!cameraName.compare("camera1")) - { - vectorfiles; - getAllFiles(folders[fileIndex], files, "bmp"); - if (fileIndex == folders.size() || fileIndex == files.size()) - fileIndex = 0; - vectornames; - for (int i = 0; i < files.size(); i++) - { - if (files[i].find(cameraName) != std::string::npos) - names.push_back(files[i]); - } - for (int i = 0; i < names.size(); i++) - { - for (std::string name : names) - { - switch (i) - { - case 0: - if (name.find("SprfSpecularReflectionImage") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - case 1: - if (name.find("SprfDiffuseReflectionImage") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - case 2: - if (name.find("SprfShapeImage1") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - case 3: - if (name.find("SprfShapeImage2") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - case 4: - if (name.find("SprfGlossRatioImage") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - case 5: - if (name.find("SprfNormalImage") != std::string::npos) - srcImages.push_back(imread(name, -1)); - break; - } - - } - } - } - else if (!cameraName.compare("camera2")) - { - vectorfiles; - vectorfiles2; - if (fileIndex == folders.size() || fileIndex == files.size()) - fileIndex = 0; - getAllFiles(folders[fileIndex], files, "bmp"); - getAllFiles(folders[fileIndex], files2, "tiff"); - for (int i = 0; i < files.size(); i++) - { - if (files[i].find(cameraName) != std::string::npos) - srcImages.push_back(imread(files[i], -1)); - } - for (int i = 0; i < files2.size(); i++) - { - if (files2[i].find(cameraName) != std::string::npos) - srcImages.push_back(imread(files2[i], -1)); - } - - } - else if (!cameraName.compare("camera3P")) - { - vectorfiles; - getAllFiles(folders[fileIndex], files, "bmp"); - if (fileIndex == folders.size() || fileIndex == files.size()) - fileIndex = 0; - for (int i = 0; i < files.size(); i++) - { - if (files[i].find(cameraName) != std::string::npos) - srcImages.push_back(imread(files[i], -1)); - } - if (fileIndex == files.size()) - fileIndex = 0; - } - else if (!cameraName.compare("camera3N")) - { - vectorfiles; - getAllFiles(folders[fileIndex], files, "bmp"); - if (fileIndex == folders.size() || fileIndex == files.size()) - fileIndex = 0; - for (int i = 0; i < files.size(); i++) - { - if (files[i].find(cameraName) != std::string::npos) - srcImages.push_back(imread(files[i], -1)); - } - } - fileIndex++; - - m_flag = true; -} diff --git a/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.h b/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.h deleted file mode 100644 index 55915007..00000000 --- a/BaseModules/Hd_VirtualCamera_ReadFile/Hd_VirtualCamera_ReadFile.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef Hd_VirtualCamera_ReadFile_H -#define Hd_VirtualCamera_ReadFile_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "base.h" - -using namespace cv; -using namespace std; -#pragma execution_character_set("utf-8") -// - -// - -static int index=0; //相机序号 -static string Username=""; -static bool m_flag = false; - -class MyThread; - -class Hd_VirtualCamera_ReadFile :public Base -{ -public: - Hd_VirtualCamera_ReadFile(); - virtual ~Hd_VirtualCamera_ReadFile(); - bool sendData(std::vector&,QByteArray&); - bool reciveData(std::vector&,QByteArray&); - bool initParas(QByteArray&); - bool run(); -private: - MyThread *m_thread = nullptr; -}; - -class MyThread : public QThread -{ - Q_OBJECT -public: - explicit MyThread(QObject *parent = nullptr):m_obj(parent){} - void run(); -private: - QObject *m_obj; -signals: - -}; - -extern "C" -{ -Q_DECL_EXPORT Hd_VirtualCamera_ReadFile * create(); -Q_DECL_EXPORT void destory(Hd_VirtualCamera_ReadFile * ptr); -} - -#endif // Hd_VirtualCamera_ReadFile_H diff --git a/BaseModules/Hd_VirtualCamera_ReadFile/base.h b/BaseModules/Hd_VirtualCamera_ReadFile/base.h deleted file mode 100644 index d9a66b04..00000000 --- a/BaseModules/Hd_VirtualCamera_ReadFile/base.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __BASECLASS_H__ -#define __BASECLASS_H__ - -#include -#include -#include -#include -#include -#include - -class Base :public QObject -{ - Q_OBJECT -public: - bool init_flag; //是否初始化,false,true - std::string paras; //传输数据 - cv::Mat m_mat; //传输图片 - std::string moduleName; //模块名称 -public: - Base() {} - virtual ~Base() {} - virtual bool sendData(std::vector&,QByteArray&){return true;} - virtual bool reciveData(std::vector&,QByteArray&){return true;} - virtual bool initParas(QByteArray&){return true;} - virtual bool run() {return true;} -}; - - -#endif diff --git a/HanddleAI/HandleAiUi-new/CMakeLists.txt b/HanddleAI/HandleAiUi-new/CMakeLists.txt index 21971343..982a541e 100644 --- a/HanddleAI/HandleAiUi-new/CMakeLists.txt +++ b/HanddleAI/HandleAiUi-new/CMakeLists.txt @@ -41,6 +41,8 @@ endforeach() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") +FILE(GLOB ALGO_HEAD_FILES "./algo/*.h" ) +FILE(GLOB ALGO_SRC_FILES "./algo/*.cpp") FILE(GLOB HANDLEAI_HEAD_FILES "./handleAi/*.h" ) FILE(GLOB HANDLEAI_SRC_FILES "./handleAi/*.cpp") FILE(GLOB UIMODULE_HEAD_FILES "./uiModule/*.h" ) @@ -77,6 +79,8 @@ if(ANDROID) ${UIMODULE_SRC_FILES} ${HANDLEAI_HEAD_FILES} ${HANDLEAI_SRC_FILES} + ${ALGO_HEAD_FILES} + ${ALGO_SRC_FILES} ${UI_FILES} ) else() @@ -96,6 +100,8 @@ else() ${UIMODULE_SRC_FILES} ${HANDLEAI_HEAD_FILES} ${HANDLEAI_SRC_FILES} + ${ALGO_HEAD_FILES} + ${ALGO_SRC_FILES} ${UI_FILES} "ff.rc" "icon.qrc" ) else() add_executable( ${CURRENT_FOLDER} WIN32 @@ -113,7 +119,9 @@ else() ${UIMODULE_SRC_FILES} ${HANDLEAI_HEAD_FILES} ${HANDLEAI_SRC_FILES} - ${UI_FILES}) + ${ALGO_HEAD_FILES} + ${ALGO_SRC_FILES} + ${UI_FILES} "ff.rc" "icon.qrc" ) endif() endif() diff --git a/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp b/HanddleAI/HandleAiUi-new/algo/algorithmThread.cpp similarity index 99% rename from HanddleAI/HandleAiUi-new/back/algorithmThread.cpp rename to HanddleAI/HandleAiUi-new/algo/algorithmThread.cpp index b98fb639..4475d2d3 100644 --- a/HanddleAI/HandleAiUi-new/back/algorithmThread.cpp +++ b/HanddleAI/HandleAiUi-new/algo/algorithmThread.cpp @@ -1,4 +1,4 @@ -#include +#include #include "FrontendBackendBridge.h" #include diff --git a/HanddleAI/HandleAiUi-new/back/algorithmThread.h b/HanddleAI/HandleAiUi-new/algo/algorithmThread.h similarity index 99% rename from HanddleAI/HandleAiUi-new/back/algorithmThread.h rename to HanddleAI/HandleAiUi-new/algo/algorithmThread.h index 4501e233..843ffea2 100644 --- a/HanddleAI/HandleAiUi-new/back/algorithmThread.h +++ b/HanddleAI/HandleAiUi-new/algo/algorithmThread.h @@ -736,7 +736,6 @@ public: void getAllFiles(std::string path, std::vector& files, std::string format); void Init(threadManager* threadManager) { tManager = threadManager; - //modelPtr = &threadManager->models; sql = threadManager->sql; snDatas = &threadManager->snDatas; } diff --git a/HanddleAI/HandleAiUi-new/algo/pinAioEvalute.h b/HanddleAI/HandleAiUi-new/algo/pinAioEvalute.h new file mode 100644 index 00000000..66def2e4 --- /dev/null +++ b/HanddleAI/HandleAiUi-new/algo/pinAioEvalute.h @@ -0,0 +1,53 @@ +#include + +void pinAioEvalute(std::shared_ptr data) +{ + auto start_time = std::chrono::high_resolution_clock::now(); + if (data->imgs.size() < 1) + { + qDebug() << __FUNCDNAME__ << __LINE__ << "camera Mat size is Error!"; + return; + } + ///////////////////ȡͼ///ÉùÃ÷///////////////////// + //ngNoteCls Note; + cv::Mat src; + cv::Mat Paint; + int CCD1OK = 1; + double CCD1height = -1; + double dmCodeWidth = 0, dmCodeHeight = 0; + double pixAccX = 0.013502052, pixAccY = 0.014005423575; + double camera1Width = 1, camera1Height = 2; + QFuture future1; + if (data->imgs.size() == 1) + { + src = data->imgs[0]; + if (Paint.channels() == 1) + cv::cvtColor(src, Paint, cv::COLOR_GRAY2BGR); + else + src.copyTo(Paint); + } + + + //} + if (CCD1OK == 2) + cv::putText(Paint, "NG", cv::Point(150, 600), 1, 10, cv::Scalar(0, 0, 255), 30); + else + cv::putText(Paint, "OK", cv::Point(150, 600), 1, 10, cv::Scalar(0, 255, 0), 30); + + ///////////////////ÎÞSN×èÈû/////////////////////// + //if (!data->SNcode.compare(snDatas->snErrorsnError)) + // data->SNcode = snDatas->waitForSn(data->timeCode); + cv::putText(Paint, data->SNcode, cv::Point(150, 800), 1, 10, cv::Scalar(0, 255, 0), 10); + /////////////////////SQL//////////////////////// + data->sqlVec.push_back({ "Camera1Result", CCD1OK }); + data->sqlVec.push_back({ "Camera1_Width", camera1Width }); + data->sqlVec.push_back({ "Camera1_Height", camera1Height }); + ////////////////////½á¹û±£´æ////////////////// + cv::resize(Paint, Paint, cv::Size(Paint.cols / 2, Paint.rows / 2)); + data->resultImgs.push_back(Paint); + //////////////CSV///////////////////////////// + std::string OKNG("OK"); + if (CCD1OK == 2)OKNG = "NG"; + qDebug() << "[Debug]algo1 end:" << QString::fromStdString(data->SNcode); + std::cout << "algo1 end:" << QString::fromStdString(data->SNcode).toStdString() << endl; +} \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/back/backEndManager.h b/HanddleAI/HandleAiUi-new/back/backEndManager.h index f615e570..900b9f53 100644 --- a/HanddleAI/HandleAiUi-new/back/backEndManager.h +++ b/HanddleAI/HandleAiUi-new/back/backEndManager.h @@ -19,11 +19,11 @@ public: //Êý¾ÝÀà jsonConfiguration* _jsonConfiguration = nullptr; detDataManager* _detDataManager = nullptr; + handleAiModelManager* _handleAiModelManager; //Ï߳ÌÀà triggerManager* _triggerManager = nullptr;//´¥·¢Æ÷ cameraManager* _cameraManager = nullptr;// threadManager* _threadManager = nullptr; - handleAiModelManager* _handleAiModelManager; backEndManager(); ~backEndManager(); diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp index f0f6bb11..bbd2caa8 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp +++ b/HanddleAI/HandleAiUi-new/back/threadPoolManager.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include +#include /// /// ¼ì²éĿ±êÎļþ¼ÐÊǷñ´æÔڣ¬²»´æÔÚÔ򴴽¨ /// @@ -42,86 +43,66 @@ threadManager::threadManager(QObject* parent) : QThread(parent) //¸¨ÖúÏ̳߳õʼ»¯ //oriSaveThread->oriThread = true; //oriSaveThread->Init(this); + this->start(); +} - //resSaveThread->Init(this); - threadAmount = bridge.back.json.algoThreads.algoDataMap.size(); - for (int i = 0; i < threadAmount; i++) +void threadManager::process() +{ +#pragma region ¼ì²é¶ÓÁÐÊǷñÓÐеÄÊý¾Ý + queueMutex.lock(); + while (insertQueue.size() > 0) + processData.push_back(std::make_pair(progress::waitImg,insertQueue.dequeue())); + queueMutex.unlock(); +#pragma endregion +#pragma region ¼ì²â״̬²¢´¦Àí + for (auto& data : processData) { - algoThread* aT = new algoThread(); - aT->Init(this); - //QObject::connect(aT, &algoThread::subThreadStart, [&]() { - // supportThread->start(); - // }); - algoThreadList.push_back(aT); + std::shared_ptr detDataPtr = data.second; + switch (data.first) + { + case waitImg: + if (detDataPtr->imgs.size() >= detDataPtr->imgAmountMin) + { + futures.insert(std::make_pair(detDataPtr->timeCode,std::async(std::launch::async, pinAioEvalute, detDataPtr))); + data.first = processing; + } + break; + case processing: + auto futrue = futures.find(detDataPtr->timeCode); + if (futrue == futures.end()) + { + std::cout << "???????" << std::endl; + } + if (futrue->second.valid()) + { + //processData + } + } } +#pragma endregion } void threadManager::run() { - + while(1) + { + process(); + QThread::msleep(1); + } } void threadManager::addTask(std::shared_ptr data) { - //cout << __LINE__ << "insert Data " << data ->timeCode<< endl; - { - algoThreadCls::datastruct _struct = bridge.back.json.algoThreads.getData(data->algoThreadName); - data->algoThreadIndex = _struct.threadIndex; - data->resShowIndex = _struct.showIndex; - data->imgAmountMin = _struct.imgAmountMin; - } - { - CameraListCls::datastruct _struct = bridge.back.json.camera.getData(data->cameraKeyName); - data->oriShowIndex = _struct.showIndex; - } + //{ + // CameraListCls::datastruct _struct = bridge.back.json.camera.getData(data->cameraKeyName); + // data->oriShowIndex = _struct.showIndex; + //} insertQueueMutex.lock(); - //insertQueue.push_back(data); - int threadId = data->algoThreadIndex; - if (threadId == -1) - { - cout << "threadId return -1 ,algoName " << data->algoThreadName.toStdString() << endl; - return; - } - algoThreadList[threadId]->addDetTask(data); + insertQueue.enqueue(data); insertQueueMutex.unlock(); //this->start(); } -bool threadManager::addTaskFreeThread(std::shared_ptr data) -{ -#if 0 - int index = 0; - for (index = 0; index < threadPoolList.size(); index++) - { - if (threadPoolList[index]->isRunning() == false) - { - threadPoolList[index]->addDetTask(data); - threadPoolList[index]->start(); - return true; - } - } - for (index = 0; index < threadPoolList.size(); index++) - { - if (threadPoolList[index]->nextObj.isEmpty() == true) - { - threadPoolList[index]->addDetTask(data); - return true; - } - } -#endif - return false; - -} threadManager::~threadManager() { - for (auto thread : algoThreadList) - { - thread->m_runFlag = false; - thread->terminate(); - while (thread->isRunning() == true); - } - for (auto thread : algoThreadList) - { - delete thread; - } } ////////////////DET//DATA////////////////// sncodeCls::sncodeCls() diff --git a/HanddleAI/HandleAiUi-new/back/threadPoolManager.h b/HanddleAI/HandleAiUi-new/back/threadPoolManager.h index 4798e813..9ae42026 100644 --- a/HanddleAI/HandleAiUi-new/back/threadPoolManager.h +++ b/HanddleAI/HandleAiUi-new/back/threadPoolManager.h @@ -226,16 +226,20 @@ class threadManager : public QThread Q_OBJECT public: + enum progress + { + waitImg, + processing + }; + explicit threadManager(QObject* parent = nullptr); - QMutex queueMutex; QQueue> detDataQueue; sqlManager* sql; //handleAiModel models;//³õʼ»¯ģÐÍ autoDelete* autoDeleteThread; - QMutex insertQueueMutex; - QQueue>insertQueue; - std::vectoralgoThreadList; + + void run(); void stop() { @@ -244,9 +248,16 @@ public: } void addTask(std::shared_ptr ); - bool addTaskFreeThread(std::shared_ptr ); sncodeCls snDatas; ~threadManager(); + + QMutex queueMutex; + + QMutex insertQueueMutex; + QQueue>insertQueue; + std::vector>> processData; + std::unordered_map> futures; + void process(); private: bool runFlag = true; QList>imgWaitList; diff --git a/HanddleAI/HandleAiUi-new/front/pages/sqlControlWidget.h b/HanddleAI/HandleAiUi-new/front/pages/sqlControlWidget.h new file mode 100644 index 00000000..54f8fcaf --- /dev/null +++ b/HanddleAI/HandleAiUi-new/front/pages/sqlControlWidget.h @@ -0,0 +1,57 @@ +#include +class sqlControlWidget :public QWidget +{ +public: + enum logType + { + stdConsle, + qtConsle + }; + QVBoxLayout* Layout = new QVBoxLayout(this); + QHBoxLayout* btnLayout = new QHBoxLayout(this); + std::vectorbtns; + QLabel* icon, * Title; + QStackedWidget* widgets = new QStackedWidget(); + + QLabel* disconnnectedLabel = new QLabel("·þÎñÒÑÀëÏß"); + sqlControlWidget() + { + QPalette palette; + palette.setColor(QPalette::WindowText, Qt::white); + QFont font("΢ÈíÑźÚ", 24, QFont::Bold); + QFont font2("΢ÈíÑźÚ", 108, QFont::Bold); + + widgets->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + widgets->setMaximumSize(9999, 9999); + + this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + this->setMaximumSize(9999, 9999); + this->setObjectName("sqlControlWidget"); + + Layout->setContentsMargins(0, 0, 0, 0); + Layout->setAlignment(Qt::AlignLeft | Qt::AlignTop); + + Title = new QLabel(u8"SQL²Ù×÷½çÃæ"); + Title->setFont(font); + Title->setPalette(palette); + Title->setAlignment(Qt::AlignLeft); + + disconnnectedLabel->setFont(font2); + disconnnectedLabel->setPalette(palette); + disconnnectedLabel->setAlignment(Qt::AlignCenter); + + Layout->addWidget(Title); + + btnLayout->setContentsMargins(0, 0, 0, 0); + btnLayout->setAlignment(Qt::AlignLeft); + + btnLayout->addWidget(disconnnectedLabel); + + Layout->addLayout(btnLayout); + + + } + +}; +#pragma once +#pragma once \ No newline at end of file diff --git a/HanddleAI/HandleAiUi-new/mainwindow.cpp b/HanddleAI/HandleAiUi-new/mainwindow.cpp index d1cffa23..f2f32996 100644 --- a/HanddleAI/HandleAiUi-new/mainwindow.cpp +++ b/HanddleAI/HandleAiUi-new/mainwindow.cpp @@ -221,8 +221,8 @@ void MainWindow::leftBarInit() defaultHeight, QIcon(":/topBar/icon/sql.png"), u8"SQL¿ÉÊӻ¯"); - //_logWidget = new logWidget(); - //pageWidgets.addWidget(_logWidget); + _sqlControlWidget = new sqlControlWidget(); + pageWidgets.addWidget(_sqlControlWidget); pageBtns.push_back(sqlBtn); for (int index = 0; index < pageBtns.size(); index++) diff --git a/HanddleAI/HandleAiUi-new/mainwindow.h b/HanddleAI/HandleAiUi-new/mainwindow.h index abc9b455..3650af1e 100644 --- a/HanddleAI/HandleAiUi-new/mainwindow.h +++ b/HanddleAI/HandleAiUi-new/mainwindow.h @@ -15,13 +15,17 @@ #include #include #include -#include -#include #include -#include #include #include #include + +#include +#include +#include +#include + +#define disableBackEndCheck 1 #pragma execution_character_set("utf-8") QT_BEGIN_NAMESPACE @@ -45,6 +49,7 @@ public: displayWidget* _displayWidget; configSettingWidget* _configSettingWidget; logWidget* _logWidget; + sqlControlWidget* _sqlControlWidget; private: Ui::MainWindow* ui; //动画效果 @@ -92,7 +97,14 @@ public slots: { if (input == true) { - if (backEndInit == true) +#if disableBackEndCheck == 0 + if (backEndInit == false) + { + isLogin = true; + loading(true); + } + else +#endif { blurEffectAnimation->setStartValue(0); blurEffectAnimation->setEndValue(20); @@ -102,11 +114,6 @@ public slots: blurEffectAnimation->setEndValue(0); blurEffectAnimation->start(); } - else - { - isLogin = true; - loading(true); - } } else if (input == false) { diff --git a/lib/Hd_VirtualCamera_ReadFile.exp b/lib/Hd_VirtualCamera_ReadFile.exp index 97564e7e..f99ac802 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 deleted file mode 100644 index 6ea40c15..00000000 Binary files a/lib/Hd_VirtualCamera_ReadFile.lib and /dev/null differ