import cv2

# Load the image and bounding box coordinates
image = cv2.imread("image.jpg")
boxes = [(100, 100, 300, 300), (400, 200, 500, 400), (600, 300, 700, 500)]

# Loop over the bounding boxes
object_points = []
all_points = []
for box in boxes:
    # Get the center point and bottom y point of the box
    x1, y1, x2, y2 = box
    center_x, center_y = (x1 + x2) // 2, (y1 + y2) // 2
    bottom_point = (center_x, y2)

    # Append the center point to the list of points for this object
    object_points.append(center_point)
    
    # Append the center point and bottom point to the list of all points
    all_points.extend([center_point, bottom_point])
    
    # Draw a line from the center point to the bottom point
    cv2.line(image, center_point, bottom_point, (0, 255, 0), 2)
    
    # Draw a circle at the center point
    cv2.circle(image, center_point, 5, (0, 0, 255), -1)

# Draw a line along the sequence of points for each object
for i in range(len(object_points) - 1):
    start_point = object_points[i]
    end_point = object_points[i+1]
    start_index = all_points.index(start_point)
    end_index = all_points.index(end_point)
    points = all_points[start_index:end_index+1]
    for j in range(len(points) - 1):
        cv2.line(image, points[j], points[j+1], (255, 0, 0), 2)

# Display the result
cv2.imshow("Object Tracking Result", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
