|
|
|
|
@ -400,8 +400,7 @@ int deal::preCheck()
|
|
|
|
|
strRoot2 = read.strpath_2;
|
|
|
|
|
printf("strSearchImg strRoot %s\n", strRoot.c_str());
|
|
|
|
|
|
|
|
|
|
std::ifstream file123(strRoot);
|
|
|
|
|
bool bhave = file123.good();
|
|
|
|
|
bool bhave = fs::exists(strRoot);
|
|
|
|
|
if (!bhave)
|
|
|
|
|
{
|
|
|
|
|
printf("read img path error %d %s\n", bhave, strRoot.c_str());
|
|
|
|
|
@ -416,14 +415,8 @@ int deal::preCheck()
|
|
|
|
|
Read_Image dfe;
|
|
|
|
|
int re = 0;
|
|
|
|
|
dfe.pimage_ReadChannel = &m_image_ReadChannel;
|
|
|
|
|
if (strRoot2 != "")
|
|
|
|
|
{
|
|
|
|
|
re = dfe.Read_Image_List(strSearchImg, strRoot2, strProductID);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
re = dfe.Read_Image_List(strSearchImg, strProductID);
|
|
|
|
|
}
|
|
|
|
|
// 所有图片在同一个文件夹下,直接读取
|
|
|
|
|
re = dfe.Read_Image_List(strSearchImg, strProductID);
|
|
|
|
|
|
|
|
|
|
if (re != 0)
|
|
|
|
|
{
|
|
|
|
|
@ -455,26 +448,24 @@ int deal::preCheck()
|
|
|
|
|
AllImgNum = 0;
|
|
|
|
|
for (const auto pcam : product->camera_list)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<JC_IMAGE_INFO_> tem = std::make_shared<JC_IMAGE_INFO_>();
|
|
|
|
|
tem->strCamID = pcam->strCamName;
|
|
|
|
|
for (const auto pimage : pcam->image_list)
|
|
|
|
|
{
|
|
|
|
|
tem->strchannelName = pimage->strchannelName;
|
|
|
|
|
tem->strName = pimage->strName;
|
|
|
|
|
tem->strProductID = pimage->strProductID;
|
|
|
|
|
|
|
|
|
|
if (tem->strPath == "")
|
|
|
|
|
{
|
|
|
|
|
tem->strPath = pimage->strPath;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
auto& imgList = pcam->image_list;
|
|
|
|
|
// 同一camera内按配对处理:每两张图一组 (CAA+CAB / TAA+TAB)
|
|
|
|
|
// cv::glob 返回字母序,确保 A_CAA 在 A_CAB 前,M_CAA 在 M_CAB 前
|
|
|
|
|
for (size_t i = 0; i < imgList.size(); i += 2)
|
|
|
|
|
{
|
|
|
|
|
std::shared_ptr<JC_IMAGE_INFO_> tem = std::make_shared<JC_IMAGE_INFO_>();
|
|
|
|
|
tem->strCamID = pcam->strCamName;
|
|
|
|
|
tem->strchannelName = imgList[i]->strchannelName;
|
|
|
|
|
tem->strName = imgList[i]->strName;
|
|
|
|
|
tem->strProductID = imgList[i]->strProductID;
|
|
|
|
|
tem->strPath = imgList[i]->strPath;
|
|
|
|
|
if (i + 1 < imgList.size())
|
|
|
|
|
{
|
|
|
|
|
tem->strPath_B = pimage->strPath;
|
|
|
|
|
tem->strPath_B = imgList[i + 1]->strPath;
|
|
|
|
|
}
|
|
|
|
|
InsertReadImgInfo(tem);
|
|
|
|
|
AllImgNum++;
|
|
|
|
|
}
|
|
|
|
|
InsertReadImgInfo(tem);
|
|
|
|
|
AllImgNum++;
|
|
|
|
|
// break;
|
|
|
|
|
}
|
|
|
|
|
// AllImgNum = 1;
|
|
|
|
|
{
|
|
|
|
|
@ -568,8 +559,7 @@ int deal::Testsaveimg()
|
|
|
|
|
strProductID = read.strproduct;
|
|
|
|
|
printf("strSearchImg strRoot %s\n", strRoot.c_str());
|
|
|
|
|
|
|
|
|
|
std::ifstream file123(strRoot);
|
|
|
|
|
bool bhave = file123.good();
|
|
|
|
|
bool bhave = fs::exists(strRoot);
|
|
|
|
|
if (!bhave)
|
|
|
|
|
{
|
|
|
|
|
printf("read img path error %d %s\n", bhave, strRoot.c_str());
|
|
|
|
|
@ -1127,7 +1117,8 @@ int deal::GetDetImageInfo(std::string strProductID, std::string strSearchImg, st
|
|
|
|
|
std::string strs1 = strSearchImg + "/*.ytimage";
|
|
|
|
|
if(!runConfig.bdecode)
|
|
|
|
|
{
|
|
|
|
|
strs1 = strSearchImg + "/*.jpg";
|
|
|
|
|
strs1 = strSearchImg + "/*.png";
|
|
|
|
|
cv::glob(strs1, img_paths, true);
|
|
|
|
|
}
|
|
|
|
|
cv::glob(strs1, img_paths, true);
|
|
|
|
|
// printf("%ld \n", img_paths.size());
|
|
|
|
|
@ -2026,12 +2017,22 @@ void deal::Thread_ReadImg(int id)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// pImageInfo->img = cv::imread(pImageInfo->strPath, 0);
|
|
|
|
|
m_pextractImg->ReadCELLImg(pImageInfo->strPath, pImageInfo->img, runConfig.bdecode);
|
|
|
|
|
// cv::imwrite(pImageInfo->strchannelName + "_A_ssssde.png", pImageInfo->img);
|
|
|
|
|
if (pImageInfo->strPath_B != "")
|
|
|
|
|
if (!runConfig.bdecode)
|
|
|
|
|
{
|
|
|
|
|
// 不解码模式:直接用 opencv 读取图片
|
|
|
|
|
pImageInfo->img = cv::imread(pImageInfo->strPath, cv::IMREAD_GRAYSCALE);
|
|
|
|
|
if (pImageInfo->strPath_B != "")
|
|
|
|
|
{
|
|
|
|
|
pImageInfo->img_B = cv::imread(pImageInfo->strPath_B, cv::IMREAD_GRAYSCALE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_pextractImg->ReadCELLImg(pImageInfo->strPath_B, pImageInfo->img_B, runConfig.bdecode);
|
|
|
|
|
// cv::imwrite(pImageInfo->strchannelName + "_B_sssde.png", pImageInfo->img_B);
|
|
|
|
|
m_pextractImg->ReadCELLImg(pImageInfo->strPath, pImageInfo->img, runConfig.bdecode);
|
|
|
|
|
if (pImageInfo->strPath_B != "")
|
|
|
|
|
{
|
|
|
|
|
m_pextractImg->ReadCELLImg(pImageInfo->strPath_B, pImageInfo->img_B, runConfig.bdecode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_ReadImgThread_Result[id] = pImageInfo;
|
|
|
|
|
|