123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #ifndef FUNCREGIONALPERSON_H
- #define FUNCREGIONALPERSON_H
- #include "FuncBase.h"
- #include <string>
- enum class Enum_PeriodType
- {
- PERIOD_ALL = 0, /* 所有时段 */
- PERIOD_DAY, /* 按天 */
- PERIOD_WEEK, /* 按周 */
- };
- /**
- * @brief 报警规则
- *
- */
- struct PersonCountRuleInfo
- {
- int ChannelID; /* 通道ID */
- std::string PeriodName; /* 时间段名称 */
- QDateTime StartTime; /* 开始时间 */
- QDateTime EndTime; /* 结束时间 */
- int week; /* 星期 */
- Enum_PeriodType RuleType; /* 规则类型,0表示所有时段,1表示按天,2表示按周 */
- bool LiveMinEnable; /* 启用直播间最小人数 */
- bool LiveMaxEnable; /* 启用直播间最大人数 */
- bool DicMinEnable; /* 启用导播间最小人数 */
- bool DicMaxEnable; /* 启用导播间最大人数 */
- bool LiveDicMinEnable; /* 启用直播间和导播间最小人数 */
- bool LiveDicMaxEnable; /* 启用直播间和导播间最大人数 */
- int LiveMin; /* 直播间最小人数 */
- int LiveMax; /* 直播间最大人数 */
- int DicMin; /* 导播间最小人数 */
- int DicMax; /* 导播间最大人数 */
- int LiveDicMin; /* 直播间和导播间最小人数 */
- int LiveDicMax; /* 直播间和导播间最大人数 */
- std::string RuleName; /* 规则名称 */
- PersonCountRuleInfo();
- PersonCountRuleInfo& operator=(PersonCountRuleInfo& other);
- };
- /**
- * @brief 报警参数
- *
- */
- struct EndAlarmParam
- {
- int ChannelID; /* 通道ID */
- AppFunction AppID; /* 应用功能 */
- int CameraID; /* 摄像机ID */
- uint64_t insertAlarmNum; /* 报警编号?PKID? */
- EndAlarmParam();
- EndAlarmParam(const EndAlarmParam& other);
- EndAlarmParam& operator=(const EndAlarmParam& other);
- bool operator==(const EndAlarmParam& other);
- };
- /**
- * @brief 区域人员检测,检测这个区域内的人数,不能少于多少人,不能多余多少人
- * 1、报警判断条件:直播间报警:当前频率所有直播间摄像头的区域人员检测算法输出结果均大于或小于设定人
- 数值时,记为报警行为,直接展示报警结果
- 2、录播间报警:当前频率所有录播间摄像头的区域人员检测算法输出结果均大于或小于设定人数值时,记为报
- 警行为,直接展示报警结果
- 3、直播间+录播间报警:当前频率直播间人数+录播间人数大于或小于设定人数值时,记为报警行为,直接展示
- 报警结果
- *
- */
- class FuncRegionalPersonCount : public FuncBase
- {
- public:
- FuncRegionalPersonCount();
- ~FuncRegionalPersonCount();
- protected:
- void task() override;
- private:
- /* 获取该频率的人员计数规则 */
- bool getPersonCountRuleInfo(PersonCountRuleInfo& personCountRuleInfo);
- /* 判断是否在检测时间段内 */
- bool isInPeriodTime();
- /* 更新房间列表 */
- void updateRoomList();
- /* 自动结束报警 */
- void autoEndAlarm();
- /* 查找是否已经结束了报警 */
- bool findAlarmEnd(EndAlarmParam& alarmParam);
- /* 取出一个房间内的最大人数 */
- void getRoomMaxNum(int roomID, int& maxNum, std::string& strImagePath);
- private:
- ListAlarmInfo* m_pListAlarm = nullptr; /* 报警信息 */
- std::list<RoomCamActInfo> m_listRoomCamAct; /* 房间和算法ID关联列表,这里存储的是直播间和导播间的房间信息 */
- PersonCountRuleInfo m_personCountRule; /* 人员计数规则 */
- QDateTime m_nowTime; /* 当前时间 */
- std::list<EndAlarmParam> m_listEndAlarmPara; /* 报警列表 */
- int m_liveDicNum = 0; /* 直播间和导播间的最大人数之和 */
- std::string m_strLiveDicImagePath; /* 直播间和导播间的报警图片路径 */
- };
- #endif /* FUNCREGIONALPERSON_H */
|