|
|
|
@ -100,7 +100,7 @@ bool customSort(const AI_Det_Channel_ &a, const AI_Det_Channel_ &b)
|
|
|
|
// 定义图片读取函数
|
|
|
|
// 定义图片读取函数
|
|
|
|
void readImage(const std::string &filename)
|
|
|
|
void readImage(const std::string &filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
cv::Mat image = cv::imread(filename);
|
|
|
|
cv::Mat image = cv::imread(filename, cv::IMREAD_GRAYSCALE);
|
|
|
|
if (image.empty())
|
|
|
|
if (image.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "Error: Unable to read image " << filename << std::endl;
|
|
|
|
std::cerr << "Error: Unable to read image " << filename << std::endl;
|
|
|
|
@ -1912,7 +1912,7 @@ void deal::ProductReadImgThreadFunc(int threadId)
|
|
|
|
// 读取左图
|
|
|
|
// 读取左图
|
|
|
|
long startTime = getcurTime();
|
|
|
|
long startTime = getcurTime();
|
|
|
|
cv::Mat left_img;
|
|
|
|
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())
|
|
|
|
if (!img16.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1936,7 +1936,7 @@ void deal::ProductReadImgThreadFunc(int threadId)
|
|
|
|
|
|
|
|
|
|
|
|
// 读取右图
|
|
|
|
// 读取右图
|
|
|
|
cv::Mat right_img;
|
|
|
|
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())
|
|
|
|
if (!img16.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -2095,7 +2095,7 @@ int deal::ReJson_product(std::vector<Json_Det_Path> &jsonList, std::string strPr
|
|
|
|
std::string json_str = buffer.str(); // 获取 JSON 文件的内容作为字符串
|
|
|
|
std::string json_str = buffer.str(); // 获取 JSON 文件的内容作为字符串
|
|
|
|
// 显示读取到的 JSON 字符串
|
|
|
|
// 显示读取到的 JSON 字符串
|
|
|
|
// std::cout << "JSON content: " << json_str << std::endl;
|
|
|
|
// 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 f0 = strJson.rfind('_');
|
|
|
|
int f1 = strJson.rfind('.');
|
|
|
|
int f1 = strJson.rfind('.');
|
|
|
|
int f2 = strJson.rfind('/');
|
|
|
|
int f2 = strJson.rfind('/');
|
|
|
|
@ -2420,7 +2420,7 @@ void deal::Thread_ReadImg(int id)
|
|
|
|
printf("pImageInfo == nullptr=================id %d=============\n", id);
|
|
|
|
printf("pImageInfo == nullptr=================id %d=============\n", id);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pImageInfo->img = cv::imread(pImageInfo->strPath, 0);
|
|
|
|
pImageInfo->img = cv::imread(pImageInfo->strPath, cv::IMREAD_GRAYSCALE);
|
|
|
|
m_ReadImgThread_Result[id] = pImageInfo;
|
|
|
|
m_ReadImgThread_Result[id] = pImageInfo;
|
|
|
|
|
|
|
|
|
|
|
|
// 线程完成读图,设置现场状态为 完成
|
|
|
|
// 线程完成读图,设置现场状态为 完成
|
|
|
|
|