#entrance,entrance_one,entrance_two,entrance_three =xmin,ymin,xmax,ymaxentrance_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, ymaxentrance_xx=entrance_one[0]entrance_xxx = entrance_one[0]entrance_xxxx = entrance_one[0]#目标检测中实现追踪#score识别个体的分数#track_id为个体设置的id#tlwh为个体的坐标,为xmin,ymin,xmax,ymaxfor tlwh, score, track_id in zip(tlwhs, tscores, track_ids):if track_id < 0: continueif data_type == 'kitti':frame_id -= 1x1, y1, w, h = tlwhcenter_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 lineif 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_xprev_center[track_id][1] = center_yelse:prev_center[track_id] = [center_x, center_y]```python
在这里插入代码片
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!