#entrance,entrance_one,entrance_two,entrance_three =xmin,ymin,xmax,ymax
entrance_x, entrance_y = entrance[0], entrance[1]
entrance_y_right = entrance[2] # 右临界点
entrance_yy = entrance_one[1] # 第二条线
entrance_yy_left = entrance_one[0]
entrance_yyy = entrance_two[1] # 第三条线
entrance_yyy_right = entrance_two[2] # 右临界点
entrance_yyyy = entrance_three[1] # 第四条线
entrance_yyyy_left = entrance_three[0]
#---------------------------------------------上水平,下垂直
#xmin, ymin, xmax, ymax
entrance_xx=entrance_one[0]
entrance_xxx = entrance_one[0]
entrance_xxxx = entrance_one[0]
#目标检测中实现追踪
#score识别个体的分数
#track_id为个体设置的id
#tlwh为个体的坐标,为xmin,ymin,xmax,ymax
for tlwh, score, track_id in zip(tlwhs, tscores, track_ids):
if track_id < 0: continue
if data_type == 'kitti':
frame_id -= 1
x1, y1, w, h = tlwh
center_x = x1 + w / 2.
center_y = y1 + h / 2.
if track_id in prev_center:
if region_type == 'horizontal':
#第一幅画面-进
if prev_center[track_id][1] <= entrance_y and \
center_y > entrance_y and prev_center[track_id][0] <= entrance_y_right:
in_id_list.append(track_id)
in_id_list_one.append(track_id)
# 第二幅画面-进
if prev_center[track_id][1] <= entrance_yy and \
center_y > entrance_yy and prev_center[track_id][0] >= entrance_yy_left:
in_id_list.append(track_id)
in_id_list_two.append(track_id)
# ----------------------------------------------------------------------------------------------
if prev_center[track_id][1] >= entrance_y and \
center_y < entrance_y and prev_center[track_id][0] <= entrance_y_right:
out_id_list.append(track_id)
out_id_list_one.append(track_id)
if prev_center[track_id][1] >= entrance_yy and \
center_y < entrance_yy and prev_center[track_id][0] >= entrance_yy_left:
out_id_list.append(track_id)
out_id_list_two.append(track_id)
else:
# vertical center line
if prev_center[track_id][0] <= entrance_x and center_x > entrance_x:
in_id_list.append(track_id)
in_id_list_one.append(track_id)
if prev_center[track_id][0] <= entrance_xx and center_x > entrance_xx:
in_id_list.append(track_id)
in_id_list_two.append(track_id)
if prev_center[track_id][0] >= entrance_x and center_x < entrance_x:
out_id_list.append(track_id)
out_id_list_one.append(track_id)
if prev_center[track_id][0] >= entrance_xx and center_x < entrance_xx:
out_id_list.append(track_id)
out_id_list_two.append(track_id)
prev_center[track_id][0] = center_x
prev_center[track_id][1] = center_y
else:
prev_center[track_id] = [center_x, center_y]
```python
在这里插入代码片