From dcde7fd9e7e0058f3620d182a3270e3aade7f9ba Mon Sep 17 00:00:00 2001 From: liusiyang Date: Fri, 4 Sep 2026 15:19:37 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E6=95=B4=E7=90=861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AlgorithmModule/src/ALLImgCheckAnalysisy.cpp | 101 ------------------- AlgorithmModule/src/Pin_QX_Det.cpp | 2 + ConfigModule/src/ConfigManager.cpp | 2 + example/deal.cpp | 1 + 4 files changed, 5 insertions(+), 101 deletions(-) diff --git a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp index 9af3878..1dba346 100644 --- a/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp +++ b/AlgorithmModule/src/ALLImgCheckAnalysisy.cpp @@ -12,99 +12,6 @@ #include "AI_Factory.h" #include -std::vector m_FlawCodeList; - -std::vector QX_Result_Names = - { - "OK", - "aotudian", - "other", - "line", - "zangwu", - "edge", - "ymhs", - "dianzhuang", - "posun", - "xianwei", - "shuizi", - "danban", - "fuchen", - }; -std::vector QX_Result_Code = - { - "P0000", - "MA507", - "MA508", - "MA506", - "MA504", - "MA503", - "MA502", - "MA505", - "MA501", - "P0001", - "P0002", - "P0003", - "P0004", -}; - -int ReadFlawCodeConfig(std::string json_path) -{ - m_FlawCodeList.erase(m_FlawCodeList.begin(), m_FlawCodeList.end()); - std::string strPath = json_path; - printf("ReadFlawCodeConfig path %s\n", strPath.c_str()); - Json::CharReaderBuilder builder; - builder["collectComments"] = true; - Json::Value root; - std::string err; - std::ifstream ifs(strPath); - if (!ifs.is_open()) - { - printf("error:file is open\n"); - return 0; - } - if (!Json::parseFromStream(builder, ifs, &root, &err)) - { - printf("error:parseFromStream\n"); - return 0; - } - - for (int i = 0; i < root.size(); i++) - { - // printf("Node idx %d /%d \n", i, root.size()); - - ReadFlawCode tem; - tem.flaw_name = root[i]["zh_name"].asString(); - tem.flaw_code = root[i]["en_name"].asString(); - string desc = root[i]["desc"].asString(); - { - - std::istringstream stream(desc); - std::string token; - - // 使用 getline 按照分号分割 - while (std::getline(stream, token, ';')) - { - tem.config_flaw_name.push_back(token); - } - } - m_FlawCodeList.push_back(tem); - } - for(int i = 0; i < m_FlawCodeList.size(); i++) - { - if(i >= QX_Result_Names.size()) { - QX_Result_Names.push_back(m_FlawCodeList.at(i).flaw_name); - QX_Result_Code.push_back(m_FlawCodeList.at(i).flaw_code); - } - else - { - QX_Result_Names.at(i) = m_FlawCodeList.at(i).flaw_name; - QX_Result_Code.at(i) = m_FlawCodeList.at(i).flaw_code; - } - - } - return 0; -} - double calculateDistanceBetweenRectCenters(const cv::Rect &rect1, const cv::Rect &rect2, float fx, float fy) { // 计算矩形1的中心点 @@ -519,14 +426,6 @@ int ALLImgCheckAnalysisy::ExitSystem() int ALLImgCheckAnalysisy::InitCameraCheckAnalysisy() { - string defect_list_file = m_pConfigManager->GetJsonPath(); - if (defect_list_file == "") { - defect_list_file = "/var/aidlux/efs/model/defect_list.json"; - } - else{ - defect_list_file += "/defect_list.json"; - } - ReadFlawCodeConfig(defect_list_file); m_pCameraCheckAnalysisyList.clear(); for (const auto &config : m_pConfigManager->Config_instances_) { diff --git a/AlgorithmModule/src/Pin_QX_Det.cpp b/AlgorithmModule/src/Pin_QX_Det.cpp index 475bba4..1b351bb 100644 --- a/AlgorithmModule/src/Pin_QX_Det.cpp +++ b/AlgorithmModule/src/Pin_QX_Det.cpp @@ -46,4 +46,6 @@ int Pin_QX_Det::GetPinMask(const cv::Mat &img, DetConfigResult *pDetConfig, Mat cv::imwrite(pDetConfig->strChannel +"_pin_" +"in.png", detImg); cv::imwrite(pDetConfig->strChannel +"_pin_" +"out_mask.png", mask); } + + return 0; } \ No newline at end of file diff --git a/ConfigModule/src/ConfigManager.cpp b/ConfigModule/src/ConfigManager.cpp index 4750763..047864e 100644 --- a/ConfigModule/src/ConfigManager.cpp +++ b/ConfigModule/src/ConfigManager.cpp @@ -20,6 +20,8 @@ ConfigManager::~ConfigManager() { } +std::vector m_FlawCodeList; + std::vector QX_Result_Names = { "OK", diff --git a/example/deal.cpp b/example/deal.cpp index ff62110..78e2b66 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -423,6 +423,7 @@ int deal::preCheck() { continue; } + pushImgNum++; } SetStatus_List(ThreadIdx, Thread_Status_READY); GetImgNum++;