generated from zhangwei/Matrixai
63 lines
1.8 KiB
C
63 lines
1.8 KiB
C
|
|
/**
|
|||
|
|
* 车号第一步过滤Engine
|
|||
|
|
* */
|
|||
|
|
|
|||
|
|
#ifndef TRAINSTEP1FILTERENGINE_H
|
|||
|
|
#define TRAINSTEP1FILTERENGINE_H
|
|||
|
|
|
|||
|
|
#include "AppCommon.h"
|
|||
|
|
#include "EngineBase.h"
|
|||
|
|
#include "EngineFactory.h"
|
|||
|
|
#include "json/json.h"
|
|||
|
|
|
|||
|
|
class TrainStep1FilterEngine : public ai_matrix::EngineBase
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
TrainStep1FilterEngine();
|
|||
|
|
~TrainStep1FilterEngine();
|
|||
|
|
|
|||
|
|
APP_ERROR Init() override;
|
|||
|
|
APP_ERROR DeInit() override;
|
|||
|
|
APP_ERROR Process() override;
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
|
|||
|
|
std::string strPort0_;
|
|||
|
|
ai_matrix::BaseConfig baseConfig_;
|
|||
|
|
ai_matrix::IdentifyConfig identifyConfig_;
|
|||
|
|
ai_matrix::DataSourceConfig dataSourceConfig_;
|
|||
|
|
|
|||
|
|
std::map<int, std::vector<CalculateInfo>> mapCalDirection_;
|
|||
|
|
|
|||
|
|
std::shared_ptr<InferenceResultData> pInferenceResultDataPre_ = nullptr;
|
|||
|
|
// 第一步无变化帧数
|
|||
|
|
int iNotChgCount_ = 0;
|
|||
|
|
// 列车状态标识
|
|||
|
|
int iTrainStatus_;
|
|||
|
|
// 保存3帧信息,用于实时判断方向
|
|||
|
|
std::queue<std::shared_ptr<InferenceResultData>> queInferenceResultData_;
|
|||
|
|
// 倒车信息记录
|
|||
|
|
std::stack<TrainBackInfo> stackBackInfo_;
|
|||
|
|
std::map<int, std::string> mapTargetStr_;
|
|||
|
|
// 参数初始化(列车结束时需调用)
|
|||
|
|
void initParam();
|
|||
|
|
// 读取json文件
|
|||
|
|
bool readJson(std::string &strFilePath, Json::Value &jvInfo, int i = 1);
|
|||
|
|
// 获取火车运动状态
|
|||
|
|
int getTrainStatus();
|
|||
|
|
// 根据当前帧数据,处理上一帧数据
|
|||
|
|
void dealProcessDataPre(std::shared_ptr<InferenceResultData> pInferenceResultData);
|
|||
|
|
// 记录倒车大框信息
|
|||
|
|
void addBackInfo();
|
|||
|
|
// 判断是否回到倒车前的位置
|
|||
|
|
bool isEndDealBackInfo();
|
|||
|
|
//计算方向新
|
|||
|
|
void calculateDirection();
|
|||
|
|
|
|||
|
|
void sendComeTrain(const std::string strTrainDate, const std::string strTrainName, const int iDirection);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
ENGINE_REGIST(TrainStep1FilterEngine)
|
|||
|
|
|
|||
|
|
#endif
|