123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- #ifndef FUNCILLEGALINVASION_H
- #define FUNCILLEGALINVASION_H
- #include "FuncBase.h"
- #include "spdlog/spdlog.h"
- /**
- * @brief 区域非法入侵检测
- 1、野猫、宠物识别:报警判断条件:机房内出现摄像头的宠物识别算法输出报警结果时,记为报警行为,直接
- 展示报警结果,这里好像没有检测动物的功能,这个功能可能在通用算法中实现的
- 2、无权限人员识别:报警判断条件:当判断出区域非法入侵行为时,依据人脸识别结果,判断是否为人脸库人
- 员,非人脸库的人员时判断为非法入侵行为(背影需要报警需要结合区域人员检测算法判断)
- 3、人员计数和人脸识别数不相等时,判断为非法入侵行为
- 4、报警后没有立即写入数据库,而是等到报警结束后才写入的,不知道后续会不会修改
-
- 检测逻辑:
- 1、先检测非法的人脸信息
- 2、再检测人员计数和人脸识别数不相等
- *
- */
- /**
- * @brief 房间为单位的非法入侵信息
- *
- */
- struct RoomIllegalInvasionInfo
- {
- bool isAlarm = false; /* 是否在报警 */
- int RoomID = 0; /* 房间ID */
- int RoomType = 0; /* 房间类型 */
- int numMaxFace = 0; /* 最大人脸数 */
- int numMaxPerson = 0; /* 最大人员数 */
- int CameraID = 0; /* 摄像机ID,这个存储的是使用的哪个报警信息的ID */
- std::list<std::string> strBoxList; /* box */
- std::string strMessage; /* 报警信息字符串 */
- std::string strImage; /* 报警图片 */
- std::vector<PersonInfo> vecPersonInfo; /* 人员信息 */
- RoomIllegalInvasionInfo() = default;
- RoomIllegalInvasionInfo(const RoomIllegalInvasionInfo& o);
- RoomIllegalInvasionInfo& operator=(const RoomIllegalInvasionInfo& o);
- };
- /**
- * @brief 房间报警数据,以房间为单位
- *
- */
- struct ListRoomIll
- {
- std::list<RoomIllegalInvasionInfo> listRoomIll;
- std::list<RoomIllegalInvasionInfo>& getData() { return listRoomIll; }
- /* 添加房间 */
- void addRoom(int RoomID, int RoomType);
- /* 查找是否有相同的房间 */
- RoomIllegalInvasionInfo* findRoom(int RoomID, int RoomType);
- };
- /**
- * @brief 非法入侵检测信息结构体,作为缓存存储正在报警的信息
- *
- */
- struct IllegalInvasionInfo
- {
- bool isInsertEQM = false; /* 是否已经插入到EQM数据库的报警信息中 */
- int PKID = 0;
- int CameraID = 0;
- int RoomID = 0;
- int ChannelID = 0;
- int RoomType = 0; /* 房间类型 */
- QDateTime FirstTime; /* 最开始的报警时间 */
- std::string strActionDec; /* 算法描述 */
- std::string strImageInfo; /* 图片信息 */
- IllegalInvasionInfo() = default;
- IllegalInvasionInfo(const IllegalInvasionInfo& other);
- IllegalInvasionInfo& operator=(const IllegalInvasionInfo& other);
- };
-
- /**
- * @brief 非法入侵报警列表
- *
- */
- struct ListIllegalInvasionInfo
- {
- std::list<IllegalInvasionInfo> listIll;
- std::list<IllegalInvasionInfo>& getData() { return listIll; }
- /* 添加信息 */
- void addIllInfo(IllegalInvasionInfo& info);
- /* 查找相同的信息 */
- IllegalInvasionInfo* findIllInfo(IllegalInvasionInfo& info);
- IllegalInvasionInfo* findIllInfo(int roomID, int roomType);
- /* 删除报警信息 */
- void deleteIllInfo(IllegalInvasionInfo& info);
- void deleteIllInfo(int roomID, int roomType);
- };
-
- /* ===================================================================================
- * 功能类:FuncIllegalInvasion
- * =================================================================================== */
- class FuncIllegalInvasion : public FuncBase
- {
- public:
- FuncIllegalInvasion();
- ~FuncIllegalInvasion();
- private:
- /* 是否报警 */
- bool isAlarm(const std::vector<PersonInfo>& vecPersion);
- protected:
- /* 线程功能 */
- void task() override;
- private:
- /* 保存每个摄像机的报警信息 */
- std::shared_ptr<std::list<AlarmInfo>> m_pListAlarm = nullptr;
- /* 保存非法入侵的信息 */
- std::shared_ptr<ListIllegalInvasionInfo> m_pListIllInfo = nullptr;
- };
- #endif /* FUNCILLEGALINVASION_H */
|