def check_isdown(cfg, trajectory)
isdown = False
rect = trajectory["rect"][0]
h1max = 0
h2max = 0
value = 2
s1 = 0
s2 = 0
for i in range(1, len(trajectory["rects"])):
rect = trajectory["rects"][i]
if rect[3] < 0.5 and rect[3] > h1max:
s1 = (rect[3]-rect[1])*(rect[2]-rect[0])
h1max = rect[3]
if rect[3] > 0.5 and rect[3] > h2max:
s21 = (rect[3]-rect[1])*(rect[2]-rect[0])
h2max = rect[3]
if s1 != 0:
value = s2/s1
if value < 1.2 and value != 0:
isdown = True
return isdown
python检查行人轨迹是否为下蹲动作的简化函数
最新推荐文章于 2023-11-01 19:51:23 发布