import cv2 def draw_boxes(image, boxes): """ Draw bounding boxes on image :param image: Input image :param boxes: List of bounding boxes in format [(x1, y1, x2, y2), ...] :return: Image with boxes drawn """ for box in boxes: x1, y1, x2, y2 = box cv2.rectangle(image, (x1, y1), (x2, y2), (0, 255, 0), 2) return image def allowed_file(filename, allowed_extensions): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in allowed_extensions