|
|
#ifndef LPBENGINE_H
|
|
|
#define LPBENGINE_H
|
|
|
|
|
|
#include "lpbdefine.h"
|
|
|
|
|
|
enum InterfaceType
|
|
|
{
|
|
|
SOLUTIONMGR = 0,
|
|
|
DEVICEMGR,
|
|
|
SYSTEMINFO,
|
|
|
DBMGR,
|
|
|
IMAGECACHEMGR,
|
|
|
SHAREAPARAM,
|
|
|
ALGORITHMLIBMGR,
|
|
|
};
|
|
|
|
|
|
enum DeviceType
|
|
|
{
|
|
|
CAMERA = 0,
|
|
|
SENSOR,
|
|
|
LIGHT,
|
|
|
COM
|
|
|
};
|
|
|
|
|
|
enum LpAdapterType
|
|
|
{
|
|
|
ADAPTER_NULL = 0,
|
|
|
ADAPTER_CAMERA,
|
|
|
ADAPTER_SERIALPORT,
|
|
|
ADAPTER_FILE,
|
|
|
};
|
|
|
|
|
|
enum ItemBEType
|
|
|
{
|
|
|
RECTANGLE = 0,
|
|
|
CIRCLE,
|
|
|
ELLIPSE,
|
|
|
POLY
|
|
|
};
|
|
|
|
|
|
enum ItemPos
|
|
|
{
|
|
|
EXTERIOR = 0,
|
|
|
INTERIOR,
|
|
|
};
|
|
|
|
|
|
//<! 动态
|
|
|
//static std::vector<QString> g_vecAlgParamName;
|
|
|
//typedef unsigned int AlgoParamType;
|
|
|
|
|
|
//<! 静态
|
|
|
#define LP_MAX_ALGO_PARAM_NUM 16
|
|
|
static QString AlgoParamName[LP_MAX_ALGO_PARAM_NUM] = {
|
|
|
"INT", "BOOLEAN", "STRING", "DOUBLE", "IMAGE", "POINT", "POINTF", "RECT", "RECTF", "ROI", "MAT", "LIST_INT", "LIST_BOOLEAN", "LIST_STRING", "LIST_DOUBLE", "USER"
|
|
|
};
|
|
|
enum AlgoParamType
|
|
|
{
|
|
|
LP_INT = 0,
|
|
|
LP_BOOLEAN,
|
|
|
LP_STRING,
|
|
|
LP_DOUBLE,
|
|
|
LP_IMAGE,
|
|
|
LP_POINT,
|
|
|
LP_POINTF,
|
|
|
LP_RECT,
|
|
|
LP_RECTF,
|
|
|
LP_ROI,
|
|
|
LP_MAT,
|
|
|
LP_LIST_INT,
|
|
|
LP_LIST_BOOLEAN,
|
|
|
LP_LIST_STRING,
|
|
|
LP_LIST_DOUBLE,
|
|
|
LP_USER,
|
|
|
LP_LINE,
|
|
|
LP_LINEF,
|
|
|
LP_CIRCLE,
|
|
|
LP_CIRCLEF,
|
|
|
LP_POLYGON,
|
|
|
LP_POLYGONF,
|
|
|
LP_TRANSFORM,
|
|
|
LP_WORD,
|
|
|
LP_VARIANT,
|
|
|
LP_MAP_VARIANT,
|
|
|
LP_LIST_POLYGON,
|
|
|
LP_LIST_POLYGONF,
|
|
|
LP_LIST_CIRCLE,
|
|
|
LP_LIST_CIRCLEF,
|
|
|
LP_LIST_POINT,
|
|
|
LP_LIST_POINTF,
|
|
|
LP_LIST_LINE,
|
|
|
LP_LIST_LINEF,
|
|
|
};
|
|
|
|
|
|
enum SolutionStateFlag {
|
|
|
SolutionIsRun = 0x1,
|
|
|
SolutionIsModify = 0x2,
|
|
|
SolutionIsReset = 0x4,
|
|
|
};
|
|
|
|
|
|
enum SolutionType {
|
|
|
LP_CUSTOM = 0,
|
|
|
LP_COMMON,
|
|
|
LP_EXTRA,
|
|
|
};
|
|
|
|
|
|
enum ParamDir {
|
|
|
LP_PARAM_INPUT = 0,
|
|
|
LP_PARAM_OUTPUT,
|
|
|
};
|
|
|
|
|
|
namespace ImageMgr
|
|
|
{
|
|
|
enum WorkType
|
|
|
{
|
|
|
SAVE = 0,
|
|
|
REMOVE
|
|
|
};
|
|
|
}
|
|
|
|
|
|
typedef struct tagDetectorSystemInfo
|
|
|
{
|
|
|
bool mIsShowImage;
|
|
|
}LP_DETECTOR_SYSTEM_INFO, *PLP_DETECTOR_SYSTEM_INFO;
|
|
|
|
|
|
typedef struct tagDetectorDevice
|
|
|
{
|
|
|
int nID;
|
|
|
QString strName;
|
|
|
}LP_DETECTOR_DEVICE, *PLP_DETECTOR_DEVICE;
|
|
|
|
|
|
|
|
|
typedef struct tagDetectorSensorParam
|
|
|
{
|
|
|
int m_nCamDis; //相机触发->拍照 延迟时间或者距离
|
|
|
int m_nKickDis; //剔除触发->拍照 延时时间或者距离
|
|
|
int m_nKickTime; //剔除持续时间
|
|
|
int m_nResultMode; // 0-根据结果 1-一直吹 2 一直不吹
|
|
|
bool m_lightOn; //灯亮暗标志
|
|
|
}LP_DETECTOR_DEVICE_SENSOR_PARAM, *PLP_DETECTOR_DEVICE_SENSOR_PARAM;
|
|
|
|
|
|
|
|
|
typedef struct tagDetectorDeviceParam
|
|
|
{
|
|
|
int m_nCamDis; //相机触发->拍照 延迟时间或者距离
|
|
|
int m_nKickDis; //剔除触发->拍照 延时时间或者距离
|
|
|
int m_nKickTime; //剔除持续时间
|
|
|
int m_nResultMode; // 0-根据结果 1-一直吹 2 一直不吹
|
|
|
bool m_lightOn; //灯亮暗标志
|
|
|
}LP_DETECTOR_DEVICE_PARAM, *PLP_DETECTOR_DEVICE_PARAM;
|
|
|
|
|
|
typedef struct tagAlgorithmParamDesc
|
|
|
{
|
|
|
QString strName;
|
|
|
AlgoParamType type;
|
|
|
ParamDir dir;
|
|
|
QVariant InitVal;
|
|
|
}LP_ALGORITHM_PARAM_DESC, *PLP_ALGORITHM_PARAM_DESC;
|
|
|
|
|
|
typedef struct tagAlgorithmParam
|
|
|
{
|
|
|
int nID;
|
|
|
int nTaskID;
|
|
|
int nSrcAlgoID;
|
|
|
int nSrcParamID;
|
|
|
QString strName;
|
|
|
AlgoParamType type;
|
|
|
QVariant value;
|
|
|
QString strDescription;
|
|
|
bool bIsSave;
|
|
|
bool bIsLock;
|
|
|
QVariantMap vProperty;
|
|
|
|
|
|
tagAlgorithmParam(QString strName = "",
|
|
|
AlgoParamType type = LP_INT,
|
|
|
QVariant value = NULL,
|
|
|
QString strDescription = "",
|
|
|
int nTaskID = LP_DETECTOR_INVALID_ID,
|
|
|
int nSrcAlgoID = LP_DETECTOR_INVALID_ID,
|
|
|
int nSrcParamID = LP_DETECTOR_INVALID_ID,
|
|
|
bool bIsSave = false,
|
|
|
bool bIsLock = false,
|
|
|
QVariantMap vProperty = QVariantMap()
|
|
|
)
|
|
|
{
|
|
|
this->strName = strName;
|
|
|
this->type = type;
|
|
|
this->value = value;
|
|
|
this->strDescription = strDescription;
|
|
|
this->nTaskID = nTaskID;
|
|
|
this->nSrcAlgoID = nSrcAlgoID;
|
|
|
this->nSrcParamID = nSrcParamID;
|
|
|
this->bIsSave = bIsSave;
|
|
|
this->bIsLock = bIsLock;
|
|
|
this->vProperty = vProperty;
|
|
|
};
|
|
|
|
|
|
void operator=(const tagAlgorithmParam& other)
|
|
|
{
|
|
|
nID = other.nID;
|
|
|
nTaskID = other.nTaskID;
|
|
|
nSrcAlgoID = other.nSrcAlgoID;
|
|
|
nSrcParamID = other.nSrcParamID;
|
|
|
strName = other.strName;
|
|
|
type = other.type;
|
|
|
value = other.value;
|
|
|
strDescription = other.strDescription;
|
|
|
bIsSave = other.bIsSave;
|
|
|
bIsLock = other.bIsLock;
|
|
|
vProperty = other.vProperty;
|
|
|
}
|
|
|
}LP_ALGORITHM_PARAM, *PLP_ALGORITHM_PARAM;
|
|
|
|
|
|
typedef QPair < int, QList<float> > Feature_List;
|
|
|
typedef QList<Feature_List> Item_List;
|
|
|
typedef QList<Item_List> Record_List;
|
|
|
|
|
|
typedef struct tagROIRecordItem
|
|
|
{
|
|
|
int nID;
|
|
|
ItemPos posType;
|
|
|
Feature_List featureData;
|
|
|
}LP_DETECTOR_ROI_RECORD_ITEM, *PLP_DETECTOR_ROI_RECORD_ITEM;
|
|
|
|
|
|
typedef struct tagROIRecord
|
|
|
{
|
|
|
int nID;
|
|
|
QString strName;
|
|
|
}LP_DETECTOR_ROI_RECORD, *PLP_DETECTOR_ROI_RECORD;
|
|
|
|
|
|
typedef struct tagROIData
|
|
|
{
|
|
|
Record_List records;
|
|
|
cv::Mat img;
|
|
|
}LP_DETECTOR_ROI_DATA, *PLP_DETECTOR_ROI_DATA;
|
|
|
|
|
|
typedef struct tagImageData
|
|
|
{
|
|
|
int nType;
|
|
|
QString strName;
|
|
|
cv::Mat img;
|
|
|
}LP_DETECTOR_IMAGE_CACHE_DATA, *PLP_DETECTOR_IMAGE_CACHE_DATA;
|
|
|
|
|
|
typedef struct tagTaskOutParam
|
|
|
{
|
|
|
QString name;
|
|
|
AlgoParamType type;
|
|
|
QVariant value;
|
|
|
}LP_DETECTOR_TASK_OUT_PARAM, *PLP_DETECTOR_TASK_OUT_PARAM;
|
|
|
|
|
|
Q_DECLARE_METATYPE(cv::Mat)
|
|
|
Q_DECLARE_METATYPE(LP_DETECTOR_ROI_DATA)
|
|
|
Q_DECLARE_METATYPE(LP_DETECTOR_IMAGE_CACHE_DATA)
|
|
|
Q_DECLARE_METATYPE(LP_DETECTOR_TASK_OUT_PARAM)
|
|
|
|
|
|
typedef struct tagDetectorROI
|
|
|
{
|
|
|
int nID;
|
|
|
QString strName;
|
|
|
QString strDescription;
|
|
|
int rgb;
|
|
|
}LP_DETECTOR_ROI, *PLP_DETECTOR_ROI;
|
|
|
|
|
|
typedef struct tagDetectorAlgorithm
|
|
|
{
|
|
|
int nID;//算法ID
|
|
|
QString strName;//算法名称
|
|
|
QString strDescription;//描述
|
|
|
QString strPath;//算法路径 即算法模块名字
|
|
|
QString strLibName;
|
|
|
QString strFuncName;
|
|
|
int nRoiID;
|
|
|
}LP_DETECTOR_ALGORITHM, *PLP_DETECTOR_ALGORITHM;
|
|
|
|
|
|
typedef struct tagDetectorTask
|
|
|
{
|
|
|
int nID;
|
|
|
int nCameraID;
|
|
|
int nGroupParamID;
|
|
|
quint64 timeStamp;
|
|
|
QString strName;
|
|
|
QString strDescription;
|
|
|
QString strImageName;
|
|
|
QString strDirPath;
|
|
|
cv::Mat templateImg;//模板图片 标定图
|
|
|
cv::Mat detectImg;//实时检测图
|
|
|
bool bIsRun;
|
|
|
QVariant property;
|
|
|
}LP_DETECTOR_TASK, *PLP_DETECTOR_TASK;
|
|
|
|
|
|
typedef struct tagDetectorSolution
|
|
|
{
|
|
|
int nID;
|
|
|
int nType;
|
|
|
QString strName;
|
|
|
QString strDescription;
|
|
|
}LP_DETECTOR_SOLUTION, *PLP_DETECTOR_SOLUTION;
|
|
|
|
|
|
typedef void(__stdcall *NewImageHandler)(void * callBackOwner, QImage& img, int nDeviceID);
|
|
|
|
|
|
class IDetectorSystemInfo
|
|
|
{
|
|
|
public:
|
|
|
IDetectorSystemInfo(){}
|
|
|
virtual ~IDetectorSystemInfo(){}
|
|
|
|
|
|
virtual void SetValue(const QString &key, const QVariant &value) = 0;
|
|
|
virtual QVariant GetValue(const QString &key, const QVariant &defaultValue = QVariant()) = 0;
|
|
|
|
|
|
virtual void BeginGroup(const QString &prefix) = 0;
|
|
|
virtual void EndGroup() = 0;
|
|
|
|
|
|
virtual QStringList allKeys() = 0;
|
|
|
};
|
|
|
|
|
|
class IAlgorithmShare
|
|
|
{
|
|
|
public:
|
|
|
IAlgorithmShare(){}
|
|
|
virtual ~IAlgorithmShare(){}
|
|
|
virtual PLP_ALGORITHM_PARAM AddParam(const PLP_ALGORITHM_PARAM pParam, int idx = -1) = 0;
|
|
|
virtual bool DeleteParam(QString strName, int idx = -1) = 0;
|
|
|
virtual PLP_ALGORITHM_PARAM GetParam(QString strName, int idx = -1) = 0;
|
|
|
virtual QStringList GroupList() = 0;
|
|
|
virtual QStringList ParamList(int idx = -1) = 0;
|
|
|
virtual bool Save() = 0;
|
|
|
virtual bool Load() = 0;
|
|
|
|
|
|
//设置Corectrl
|
|
|
virtual bool RegisterCoreCtrl(class ICoreCtrl* pCoreCtrl = NULL) = 0;
|
|
|
//临时获取tpcorectrl存在的算法参数
|
|
|
virtual bool GetIntValue(int nAlgorithm, const QString& skey, QString& value, int nDefault) = 0;
|
|
|
virtual bool GetStringValue(int nAlgorithm, const QString& skey, QString& value, const QString& default = "") = 0;
|
|
|
};
|
|
|
|
|
|
class IImageSaveMgr
|
|
|
{
|
|
|
public:
|
|
|
IImageSaveMgr(){}
|
|
|
virtual ~IImageSaveMgr(){}
|
|
|
virtual bool StartHandle(int nThreadCount = 1, int nRemoveThreadCount = 1) = 0;
|
|
|
virtual bool StopHandle() = 0;
|
|
|
|
|
|
virtual bool Run(ImageMgr::WorkType type) = 0;
|
|
|
virtual bool Stop(ImageMgr::WorkType type) = 0;
|
|
|
|
|
|
virtual PLP_DETECTOR_IMAGE_CACHE_DATA PopImage() = 0;
|
|
|
virtual bool PushImage(PLP_DETECTOR_IMAGE_CACHE_DATA pImageData) = 0;
|
|
|
|
|
|
virtual quint64 GetRestSpace(const QString& strDriver, bool& bError) = 0;
|
|
|
|
|
|
virtual bool RemoveExpireImage() = 0;
|
|
|
virtual bool InsufficientOfSpace(const QString& strPath) = 0;
|
|
|
|
|
|
virtual void SetMinFreeSpaceSize(int nSize) = 0;
|
|
|
virtual int GetMinFreeSpaceSize() = 0;
|
|
|
virtual void SetCacheSize(int nSize) = 0;
|
|
|
virtual int GetCacheSize() = 0;
|
|
|
virtual void SetRemoveState(bool bRemove) = 0;
|
|
|
virtual bool GetRemoveState() = 0;
|
|
|
virtual void SetSrcImagePath(QString path) = 0;
|
|
|
virtual QString GetSrcImagePath() = 0;
|
|
|
virtual void SetRltImagePath(QString path) = 0;
|
|
|
virtual QString GetRltImagePath() = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
typedef bool(*callFunc)(class IDetectorTask *lpRegion, class IDetectorAlgorithm* lpAlgorithm);
|
|
|
typedef QList < LP_ALGORITHM_PARAM_DESC > ParamDescList;
|
|
|
|
|
|
class IAlgorithmLib
|
|
|
{
|
|
|
public:
|
|
|
IAlgorithmLib(){}
|
|
|
virtual ~IAlgorithmLib(){}
|
|
|
virtual bool InitAlgo(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm) = 0;
|
|
|
virtual void LoadUserParamValue(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString& strParamName, QVariant& value) = 0;
|
|
|
virtual void SaveUserParamValue(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString& strParamName) = 0;
|
|
|
|
|
|
virtual bool RegisterFunc(const QString& strName, callFunc func) = 0;
|
|
|
virtual bool DefFuncParam(const QString& strName, LP_ALGORITHM_PARAM_DESC descParam) = 0;
|
|
|
virtual bool CallFunc(const QString& strName, IDetectorTask *lpRegion, IDetectorAlgorithm* lpAlgorithm) = 0;
|
|
|
virtual QStringList ListFunc() = 0;
|
|
|
virtual QList < LP_ALGORITHM_PARAM_DESC > ListParamDesc(const QString& strFuncName) = 0;
|
|
|
|
|
|
virtual bool HandleEvent(IDetectorTask *lpTask, IDetectorAlgorithm* lpAlgorithm, QString strParaName = "", int event = -1) = 0;
|
|
|
};
|
|
|
|
|
|
class IAlgorithmLibMgr
|
|
|
{
|
|
|
public:
|
|
|
IAlgorithmLibMgr(){}
|
|
|
virtual ~IAlgorithmLibMgr(){}
|
|
|
|
|
|
virtual bool AddAlgorithmLib(const QString& strName, const QString& strPath) = 0;
|
|
|
virtual void DeleteAlgorithmLib(const QString& strName) = 0;
|
|
|
virtual IAlgorithmLib* GetAlgorithmLib(const QString& strName) = 0;
|
|
|
virtual QStringList ListAlgoLib() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorDevice
|
|
|
{
|
|
|
public:
|
|
|
IDetectorDevice(){}
|
|
|
virtual ~IDetectorDevice(){}
|
|
|
virtual bool SetID(int nID) = 0;
|
|
|
virtual int GetID() = 0;
|
|
|
virtual bool SetType(DeviceType type) = 0;
|
|
|
virtual DeviceType GetType() = 0;
|
|
|
virtual bool SetName(QString strName) = 0;
|
|
|
virtual QString GetName() = 0;
|
|
|
virtual bool SetDescription(QString strDescription) = 0;
|
|
|
virtual QString GetDescription() = 0;
|
|
|
virtual void Release() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorCameraDevice : public IDetectorDevice
|
|
|
{
|
|
|
public:
|
|
|
IDetectorCameraDevice(){}
|
|
|
virtual ~IDetectorCameraDevice(){}
|
|
|
virtual void AddParam(const QString &key, const QVariant &value) = 0;
|
|
|
virtual bool DeleteParam(const QString &key) = 0;
|
|
|
virtual QMap<QString, QVariant> GetParamMap() = 0;
|
|
|
|
|
|
virtual void SnapImage(void* callBackOwner, NewImageHandler pFunc) = 0;
|
|
|
virtual bool HandleNewImage(cv::Mat& img, int nDeviceID) = 0;
|
|
|
|
|
|
virtual bool OpenDevice() = 0;
|
|
|
virtual bool CloseDevice() = 0;
|
|
|
virtual bool StartDevice() = 0;
|
|
|
virtual bool StopDevice() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorDeviceMgr
|
|
|
{
|
|
|
public:
|
|
|
IDetectorDeviceMgr(){}
|
|
|
virtual ~IDetectorDeviceMgr(){}
|
|
|
virtual IDetectorDevice* AddDevice(DeviceType type) = 0;
|
|
|
virtual bool DeleteDevice(int nDeviceID) = 0;
|
|
|
virtual IDetectorDevice* GetDevice(int nDeviceID, DeviceType &type) = 0;
|
|
|
virtual IDetectorDevice* GetDeviceByName(QString strName, DeviceType &type) = 0;
|
|
|
virtual int EnumDevice(IDetectorDevice** lppDevice, int nCount) = 0;
|
|
|
virtual bool Save() = 0;
|
|
|
virtual bool Load() = 0;
|
|
|
|
|
|
//设置Corectrl
|
|
|
virtual bool RegisterCoreCtrl(class ICoreCtrl* pCoreCtrl = NULL) = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorRecord
|
|
|
{
|
|
|
public:
|
|
|
IDetectorRecord(){}
|
|
|
virtual ~IDetectorRecord(){}
|
|
|
|
|
|
virtual PLP_DETECTOR_ROI_RECORD_ITEM AddItem(const PLP_DETECTOR_ROI_RECORD_ITEM pItem, bool bRet = true) = 0;
|
|
|
virtual bool DeleteItem(int nItemID) = 0;
|
|
|
virtual PLP_DETECTOR_ROI_RECORD_ITEM GetItem(int nItemID) = 0;
|
|
|
virtual int EnumItem(LP_DETECTOR_ROI_RECORD_ITEM** lppItem, int nCount) = 0;
|
|
|
|
|
|
virtual bool SetRecordInfo(const PLP_DETECTOR_ROI_RECORD pRecord) = 0;
|
|
|
virtual PLP_DETECTOR_ROI_RECORD GetRecordInfo() = 0;
|
|
|
virtual int GetID() const = 0;
|
|
|
virtual void Release() = 0;
|
|
|
|
|
|
virtual PLP_DETECTOR_ROI_RECORD_ITEM GetExteriorItem() = 0;
|
|
|
virtual PLP_DETECTOR_ROI_RECORD_ITEM GetInteriorItem() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorROI
|
|
|
{
|
|
|
public:
|
|
|
IDetectorROI(){}
|
|
|
virtual ~IDetectorROI(){}
|
|
|
virtual IDetectorRecord* AddRecord(const PLP_DETECTOR_ROI_RECORD pRecord, bool bRet = true) = 0;
|
|
|
virtual bool DeleteRecord(int nRecordID) = 0;
|
|
|
virtual IDetectorRecord* GetRecord(int nRecordID) = 0;
|
|
|
virtual int EnumRecord(IDetectorRecord** lppRecord, int nCount) = 0;
|
|
|
virtual bool SetROIInfo(const PLP_DETECTOR_ROI pROI) = 0;
|
|
|
virtual PLP_DETECTOR_ROI GetROIInfo() = 0;
|
|
|
virtual int GetID() const = 0;
|
|
|
virtual void CleanUp() = 0;
|
|
|
virtual void Release() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorAlgorithm
|
|
|
{
|
|
|
public:
|
|
|
IDetectorAlgorithm(){}
|
|
|
virtual ~IDetectorAlgorithm(){}
|
|
|
|
|
|
virtual bool SetAlgorithmInfo(const PLP_DETECTOR_ALGORITHM pAlgorithmInfo) = 0;
|
|
|
virtual PLP_DETECTOR_ALGORITHM GetAlgorithmInfo() = 0;
|
|
|
|
|
|
virtual PLP_ALGORITHM_PARAM AddParam(const PLP_ALGORITHM_PARAM pParam, bool bRet = true) = 0;
|
|
|
virtual bool DeleteParam(int nParamID) = 0;
|
|
|
virtual PLP_ALGORITHM_PARAM GetParam(int nParamID) = 0;
|
|
|
virtual PLP_ALGORITHM_PARAM GetParamByName(QString strName) = 0;
|
|
|
virtual int EnumParam(LP_ALGORITHM_PARAM** lppParam, int nCount) = 0;
|
|
|
|
|
|
virtual PLP_ALGORITHM_PARAM AddOutParam(const PLP_ALGORITHM_PARAM pOutParam, bool bRet = true) = 0;
|
|
|
virtual bool DeleteOutParam(int nOutParamID) = 0;
|
|
|
virtual PLP_ALGORITHM_PARAM GetOutParam(int nOutParamID) = 0;
|
|
|
virtual PLP_ALGORITHM_PARAM GetOutParamByName(QString strName) = 0;
|
|
|
virtual int EnumOutParam(LP_ALGORITHM_PARAM** lppOutParam, int nCount) = 0;
|
|
|
|
|
|
virtual int GetID() const = 0;
|
|
|
virtual int GetParamBaseID() const = 0;
|
|
|
virtual int GetOutParamBaseID() const = 0;
|
|
|
virtual void Release() = 0;
|
|
|
|
|
|
virtual bool Load(QString dllPath) = 0;
|
|
|
virtual bool InitAlgo() = 0;
|
|
|
virtual bool Exec() = 0;
|
|
|
virtual QVariant GetParamValue(QString strKey, AlgoParamType type) = 0;
|
|
|
virtual QVariant GetOutParamValue(QString strKey, AlgoParamType type) = 0;
|
|
|
virtual bool SetOutParamValue(QString strKey, QVariant value) = 0;
|
|
|
|
|
|
virtual bool ImportParam(QJsonArray paramArray) = 0;
|
|
|
virtual QByteArray ExportParam() = 0;
|
|
|
virtual bool ImportOutParam(QJsonArray outParamArray) = 0;
|
|
|
virtual QByteArray ExportOutParam() = 0;
|
|
|
|
|
|
virtual bool SwapParamOrder(int nID1, int nID2) = 0;
|
|
|
virtual bool InsertParamOrder(int nID, int nIndex) = 0;
|
|
|
|
|
|
virtual bool UpdateParamValue(int nParamID, QVariant& value) = 0;
|
|
|
virtual bool UpdateParamValueByName(QString strName, QVariant& value) = 0;
|
|
|
|
|
|
virtual PLP_ALGORITHM_PARAM GetShareParam(QString strName, int idx = -1) = 0;
|
|
|
virtual IAlgorithmShare* GetAlgorithmShare() = 0;
|
|
|
|
|
|
virtual QList<int> UpdateRelyOnAlgo() = 0; //更新算法输出参数value到其关联的所有其他算法输入参数中
|
|
|
virtual QList<int> GetRelyOnAlgo() = 0; //获取依赖其的算法列表
|
|
|
|
|
|
virtual QPolygonF GetRoiInfo() = 0;
|
|
|
virtual void SetEnabled(bool bEnable) = 0;
|
|
|
virtual bool IsEnabled() const = 0;
|
|
|
|
|
|
virtual bool Copy(IDetectorAlgorithm* pSrcAlgo, bool bRet = true) = 0;
|
|
|
virtual bool ExecOnce() = 0;
|
|
|
virtual bool HandleEvent(QString strParamName = "", int event = -1) = 0;
|
|
|
virtual double ExecTime() const = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorSolution;
|
|
|
|
|
|
class IDetectorTask
|
|
|
{
|
|
|
public:
|
|
|
IDetectorTask(){}
|
|
|
virtual ~IDetectorTask(){}
|
|
|
virtual IDetectorROI* AddROI(const PLP_DETECTOR_ROI pROI, bool bRet = true) = 0;
|
|
|
virtual bool DeleteROI(int nROIID) = 0;
|
|
|
virtual IDetectorROI* GetROI(int nROIID) = 0;
|
|
|
virtual int EnumROI(IDetectorROI** lppROI, int nCount) = 0;
|
|
|
|
|
|
virtual IDetectorAlgorithm* AddAlgorithm(const PLP_DETECTOR_ALGORITHM pAlgorithm, bool bRet = true) = 0;
|
|
|
virtual bool DeleteAlgorithm(int nAlgorithmID) = 0;
|
|
|
virtual IDetectorAlgorithm* GetAlgorithm(int nAlgorithmID) = 0;
|
|
|
virtual int EnumAlgorithm(IDetectorAlgorithm** lppAlgorithm, int nCount) = 0;
|
|
|
|
|
|
virtual bool SetTaskInfo(const PLP_DETECTOR_TASK pTask) = 0;
|
|
|
virtual PLP_DETECTOR_TASK GetTaskInfo() = 0;
|
|
|
virtual int GetID() const = 0;
|
|
|
virtual int GetAlgoBaseID() const = 0;
|
|
|
virtual void Release() = 0;
|
|
|
|
|
|
virtual bool SetRunAlgo(int nAlgoID) = 0;
|
|
|
virtual IDetectorAlgorithm* GetRunAlgo() = 0;
|
|
|
|
|
|
virtual IDetectorSolution* GetParentSolution() = 0;
|
|
|
virtual bool Copy(IDetectorTask* pSrcTask, bool bRet = true) = 0;
|
|
|
virtual QVariant GetSystemInfoValue(const QString &key) = 0;
|
|
|
virtual bool PushImage(PLP_DETECTOR_IMAGE_CACHE_DATA pImageData) = 0;
|
|
|
virtual bool SaveFile(const QString& strPath) = 0;
|
|
|
virtual bool LoadFile(const QString& strPath) = 0;
|
|
|
virtual bool RemoveFile() = 0;
|
|
|
virtual bool AppendOtherFile(QString strpath) = 0;
|
|
|
|
|
|
virtual bool Exec() = 0;
|
|
|
virtual bool IsRunning() const = 0;
|
|
|
virtual double ExecTime() const = 0;
|
|
|
//同步框架IVariantMapToUI的数据到task中,如map数据格式更改,需要同时更新该接口实现
|
|
|
virtual bool SyncMapResult(const QVariantMap& vMap) = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorSolution
|
|
|
{
|
|
|
public:
|
|
|
IDetectorSolution(){}
|
|
|
virtual ~IDetectorSolution(){}
|
|
|
virtual IDetectorTask* AddTask(const PLP_DETECTOR_TASK pTask, bool bRet = true) = 0;
|
|
|
virtual bool DeleteTask(int nTaskID) = 0;
|
|
|
virtual bool DeleteTask(QString strTaskName) = 0;
|
|
|
virtual IDetectorTask* GetTask(int nTaskID) = 0;
|
|
|
virtual IDetectorTask* GetTask(QString strTaskName) = 0;
|
|
|
virtual QStringList GetAllTaskNames() = 0;
|
|
|
virtual QMap<int, IDetectorTask*> GetRunningTask() = 0;
|
|
|
|
|
|
virtual bool SetSolutionInfo(const PLP_DETECTOR_SOLUTION pProduct) = 0;
|
|
|
virtual PLP_DETECTOR_SOLUTION GetSolutionInfo() = 0;
|
|
|
virtual int GetID() const = 0;
|
|
|
virtual void Release() = 0;
|
|
|
virtual IDetectorSolution* Copy() = 0;
|
|
|
virtual bool GetRunState() = 0;
|
|
|
virtual void SetRunState(bool bRun) = 0;
|
|
|
virtual bool GetModifyFlag() = 0;
|
|
|
virtual void SetModifyFlag(bool bModify) = 0;
|
|
|
virtual IDetectorTask* GetTaskByCameraID(int nCameraID) = 0;
|
|
|
virtual bool SetRunTask(int nCameraID, QString strTaskName) = 0;
|
|
|
|
|
|
virtual bool Copy(IDetectorSolution* pSrcSolution, bool bRet = true) = 0;
|
|
|
virtual IDetectorTask* AddAndCopyTask(IDetectorTask* pSrcTask) = 0;
|
|
|
virtual int GetTaskBaseID() const = 0;
|
|
|
|
|
|
virtual bool GenerateDataTable() = 0;
|
|
|
virtual bool ExportData(QString strFileName, QString strStarTime = "", QString strEndTime = "") = 0;
|
|
|
|
|
|
virtual bool InsertTaskOrder(int nID, int nIndex) = 0;
|
|
|
|
|
|
virtual bool SaveFileEx(const QString& strPath) = 0;
|
|
|
virtual bool SaveFileEx(const QString& strPath,QStringList strTaskNames) = 0;
|
|
|
virtual bool LoadFileEx(const QString& strPath) = 0;
|
|
|
virtual bool SaveFile(const QString& strPath) = 0;
|
|
|
virtual bool LoadFile(const QString& strPath) = 0;
|
|
|
|
|
|
virtual void SaveUserParamValue() = 0;
|
|
|
virtual void LoadUserParamValue() = 0;
|
|
|
virtual void ClearUserParamValue() = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorEngineSink
|
|
|
{
|
|
|
public:
|
|
|
virtual void ResetRunSolution(IDetectorSolution* pSolution) = 0;
|
|
|
virtual void SetDevice(IDetectorDevice* pDevice) = 0;
|
|
|
};
|
|
|
|
|
|
class IDetectorSolutionMgr
|
|
|
{
|
|
|
public:
|
|
|
IDetectorSolutionMgr(){}
|
|
|
virtual ~IDetectorSolutionMgr(){}
|
|
|
virtual IDetectorSolution* AddSolution(const PLP_DETECTOR_SOLUTION pSolution, bool bRet = true) = 0;
|
|
|
virtual bool DeleteSolution(int nSolutionID) = 0;
|
|
|
virtual IDetectorSolution* GetSolution(int nSolutionID) = 0;
|
|
|
virtual int EnumSolution(IDetectorSolution** lppProduct, int nCount) = 0;
|
|
|
virtual bool Save() = 0;
|
|
|
virtual bool SaveByNames(QStringList strNames) = 0;
|
|
|
virtual bool Load() = 0;
|
|
|
virtual bool ReLoad() = 0;
|
|
|
virtual bool SetRunSolution(int nSolutionID) = 0;
|
|
|
virtual IDetectorSolution* GetRunSolution() = 0;
|
|
|
|
|
|
virtual void RegistSink(IDetectorEngineSink* pSink) = 0;
|
|
|
virtual IDetectorSolution* AddAndCopySolution(IDetectorSolution* pSrcSolution) = 0;
|
|
|
};
|
|
|
|
|
|
typedef struct tagLPEngine
|
|
|
{
|
|
|
IDetectorSolutionMgr* pSolutionMgr;
|
|
|
IDetectorDeviceMgr* pDeviceMgr;
|
|
|
IDetectorSystemInfo* pSystemInfo;
|
|
|
IAlgorithmShare* pAlgoShare;
|
|
|
IAlgorithmLibMgr* pAlgoLibMgr;
|
|
|
}LP_GLOBAL_DETECTOR_ENGINE, *PLP_GLOBAL_DETECTOR_ENGINE;
|
|
|
|
|
|
extern LP_GLOBAL_DETECTOR_ENGINE gpEngine;
|
|
|
|
|
|
class IDetectorEngine
|
|
|
{
|
|
|
public:
|
|
|
IDetectorEngine(){}
|
|
|
virtual ~IDetectorEngine(){}
|
|
|
virtual bool GetDataInterface(InterfaceType type, void **lppInterface) = 0;
|
|
|
virtual bool Save() = 0;
|
|
|
virtual bool SaveTasks(QStringList strTaskNames) = 0;
|
|
|
virtual bool Load() = 0;
|
|
|
};
|
|
|
|
|
|
#ifdef LPBENGINE_LIB
|
|
|
# define LPBENGINE_EXPORT extern "C" __declspec(dllexport)
|
|
|
#else
|
|
|
# define LPBENGINE_EXPORT extern "C" __declspec(dllimport)
|
|
|
#endif
|
|
|
|
|
|
typedef void(*FnLpNewEngineInstance)(IDetectorEngine ** lppBE, IDetectorEngineSink* lpSink);
|
|
|
typedef bool(*FnLpDeleteEngineInstance)();
|
|
|
|
|
|
LPBENGINE_EXPORT void LpNewEngineInstance(IDetectorEngine** lppBE, IDetectorEngineSink* lpSink);
|
|
|
|
|
|
LPBENGINE_EXPORT bool LpDeleteEngineInstance();
|
|
|
|
|
|
#endif // LPBENGINE_H
|