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.

111 lines
2.6 KiB

/*
* @Author: xiewenji 527774126@qq.com
* @Date: 2025-09-13 20:39:37
* @LastEditors: xiewenji 527774126@qq.com
* @LastEditTime: 2025-09-17 16:39:47
* @FilePath: /BOE_ZB_SOCKET_Detect/AlgorithmModule/src/CameraResult.cpp
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
#include "CameraResult.h"
CameraResult::CameraResult()
{
cameraBaseResult = std::make_shared<CameraBaseResult>();
detlog = std::make_shared<DetLog>();
time_start = 0;
}
CameraResult::~CameraResult()
{
}
void CameraResult::AddLog(std::string str)
{
LogList.push_back(str);
}
int CameraResult::AddDetImage(std::shared_ptr<shareImage> p)
{
if (time_start == 0)
{
time_start = CheckUtil::getcurTime();
/* code */
}
std::shared_ptr<ImageAllResult> imgResult = std::make_shared<ImageAllResult>();
imgResult->cameraBaseResult = cameraBaseResult;
imgResult->productBaseResult = productBaseResult;
if (p->Det_Mode == DET_MODE_ReJson)
{
bJson = true;
}
imgResult->AddDetImage(p);
{
std::lock_guard<std::mutex> lock_cam(mtx_DetImageList);
ImageALLDetResultList.push_back(imgResult);
}
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
cameraImage_Status.bHaveImg = true;
cameraImage_Status.bHave_L255 = true;
}
std::string strTimg = CheckUtil::getCurTimeHMS();
detlog->AddCheckstr(PrintLevel_0, "PushInImg", " product %s Cam %s add new image channel = %s %s",
productBaseResult->strproductName.c_str(),
cameraBaseResult->strCameraName.c_str(), imgResult->strChannel.c_str(), strTimg.c_str());
return 0;
}
bool CameraResult::bCheckCamplate()
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
if (checkStep == Check_Step_Complete)
{
return true;
}
return false;
}
Check_Step CameraResult::GetCheckStep()
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
return checkStep;
}
void CameraResult::SetCheckStep(Check_Step step)
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
checkStep = step;
}
bool CameraResult::getImgPushComplate()
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
return bIsImgComplete;
}
void CameraResult::setImgPushComplate()
{
std::lock_guard<std::mutex> lock_cam(mtx_Det);
bIsImgComplete = true;
}
std::shared_ptr<ImageAllResult> CameraResult::GetNoDetImg()
{
std::lock_guard<std::mutex> lock_cam(mtx_DetImageList);
for (auto ptr : ImageALLDetResultList)
{
if (ptr->IsNotDet())
{
return ptr;
}
}
return nullptr;
}