def image_fraction(image, xys):
    """ Return a subimage where x & y are fractions of the width & height. """
    x1, y1, x2, y2 = xys
    x1, x2 = sorted([x1, x2])
    y1, y2 = sorted([y1, y2])
    h, w = image.shape
    return image[int(y1 * h):int(y2 * h), int(x1 * w):int(x2 * w)]
