def text_box_end_pos(pos, text_box, border=0):
    """
    Calculates end pos for a text box for cv2 images.

    :param pos: Position of text (same as for cv2 image)
    :param text_box: Size of text (same as for cv2 image)
    :param border: Outside padding of textbox
    :return box_end_pos: End xy coordinates for text box (end_point for cv2.rectangel())
    """
    box_x, box_y = pos
    text_w, text_h = text_box
    box_end_pos = (box_x + text_w + border, box_y + text_h + border)
    return box_end_pos