68 lines
1.9 KiB
C++
68 lines
1.9 KiB
C++
#include "SaveMoveInfoEngine.h"
|
|
|
|
|
|
using namespace ai_matrix;
|
|
|
|
SaveMoveInfoEngine::SaveMoveInfoEngine() {}
|
|
|
|
SaveMoveInfoEngine::~SaveMoveInfoEngine() {}
|
|
|
|
APP_ERROR SaveMoveInfoEngine::Init()
|
|
{
|
|
strPort0_ = engineName_ + "_" + std::to_string(engineId_) + "_0";
|
|
|
|
this->baseConfig_ = Config::getins()->getBaseConfig();
|
|
|
|
LogInfo << "SaveMoveInfoEngine Init ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
APP_ERROR SaveMoveInfoEngine::DeInit()
|
|
{
|
|
LogInfo << "SaveMoveInfoEngine DeInit ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
APP_ERROR SaveMoveInfoEngine::Process()
|
|
{
|
|
|
|
|
|
int iRet = APP_ERR_OK;
|
|
while (!isStop_)
|
|
{
|
|
std::shared_ptr<void> pvoidd = nullptr;
|
|
inputQueMap_[strPort0_]->pop(pvoidd);
|
|
if (nullptr == pvoidd)
|
|
{
|
|
usleep(1000);
|
|
continue;
|
|
}
|
|
|
|
std::shared_ptr<VDetectInfo> pVDetectInfo = std::static_pointer_cast<VDetectInfo>(pvoidd);
|
|
|
|
//图片绝对路径
|
|
if (pVDetectInfo->strFilePath.back() != '/')
|
|
{
|
|
pVDetectInfo->strFilePath += "/";
|
|
}
|
|
std::string strFilePath = pVDetectInfo->strFilePath + pVDetectInfo->strFileName;
|
|
|
|
if (!FileUtil::getins()->createDirPath(pVDetectInfo->strFilePath))
|
|
{
|
|
LogError << " 创建文件存储目录失败:" << strFilePath;
|
|
continue;
|
|
}
|
|
|
|
Json::Value jvFrameInfo;
|
|
jvFrameInfo["frameId"] = pVDetectInfo->iFrameId;
|
|
jvFrameInfo["trainDate"] = pVDetectInfo->strDetectDate;
|
|
jvFrameInfo["trainTime"] = pVDetectInfo->strDetectTime;
|
|
jvFrameInfo["timeStamp"] = TimeUtil::getins()->Stamp2Time(pVDetectInfo->i64TimeStamp, true);
|
|
jvFrameInfo["isEnd"] = pVDetectInfo->bIsEnd;
|
|
if (!FileUtil::getins()->writeJsonInfo(jvFrameInfo, strFilePath))
|
|
{
|
|
LogError << "来车检测识别结果存储失败:" << strFilePath;
|
|
}
|
|
}
|
|
return APP_ERR_OK;
|
|
} |