修正像素切分中的bug
This commit is contained in:
parent
bcc5f6bcd4
commit
7f48282f7d
|
|
@ -47,7 +47,9 @@ void ControlEngine::initParam()
|
|||
this->strDetectDate_ = "";
|
||||
for (int i = 0; i < this->vecDataSourceConfig_.size(); ++i)
|
||||
{
|
||||
this->mapDetectNO_[i] = 1;
|
||||
this->mapDetectNO_[i] = 0;
|
||||
this->mapIdentifyType_[i] = IDENTIFY_INIT;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -62,18 +64,10 @@ void ControlEngine::endIdentify(int iDataSource)
|
|||
outputQueMap_[strPort1_]->push(std::static_pointer_cast<void>(pVDetectInfo), true);
|
||||
outputQueMap_[strPort2_]->push(std::static_pointer_cast<void>(pVDetectInfo), true);
|
||||
|
||||
this->mapDetectNO_[iDataSource] = 1;
|
||||
this->mapDetectNO_[iDataSource] = 0;
|
||||
this->mapIdentifyType_[iDataSource] = IDENTIFY_INIT;
|
||||
|
||||
bool bAllEnd = true;
|
||||
for (const auto & dataSource_it : this->mapDetectNO_)
|
||||
{
|
||||
if (dataSource_it.second != 1) bAllEnd = false;
|
||||
}
|
||||
if (bAllEnd)
|
||||
{
|
||||
g_identify_type = IDENTIFY_INIT;
|
||||
this->strDetectDate_ = "";
|
||||
}
|
||||
LogInfo << " 数据源:" << iDataSource << " --- 识别结束!";
|
||||
}
|
||||
|
||||
void ControlEngine::sendWSEngine(std::string msg)
|
||||
|
|
@ -83,6 +77,19 @@ void ControlEngine::sendWSEngine(std::string msg)
|
|||
outputQueMap_[strPort0_]->push(std::static_pointer_cast<void>(std::make_shared<std::string>(msg)));
|
||||
}
|
||||
|
||||
bool ControlEngine::isDetecting()
|
||||
{
|
||||
for (const auto & dataSource : this->mapIdentifyType_)
|
||||
{
|
||||
if (dataSource.second == IDENTIFY_START)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ControlEngine::detectControl(std::shared_ptr<std::string> pWSServerOrder)
|
||||
{
|
||||
Json::CharReaderBuilder readerBuilder;
|
||||
|
|
@ -116,24 +123,25 @@ void ControlEngine::detectControl(std::shared_ptr<std::string> pWSServerOrder)
|
|||
|
||||
switch (jvOrder["commandType"].asInt()) {
|
||||
case IDENTIFY_START:
|
||||
if (g_identify_type == IDENTIFY_START)
|
||||
|
||||
if (this->isDetecting())
|
||||
{
|
||||
std::string msg = "当前正在识别,无需重复发送识别信号";
|
||||
LogWarn << msg;
|
||||
this->sendWSEngine(msg);
|
||||
break;
|
||||
}
|
||||
g_identify_type = IDENTIFY_START;
|
||||
this->mapIdentifyType_ = {{0, IDENTIFY_START}, {1, IDENTIFY_START}, {2, IDENTIFY_START}};
|
||||
break;
|
||||
case IDENTIFY_STOP:
|
||||
if (!g_identify_type)
|
||||
if (!this->isDetecting())
|
||||
{
|
||||
std::string msg = "当前已停止识别,无需重复发送结束信号";
|
||||
LogWarn << msg;
|
||||
this->sendWSEngine(msg);
|
||||
break;
|
||||
}
|
||||
g_identify_type = IDENTIFY_INIT;
|
||||
this->mapIdentifyType_ = {{0, IDENTIFY_INIT}, {1, IDENTIFY_INIT}, {2, IDENTIFY_INIT}};
|
||||
break;
|
||||
case IDENTIFY_RECORD:
|
||||
if (!jvOrder.isMember("containerNo"))
|
||||
|
|
@ -181,29 +189,36 @@ APP_ERROR ControlEngine::Process()
|
|||
|
||||
if (pProcessData->bIsEnd)
|
||||
{
|
||||
// 仅读是视频模式下会进行
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] == 1) continue;
|
||||
if (!this->isDetecting()) continue;
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 视频画面播放结束:停止识别!";
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 画面读取结束:停止识别!";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!g_identify_type)
|
||||
if (!this->isDetecting())
|
||||
{
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] != 1)
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] > 0)
|
||||
{
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
}
|
||||
this->strDetectDate_ = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->mapIdentifyType_[pProcessData->iDataSource] == IDENTIFY_INIT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this->mapDetectNO_[pProcessData->iDataSource] > this->identifyConfig_.iMaxIdentifyFrame)
|
||||
{
|
||||
LogInfo << " 数据源:" << pProcessData->iDataSource << " 超过最大允许识别帧数:" << this->identifyConfig_.iMaxIdentifyFrame << " 停止识别!";
|
||||
this->endIdentify(pProcessData->iDataSource);
|
||||
LogInfo << "数据源:" << pProcessData->iDataSource << " 超过最大允许识别帧数:" << this->identifyConfig_.iMaxIdentifyFrame << " 停止识别!";
|
||||
continue;
|
||||
}
|
||||
|
||||
this->mapDetectNO_[pProcessData->iDataSource]++;
|
||||
|
||||
cv::Mat image(pProcessData->dataSourceInfo.iHeight,
|
||||
pProcessData->dataSourceInfo.iWidth,
|
||||
CV_8UC3,
|
||||
|
|
@ -252,7 +267,7 @@ APP_ERROR ControlEngine::Process()
|
|||
pSaveImgData->bIsEnd = pProcessData->bIsEnd;
|
||||
outputQueMap_[strPort4_]->push(std::static_pointer_cast<void>(pSaveImgData), true);
|
||||
|
||||
this->mapDetectNO_[pProcessData->iDataSource]++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ private:
|
|||
|
||||
uint32_t iDetectNO_ = 1; //动态检测数据编号
|
||||
std::map<int, uint32_t> mapDetectNO_;
|
||||
std::map<int, int> mapIdentifyType_;
|
||||
|
||||
std::string strDetectDate_;
|
||||
std::string strDetectTime_;
|
||||
|
|
@ -45,6 +46,7 @@ private:
|
|||
void endIdentify(int iDataSource);
|
||||
void sendWSEngine(std::string msg);
|
||||
void detectControl(std::shared_ptr<std::string> pWSServerOrder);
|
||||
bool isDetecting();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -151,7 +151,7 @@ APP_ERROR VideoDecodeEngine::Process()
|
|||
}
|
||||
else
|
||||
{
|
||||
LogError << " 硬解码失败... 返回失败信息:" << iDecodeRet;
|
||||
LogError << "数据源:" << pProcessData->iDataSource << " 硬解码失败... 返回失败信息:" << iDecodeRet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -51,6 +51,8 @@ private:
|
|||
std::vector<VSelectBestData> vecContainerFail_;
|
||||
// 存储识别到的满足校验规则的箱号数据
|
||||
std::vector<VSelectBestData> vecContainer_;
|
||||
|
||||
bool bLastIsEnd = true;
|
||||
};
|
||||
|
||||
ENGINE_REGIST(ContainerDivideEngine)
|
||||
|
|
|
|||
Loading…
Reference in New Issue