fix 批量离线测试结果文件打印

main
liusiyang 3 weeks ago
parent 494d0da8f7
commit d5b0ac89bc

@ -7,6 +7,27 @@
#include <string>
#include "CheckUtil.hpp"
#include "LoadImage.hpp" // #include "LoadImage.h"
bool check_strChannel(string strChannel){
if(strChannel == "XD" || strChannel == "XON") return false;
size_t pos = strChannel.find_last_of('-');
// 没有 '-' 返回true
if (pos == string::npos) {
return true;
}
for (size_t i = pos + 1; i < strChannel.size(); ++i) {
// 最后一个'-'后有非数字,保留
if (!isdigit(strChannel[i])) {
return true;
}
}
return false;
}
std::string ExtractFileNameWithoutExtension(const std::string &strImgPath)
{
// 查找最后一个斜杠 '/' 或 '\' 的位置
@ -1470,6 +1491,74 @@ int deal::SendCheckImg(const CheckImgNotifyInfo &info, IN_IMG_Status_ status, bo
// info.left_img.cols, info.left_img.rows,
// info.right_img.cols, info.right_img.rows,
// info.readTimeMs);
std::string str = "";
if(info.left_path != "")
{
str = info.left_path + "/*.jpg";
}
else if(info.right_path != "")
{
str = info.right_path + "/*.jpg";
}
JC_IMAGE_INFO_ curImageInfo;
curImageInfo.strchannelName = info.channelName;
curImageInfo.strProductID = info.productId;
curImageInfo.strCamID = info.cameraSide;
curImageInfo.strName = info.imageName;
curImageInfo.img = info.left_img;
curImageInfo.strPath = str;
if (!check_strChannel(info.channelName))
{
cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Skip channel " << info.channelName << endl;
}
else
{
m_ImageInfoList.push_back(curImageInfo);
}
if(m_productIdList.count(info.productId) <= 0)
{
Det_One_Result_Info tem_one;
tem_one.Product_ID = info.productId;
tem_one.result = 0;
long ts = getcurTime();
tem_one.time_s = ts;
for (int i = 0; i < m_ImageInfoList.size(); i++)
{
if(m_ImageInfoList.at(i).strProductID == info.productId)
{
Det_single_img_Result_Info tem_single;
tem_single.name = m_ImageInfoList.at(i).strchannelName;
tem_single.result = 0;
tem_one.img_result_list.push_back(tem_single);
}
}
m_DetResult.one_result_list.push_back(tem_one);
m_DetResult.det_num_all++;
}
else
{
Det_One_Result_Info tem_one;
tem_one.Product_ID = info.productId;
tem_one.result = 0;
long ts = getcurTime();
tem_one.time_s = ts;
for (int i = 0; i < m_ImageInfoList.size(); i++)
{
if(m_ImageInfoList.at(i).strProductID == info.productId)
{
Det_single_img_Result_Info tem_single;
tem_single.name = m_ImageInfoList.at(i).strchannelName;
tem_single.result = 0;
tem_one.img_result_list.push_back(tem_single);
}
}
m_DetResult.one_result_list.pop_back();
m_DetResult.one_result_list.push_back(tem_one);
}
m_productIdList.insert(info.productId);
m_nProductSuccessCount.fetch_add(1);

@ -799,6 +799,8 @@ public:
std::mutex m_checkNotifyMutex; // 通知队列锁
std::condition_variable m_checkNotifyCV; // 通知条件变量
std::atomic<int> m_nCheckNotifiedCount{0}; // 已通知数量
std::set<std::string> m_productIdList; // 产品ID列表
};
#endif //_CORELOGICFACTORY_HPP_
Loading…
Cancel
Save