You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
2.8 KiB
118 lines
2.8 KiB
/*
|
|
* @Author: xiewenji 527774126@qq.com
|
|
* @Date: 2025-09-13 20:39:37
|
|
* @LastEditors: xiewenji 527774126@qq.com
|
|
* @LastEditTime: 2025-09-23 14:29:12
|
|
* @FilePath: /BOE_CELL_AOI_Detect/AlgorithmModule/src/CameraResult.cpp
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
#include "ImageAllResult.h"
|
|
|
|
ImageAllResult::ImageAllResult()
|
|
{
|
|
detlog = std::make_shared<DetLog>();
|
|
pDetResult = std::make_shared<One_Image_CheckResult_>();
|
|
}
|
|
|
|
ImageAllResult::~ImageAllResult()
|
|
{
|
|
}
|
|
|
|
void ImageAllResult::AddLog(std::string str)
|
|
{
|
|
LogList.push_back(str);
|
|
}
|
|
ImageAllResult::DetStep ImageAllResult::getStep()
|
|
{
|
|
std::lock_guard<std::mutex> lock_cam(mtx_Det);
|
|
return m_step;
|
|
}
|
|
void ImageAllResult::setStep(DetStep step)
|
|
{
|
|
std::lock_guard<std::mutex> lock_cam(mtx_Det);
|
|
m_step = step;
|
|
}
|
|
|
|
bool ImageAllResult::IsNotDet()
|
|
{
|
|
std::lock_guard<std::mutex> lock_cam(mtx_Det);
|
|
if (m_step == DetStep_NotDet)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
int ImageAllResult::AddDetImage(std::shared_ptr<shareImage> p)
|
|
{
|
|
{
|
|
std::lock_guard<std::mutex> lock_cam(mtx_Det);
|
|
result = std::make_shared<CheckResult>();
|
|
p->time_PushIn = CheckUtil::getcurTime();
|
|
result->in_shareImage = p;
|
|
result->checkStatus = 1;
|
|
result->nDetStep = 0;
|
|
result->nresult = -1;
|
|
result->basicResult.img_id = p->img_id;
|
|
result->basicResult.imgtype = p->imgtype;
|
|
result->basicResult.imgstr = p->imgstr;
|
|
result->basicResult.strChannel = p->strChannel;
|
|
|
|
strChannel = p->strChannel;
|
|
strBaseInfo = productBaseResult->strproductName + " cam " + cameraBaseResult->strCameraName + " channel " + strChannel;
|
|
|
|
if (p->Det_Mode == DET_MODE_ReJson)
|
|
{
|
|
m_CheckResultJson.GetConfig(p->resultJson, pDetResult);
|
|
|
|
fscale_detToresult_x = 1;
|
|
fscale_detToresult_y = 1;
|
|
// 图片
|
|
if (!p->img.empty())
|
|
{
|
|
detImg = p->img;
|
|
/* code */
|
|
}
|
|
else
|
|
{
|
|
if (pDetResult->CutRoi.width > 0 && pDetResult->CutRoi.height > 0)
|
|
{
|
|
detImg = cv::Mat::zeros(pDetResult->CutRoi.height, pDetResult->CutRoi.width, CV_8UC1);
|
|
}
|
|
else
|
|
{
|
|
detImg = cv::Mat::zeros(1000, 2000, CV_8UC1);
|
|
}
|
|
}
|
|
|
|
{
|
|
|
|
cv::Size sz;
|
|
sz.width = RESIZE_IMAGE_WIDTH;
|
|
|
|
float fw = RESIZE_IMAGE_WIDTH * 1.0f / detImg.cols;
|
|
sz.height = int(detImg.rows * fw);
|
|
|
|
cv::resize(detImg, resultImg, sz);
|
|
if (resultImg.channels() == 1)
|
|
{
|
|
cv::cvtColor(resultImg, resultImg, cv::COLOR_GRAY2BGR);
|
|
}
|
|
|
|
result->resultimg = resultImg;
|
|
|
|
result->cutSrcimg = detImg;
|
|
|
|
fscale_detToresult_x = resultImg.cols * 1.0f / detImg.cols;
|
|
fscale_detToresult_y = resultImg.rows * 1.0f / detImg.rows;
|
|
}
|
|
|
|
// pDetResult->print("result");
|
|
// getchar();
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|