@staticmethod
def warp(image, dx_factor=0.27, dy_factor=0.21):
    (width, height) = image.size
    dx = (width * dx_factor)
    dy = (height * dy_factor)
    x1 = int(random.uniform((- dx), dx))
    y1 = int(random.uniform((- dy), dy))
    x2 = int(random.uniform((- dx), dx))
    y2 = int(random.uniform((- dy), dy))
    image2 = Image.new('RGB', (((width + abs(x1)) + abs(x2)), ((height + abs(y1)) + abs(y2))))
    image2.paste(image, (abs(x1), abs(y1)))
    (width2, height2) = image2.size
    return image2.transform((width, height), Image.QUAD, (x1, y1, (- x1), (height2 - y2), (width2 + x2), (height2 + y2), (width2 - x2), (- y1)))
@staticmethod
def warp(image, dx_factor=0.27, dy_factor=0.21):
    (width, height) = image.size
    dx = (width * dx_factor)
    dy = (height * dy_factor)
    x1 = int(random.uniform((- dx), dx))
    y1 = int(random.uniform((- dy), dy))
    x2 = int(random.uniform((- dx), dx))
    y2 = int(random.uniform((- dy), dy))
    image2 = Image.new('RGB', (((width + abs(x1)) + abs(x2)), ((height + abs(y1)) + abs(y2))))
    image2.paste(image, (abs(x1), abs(y1)))
    (width2, height2) = image2.size
    return image2.transform((width, height), Image.QUAD, (x1, y1, (- x1), (height2 - y2), (width2 + x2), (height2 + y2), (width2 - x2), (- y1)))