修改数据上传MinIO的细节

This commit is contained in:
Mr.V 2024-11-26 14:40:12 +08:00
parent db3f48994d
commit 7883c96736
2 changed files with 20 additions and 13 deletions

View File

@ -154,24 +154,26 @@ APP_ERROR ToMinioSrvEngine::Process()
+ "/"; + "/";
for (auto & it : pDetectResultData->vecImage) for (auto & it : pDetectResultData->vecImage)
{ {
std::string strLocalPath, strMinIoPath;
strLocalPath.append(this->baseConfig_.strDebugResultPath)
.append(std::string("/"))
.append(strFilePath)
.append(it);
strMinIoPath.append(strFilePath)
.append(it);
if (!PutObject(this->minioConfig_.strBucket, if (!PutObject(this->minioConfig_.strBucket,
strFilePath + it, strMinIoPath,
this->baseConfig_.strDebugResultPath strLocalPath))
.append("/")
.append(strFilePath)
.append("/")
+ it))
{ {
LogWarn << "数据上传失败! -- " << this->baseConfig_.strResultPath + "/" LogWarn << "数据上传失败! -- " << this->baseConfig_.strDebugResultPath;
+ it;
} }
else else
{ {
LogInfo << "数据上传MinIO 成功!!" << this->minioConfig_.strBucket+ "/" LogInfo << "数据上传MinIO 成功!!"
+ it << this->minioConfig_.strBucket + strMinIoPath
<< " -->" << " -->"
<< this->baseConfig_.strResultPath + "/" << strLocalPath;
+ it;
} }
} }
} }

View File

@ -51,6 +51,7 @@ APP_ERROR SaveDebugImageEngine::Process()
std::shared_ptr<VStep2OutputData> pVStep2OutputData = std::static_pointer_cast<VStep2OutputData>(pvoidd); std::shared_ptr<VStep2OutputData> pVStep2OutputData = std::static_pointer_cast<VStep2OutputData>(pvoidd);
std::string strDataDir = this->baseConfig_.strDebugResultPath + "/" std::string strDataDir = this->baseConfig_.strDebugResultPath + "/"
+ pVStep2OutputData->strDetectDate + "/" + pVStep2OutputData->strDetectDate + "/"
+ StringUtil::getins()->replace_all_distinct(pVStep2OutputData->strDetectTime, ":", "-") + StringUtil::getins()->replace_all_distinct(pVStep2OutputData->strDetectTime, ":", "-")
@ -98,11 +99,11 @@ APP_ERROR SaveDebugImageEngine::Process()
base_line++; base_line++;
} }
bool bIsDivideSpace = false;
cv::Scalar cvScalar = {0, 255, 0, 255}; cv::Scalar cvScalar = {0, 255, 0, 255};
float centerX = pVStep2OutputData->step2ResultData.fLTX + (pVStep2OutputData->step2ResultData.fRBX - pVStep2OutputData->step2ResultData.fLTX)/2; float centerX = pVStep2OutputData->step2ResultData.fLTX + (pVStep2OutputData->step2ResultData.fRBX - pVStep2OutputData->step2ResultData.fLTX)/2;
float centerY = pVStep2OutputData->step2ResultData.fLTY + (pVStep2OutputData->step2ResultData.fRBY - pVStep2OutputData->step2ResultData.fLTY)/2; float centerY = pVStep2OutputData->step2ResultData.fLTY + (pVStep2OutputData->step2ResultData.fRBY - pVStep2OutputData->step2ResultData.fLTY)/2;
// auto start = std::chrono::system_clock::now(); //计时开始
cv::rectangle(image, cv::rectangle(image,
cv::Point(pVStep2OutputData->step2ResultData.fLTX, pVStep2OutputData->step2ResultData.fLTY), cv::Point(pVStep2OutputData->step2ResultData.fLTX, pVStep2OutputData->step2ResultData.fLTY),
cv::Point(pVStep2OutputData->step2ResultData.fRBX, pVStep2OutputData->step2ResultData.fRBY), cv::Point(pVStep2OutputData->step2ResultData.fRBX, pVStep2OutputData->step2ResultData.fRBY),
@ -118,6 +119,7 @@ APP_ERROR SaveDebugImageEngine::Process()
linePoint, linePoint,
cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 0, 180), 2); cv::FONT_HERSHEY_SIMPLEX, 1, cv::Scalar(0, 255, 0, 180), 2);
for (const auto &step2ResultData : pVStep2OutputData->vecCornerResultData) for (const auto &step2ResultData : pVStep2OutputData->vecCornerResultData)
{ {
cvScalar = {0, 255, 255, 255}; cvScalar = {0, 255, 255, 255};
@ -130,6 +132,8 @@ APP_ERROR SaveDebugImageEngine::Process()
cv::Point(centerX_corner, step2ResultData.fLTY-30), cv::Point(centerX_corner, step2ResultData.fRBY+30), cv::Point(centerX_corner, step2ResultData.fLTY-30), cv::Point(centerX_corner, step2ResultData.fRBY+30),
cvScalar, 1); cvScalar, 1);
} }
// auto end = std::chrono::system_clock::now();
// LogDebug << "图片存储用时: " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms " << strImagePath;
if (!cv::imwrite(strImagePath, image, this->vecCompressionParams_)) if (!cv::imwrite(strImagePath, image, this->vecCompressionParams_))
{ {
@ -139,6 +143,7 @@ APP_ERROR SaveDebugImageEngine::Process()
// { // {
// LogInfo << "图片存储成功:" << strImagePath; // LogInfo << "图片存储成功:" << strImagePath;
// } // }
} }
return APP_ERR_OK; return APP_ERR_OK;
} }