def get_points(file,img_shape,mirror=False):
    """
        Read wp from a YOLO style file: each wp are the upper-left and the lower-right points of the bounding box
    """
    points = []
    img_shape = img_shape[:-1][::-1]
    file = open(file).read().split('\n')[:-1]
    for r in file:
        r = r.split()
        center = (float(r[1])*img_shape[0],float(r[2])*img_shape[1])
        width = float(r[3])*img_shape[0]
        height = float(r[4])*img_shape[1]
        if mirror:   # depends on orientation of rows
            p1 = round(center[0]+width/2),round(center[1]-height/2)
            p2 = round(center[0]-width/2),round(center[1]+height/2)
        else:
            p1 = round(center[0]-width/2),round(center[1]-height/2)
            p2 = round(center[0]+width/2),round(center[1]+height/2)
        points.append((p1,p2))
    return points