from PIL import ImageDraw def draw_bounding_boxes(image, boxes, model, conf_threshold): """ Draw bounding boxes on the image. Args: image (PIL.Image): The input image. boxes (list): List of bounding boxes with confidence scores. model: The object detection model (not used in this basic implementation). conf_threshold (float): Confidence threshold for filtering boxes. Returns: PIL.Image: The image with bounding boxes drawn. """ draw = ImageDraw.Draw(image) for box in boxes: if box["score"] >= conf_threshold: x_min, y_min, x_max, y_max = box["box"] draw.rectangle([x_min, y_min, x_max, y_max], outline="red", width=3) draw.text((x_min, y_min), f"{box['label']} {box['score']:.2f}", fill="red") return image