def convert_box_xy(x1, y1, width, height):
    """
    Convert from x1, y1, representing the center of the box to the top left
    coordinate (corner).

    :param x1: the x coordinate for the center of the bounding box
    :param y1: the y coordinate for the center of the bounding box
    :param width: with of the bounding box
    :param height: height of the bounding box
    :param img_width: the width of the image
    :param img_height: the height of the image
    :return: the top left coordinate (corner) of the bounding box
    """
    left = (x1 - width // 2)
    top = (y1 - height // 2)

    if left < 0: left = 0
    if top < 0: top = 0;

    return left, top