# indices =\ # cv2.dnn.NMSBoxes(boxes, confidences, conf_threshold, nms_threshold) # Draw the transition zone zone_start, zone_end = zone.get_limits() cv2.rectangle(frame, zone_start, zone_end, (0, 0, 255), -1) for i, p in enumerate(people_list): location = p.get_last_position() left, top, right, bottom = location cx, cy = (left + right) // 2, (top + bottom) // 2 cv2.putText(frame, '{}'.format(p.get_id()), (cx, cy), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1) events = zone.analyse_trajectory_in_zone(p.get_center_trajectory()) if not p.get_check(): if ("OuP" in events) or ("CrP" in events): print("{} crossed the line".format(p.get_id())) CROSSING_COUNTER += 1 people_list[i].set_check() # Draw a black rectangle for people the crossed the line cv2.rectangle(frame, (left, top), (right, bottom), normal_color, 1) else: # Draw a yellow rectangle for people the crossed the line cv2.rectangle(frame, (left, top), (right, bottom), detected_color, 1) # Show the number of people that crossed the line from top-down direction