From 7c0dea2facbad4b0ed9e229a670eb7d395a1062f Mon Sep 17 00:00:00 2001 From: liusiyang Date: Wed, 29 Jul 2026 09:25:00 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AF=BB=E5=9B=BE=E5=BC=BA=E5=88=B6?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E7=81=B0=E5=BA=A6=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AlgorithmModule/src/AI_Edge_QX_Det.cpp | 4 ++-- example/LoadImage.cpp | 2 +- example/deal.cpp | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AlgorithmModule/src/AI_Edge_QX_Det.cpp b/AlgorithmModule/src/AI_Edge_QX_Det.cpp index 3156286..ec293f7 100644 --- a/AlgorithmModule/src/AI_Edge_QX_Det.cpp +++ b/AlgorithmModule/src/AI_Edge_QX_Det.cpp @@ -129,11 +129,11 @@ int AI_Edge_QX_Det::Detect(const cv::Mat &img, cv::Mat &detmask, DetConfig *pDet m_pdetlog = pdetlog; if (pDetConfig->ninstruct == 767) { - // nRuntype = 1; + nRuntype = 1; } else if (pDetConfig->ninstruct == 768) { - // nRuntype = 2; + nRuntype = 2; } bool bdege = false; diff --git a/example/LoadImage.cpp b/example/LoadImage.cpp index dc19023..628feb2 100644 --- a/example/LoadImage.cpp +++ b/example/LoadImage.cpp @@ -225,7 +225,7 @@ bool LoadImage::matchesExtension( cv::Mat LoadImage::loadImageFile(const fs::path &path) const { // 使用 IMREAD_UNCHANGED 保留原图通道和位深信息 - return cv::imread(path.string(), cv::IMREAD_UNCHANGED); + return cv::imread(path.string(), cv::IMREAD_GRAYSCALE); } /// @brief 加载指定目录下的所有图片(产品 - 图片对两层结构) diff --git a/example/deal.cpp b/example/deal.cpp index 7f6b26f..aa4b29b 100644 --- a/example/deal.cpp +++ b/example/deal.cpp @@ -100,7 +100,7 @@ bool customSort(const AI_Det_Channel_ &a, const AI_Det_Channel_ &b) // 定义图片读取函数 void readImage(const std::string &filename) { - cv::Mat image = cv::imread(filename); + cv::Mat image = cv::imread(filename, cv::IMREAD_GRAYSCALE); if (image.empty()) { std::cerr << "Error: Unable to read image " << filename << std::endl; @@ -1912,7 +1912,7 @@ void deal::ProductReadImgThreadFunc(int threadId) // 读取左图 long startTime = getcurTime(); cv::Mat left_img; - cv::Mat img16 = cv::imread(task->left_path, cv::IMREAD_UNCHANGED); + cv::Mat img16 = cv::imread(task->left_path, cv::IMREAD_GRAYSCALE); if (!img16.empty()) { @@ -1936,7 +1936,7 @@ void deal::ProductReadImgThreadFunc(int threadId) // 读取右图 cv::Mat right_img; - img16 = cv::imread(task->right_path, cv::IMREAD_UNCHANGED); + img16 = cv::imread(task->right_path, cv::IMREAD_GRAYSCALE); if (!img16.empty()) { @@ -2095,7 +2095,7 @@ int deal::ReJson_product(std::vector &jsonList, std::string strPr std::string json_str = buffer.str(); // 获取 JSON 文件的内容作为字符串 // 显示读取到的 JSON 字符串 // std::cout << "JSON content: " << json_str << std::endl; - cv::Mat cutimg = cv::imread(strimg, 0); + cv::Mat cutimg = cv::imread(strimg, cv::IMREAD_GRAYSCALE); int f0 = strJson.rfind('_'); int f1 = strJson.rfind('.'); int f2 = strJson.rfind('/'); @@ -2420,7 +2420,7 @@ void deal::Thread_ReadImg(int id) printf("pImageInfo == nullptr=================id %d=============\n", id); return; } - pImageInfo->img = cv::imread(pImageInfo->strPath, 0); + pImageInfo->img = cv::imread(pImageInfo->strPath, cv::IMREAD_GRAYSCALE); m_ReadImgThread_Result[id] = pImageInfo; // 线程完成读图,设置现场状态为 完成