大华智能事件需布设

This commit is contained in:
曹前明 2022-09-12 20:23:34 +08:00
parent 19620d2bd5
commit a815e7524f
1 changed files with 9 additions and 11 deletions

View File

@ -331,7 +331,7 @@ def dispatch_dahua_event(data: dict):
event = None
global_img_o = dhClient.get_full_pic(data['info']['alarmPicture'])
happen_time = timestamp_to_time(int(data['info']['alarmDate']))
if ec: # 先查看是否有定义该事件种类
if ec and AlgoChannel.objects.filter(vchannel=vchannel, algo=ec).exists(): # 先查看是否有定义该事件种类并布设
event = Event()
event.global_img = save_dahua_pic(global_img_o)
event.area = vchannel.area
@ -356,11 +356,10 @@ def dispatch_dahua_event(data: dict):
if 'helmet' in ec_codes:
# 如果存在安全帽事件
# 尝试以图搜图找到当事人
res = dhClient.face_search(path=global_img_o)
if res and res[0]:
ep = Employee.objects.filter(id_number=res[0]['identity']).first()
if ep:
obj_cate = 'people'
# res = dhClient.face_search(path=global_img_o)
# if res and res[0]:
# ep = Employee.objects.filter(id_number=res[0]['identity']).first()
obj_cate = 'people'
if event is None: # 如果未创建事件
event = Event()
event.global_img = save_dahua_pic(global_img_o)
@ -665,11 +664,10 @@ def snap_and_analyse(vchannel: TDevice, algo_codes: list, opl: Opl):
if 'helmet' in ec_codes:
# 如果存在安全帽事件
# 尝试以图搜图找到当事人
res = dhClient.face_search(path=global_img_o)
if res and res[0]:
ep = Employee.objects.filter(id_number=res[0]['identity']).first()
if ep:
obj_cate = 'people'
# res = dhClient.face_search(path=global_img_o)
# if res and res[0]:
# ep = Employee.objects.filter(id_number=res[0]['identity']).first()
pass
event = Event()
event.global_img = save_dahua_pic(global_img_o)
event.vchannel = vchannel