FuncRegionalPerson.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef FUNCREGIONALPERSON_H
  2. #define FUNCREGIONALPERSON_H
  3. #include "FuncBase.h"
  4. #include <string>
  5. enum class Enum_PeriodType
  6. {
  7. PERIOD_ALL = 0, /* 所有时段 */
  8. PERIOD_DAY, /* 按天 */
  9. PERIOD_WEEK, /* 按周 */
  10. };
  11. /**
  12. * @brief 报警规则
  13. *
  14. */
  15. struct PersonCountRuleInfo
  16. {
  17. int ChannelID; /* 通道ID */
  18. std::string PeriodName; /* 时间段名称 */
  19. QDateTime StartTime; /* 开始时间 */
  20. QDateTime EndTime; /* 结束时间 */
  21. int week; /* 星期 */
  22. Enum_PeriodType RuleType; /* 规则类型,0表示所有时段,1表示按天,2表示按周 */
  23. bool LiveMinEnable; /* 启用直播间最小人数 */
  24. bool LiveMaxEnable; /* 启用直播间最大人数 */
  25. bool DicMinEnable; /* 启用导播间最小人数 */
  26. bool DicMaxEnable; /* 启用导播间最大人数 */
  27. bool LiveDicMinEnable; /* 启用直播间和导播间最小人数 */
  28. bool LiveDicMaxEnable; /* 启用直播间和导播间最大人数 */
  29. int LiveMin; /* 直播间最小人数 */
  30. int LiveMax; /* 直播间最大人数 */
  31. int DicMin; /* 导播间最小人数 */
  32. int DicMax; /* 导播间最大人数 */
  33. int LiveDicMin; /* 直播间和导播间最小人数 */
  34. int LiveDicMax; /* 直播间和导播间最大人数 */
  35. std::string RuleName; /* 规则名称 */
  36. PersonCountRuleInfo();
  37. PersonCountRuleInfo& operator=(PersonCountRuleInfo& other);
  38. };
  39. /**
  40. * @brief 报警参数
  41. *
  42. */
  43. struct EndAlarmParam
  44. {
  45. int ChannelID; /* 通道ID */
  46. AppFunction AppID; /* 应用功能 */
  47. int CameraID; /* 摄像机ID */
  48. uint64_t insertAlarmNum; /* 报警编号?PKID? */
  49. EndAlarmParam();
  50. EndAlarmParam(const EndAlarmParam& other);
  51. EndAlarmParam& operator=(const EndAlarmParam& other);
  52. bool operator==(const EndAlarmParam& other);
  53. };
  54. /**
  55. * @brief 区域人员检测,检测这个区域内的人数,不能少于多少人,不能多余多少人
  56. * 1、报警判断条件:直播间报警:当前频率所有直播间摄像头的区域人员检测算法输出结果均大于或小于设定人
  57. 数值时,记为报警行为,直接展示报警结果
  58. 2、录播间报警:当前频率所有录播间摄像头的区域人员检测算法输出结果均大于或小于设定人数值时,记为报
  59. 警行为,直接展示报警结果
  60. 3、直播间+录播间报警:当前频率直播间人数+录播间人数大于或小于设定人数值时,记为报警行为,直接展示
  61. 报警结果
  62. *
  63. */
  64. class FuncRegionalPersonCount : public FuncBase
  65. {
  66. public:
  67. FuncRegionalPersonCount();
  68. ~FuncRegionalPersonCount();
  69. protected:
  70. void task() override;
  71. private:
  72. /* 获取该频率的人员计数规则 */
  73. bool getPersonCountRuleInfo(PersonCountRuleInfo& personCountRuleInfo);
  74. /* 判断是否在检测时间段内 */
  75. bool isInPeriodTime();
  76. /* 更新房间列表 */
  77. void updateRoomList();
  78. /* 自动结束报警 */
  79. void autoEndAlarm();
  80. /* 查找是否已经结束了报警 */
  81. bool findAlarmEnd(EndAlarmParam& alarmParam);
  82. /* 取出一个房间内的最大人数 */
  83. void getRoomMaxNum(int roomID, int& maxNum, std::string& strImagePath);
  84. private:
  85. ListAlarmInfo* m_pListAlarm = nullptr; /* 报警信息 */
  86. std::list<RoomCamActInfo> m_listRoomCamAct; /* 房间和算法ID关联列表,这里存储的是直播间和导播间的房间信息 */
  87. PersonCountRuleInfo m_personCountRule; /* 人员计数规则 */
  88. QDateTime m_nowTime; /* 当前时间 */
  89. std::list<EndAlarmParam> m_listEndAlarmPara; /* 报警列表 */
  90. int m_liveDicNum = 0; /* 直播间和导播间的最大人数之和 */
  91. std::string m_strLiveDicImagePath; /* 直播间和导播间的报警图片路径 */
  92. };
  93. #endif /* FUNCREGIONALPERSON_H */