def labeled_rectangle(image: np.ndarray, start_point: PointT, end_point: PointT, label: str, rect_color: ColorT, label_color: ColorT, alpha: float=0.85):
    ((x1, y1), (x2, y2)) = (start_point, end_point)
    roi = image[y1:y2, x1:x2]
    rect = (np.ones_like(roi) * 255)
    image[y1:y2, x1:x2] = cv.addWeighted(roi, alpha, rect, (1 - alpha), 0)
    font_face = cv.FONT_HERSHEY_COMPLEX_SMALL
    font_scale = 1
    font_thickness = 3
    ((text_width, text_height), baseline) = cv.getTextSize(label, font_face, font_scale, font_thickness)
    text_rect_end = ((start_point[0] + text_width), ((start_point[1] + text_height) + baseline))
    cv.rectangle(image, start_point, text_rect_end, rect_color, (- 1))
    text_start_point = ((start_point[0] + 1), ((start_point[1] + text_height) + 3))
    cv.putText(image, label, text_start_point, font_face, font_scale, label_color, font_thickness, cv.LINE_AA)
    cv.putText(image, label, text_start_point, font_face, font_scale, (255, 255, 255), max(1, (font_thickness - 2)), cv.LINE_AA)
    cv.rectangle(image, start_point, end_point, rect_color, 2, cv.LINE_AA)
def labeled_rectangle(image: np.ndarray, start_point: PointT, end_point: PointT, label: str, rect_color: ColorT, label_color: ColorT, alpha: float=0.85):
    ((x1, y1), (x2, y2)) = (start_point, end_point)
    roi = image[y1:y2, x1:x2]
    rect = (np.ones_like(roi) * 255)
    image[y1:y2, x1:x2] = cv.addWeighted(roi, alpha, rect, (1 - alpha), 0)
    font_face = cv.FONT_HERSHEY_COMPLEX_SMALL
    font_scale = 1
    font_thickness = 3
    ((text_width, text_height), baseline) = cv.getTextSize(label, font_face, font_scale, font_thickness)
    text_rect_end = ((start_point[0] + text_width), ((start_point[1] + text_height) + baseline))
    cv.rectangle(image, start_point, text_rect_end, rect_color, (- 1))
    text_start_point = ((start_point[0] + 1), ((start_point[1] + text_height) + 3))
    cv.putText(image, label, text_start_point, font_face, font_scale, label_color, font_thickness, cv.LINE_AA)
    cv.putText(image, label, text_start_point, font_face, font_scale, (255, 255, 255), max(1, (font_thickness - 2)), cv.LINE_AA)
    cv.rectangle(image, start_point, end_point, rect_color, 2, cv.LINE_AA)