def _get_interp_method(interp, sizes=()):
    'Get the interpolation method for resize functions.\n    The major purpose of this function is to wrap a random interp method selection\n    and a auto-estimation method.\n\n    Parameters\n    ----------\n    interp : int\n        interpolation method for all resizing operations\n\n        Possible values:\n        0: Nearest Neighbors Interpolation.\n        1: Bilinear interpolation.\n        2: Area-based (resampling using pixel area relation). It may be a\n        preferred method for image decimation, as it gives moire-free\n        results. But when the image is zoomed, it is similar to the Nearest\n        Neighbors method. (used by default).\n        3: Bicubic interpolation over 4x4 pixel neighborhood.\n        4: Lanczos interpolation over 8x8 pixel neighborhood.\n        9: Cubic for enlarge, area for shrink, bilinear for others\n        10: Random select from interpolation method metioned above.\n        Note:\n        When shrinking an image, it will generally look best with AREA-based\n        interpolation, whereas, when enlarging an image, it will generally look best\n        with Bicubic (slow) or Bilinear (faster but still looks OK).\n        More details can be found in the documentation of OpenCV, please refer to\n        http://docs.opencv.org/master/da/d54/group__imgproc__transform.html.\n    sizes : tuple of int\n        (old_height, old_width, new_height, new_width), if None provided, auto(9)\n        will return Area(2) anyway.\n\n    Returns\n    -------\n    int\n        interp method from 0 to 4\n    '
    if (interp == 9):
        if sizes:
            assert (len(sizes) == 4)
            (oh, ow, nh, nw) = sizes
            if ((nh > oh) and (nw > ow)):
                return 2
            elif ((nh < oh) and (nw < ow)):
                return 3
            else:
                return 1
        else:
            return 2
    if (interp == 10):
        return random.randint(0, 4)
    if (interp not in (0, 1, 2, 3, 4)):
        raise ValueError(('Unknown interp method %d' % interp))
    return interp
Get the interpolation method for resize functions.
The major purpose of this function is to wrap a random interp method selection
and a auto-estimation method.

Parameters
----------
interp : int
    interpolation method for all resizing operations

    Possible values:
    0: Nearest Neighbors Interpolation.
    1: Bilinear interpolation.
    2: Area-based (resampling using pixel area relation). It may be a
    preferred method for image decimation, as it gives moire-free
    results. But when the image is zoomed, it is similar to the Nearest
    Neighbors method. (used by default).
    3: Bicubic interpolation over 4x4 pixel neighborhood.
    4: Lanczos interpolation over 8x8 pixel neighborhood.
    9: Cubic for enlarge, area for shrink, bilinear for others
    10: Random select from interpolation method metioned above.
    Note:
    When shrinking an image, it will generally look best with AREA-based
    interpolation, whereas, when enlarging an image, it will generally look best
    with Bicubic (slow) or Bilinear (faster but still looks OK).
    More details can be found in the documentation of OpenCV, please refer to
    http://docs.opencv.org/master/da/d54/group__imgproc__transform.html.
sizes : tuple of int
    (old_height, old_width, new_height, new_width), if None provided, auto(9)
    will return Area(2) anyway.

Returns
-------
int
    interp method from 0 to 4
def _get_interp_method(interp, sizes=()):
    'Get the interpolation method for resize functions.\n    The major purpose of this function is to wrap a random interp method selection\n    and a auto-estimation method.\n\n    Parameters\n    ----------\n    interp : int\n        interpolation method for all resizing operations\n\n        Possible values:\n        0: Nearest Neighbors Interpolation.\n        1: Bilinear interpolation.\n        2: Area-based (resampling using pixel area relation). It may be a\n        preferred method for image decimation, as it gives moire-free\n        results. But when the image is zoomed, it is similar to the Nearest\n        Neighbors method. (used by default).\n        3: Bicubic interpolation over 4x4 pixel neighborhood.\n        4: Lanczos interpolation over 8x8 pixel neighborhood.\n        9: Cubic for enlarge, area for shrink, bilinear for others\n        10: Random select from interpolation method metioned above.\n        Note:\n        When shrinking an image, it will generally look best with AREA-based\n        interpolation, whereas, when enlarging an image, it will generally look best\n        with Bicubic (slow) or Bilinear (faster but still looks OK).\n        More details can be found in the documentation of OpenCV, please refer to\n        http://docs.opencv.org/master/da/d54/group__imgproc__transform.html.\n    sizes : tuple of int\n        (old_height, old_width, new_height, new_width), if None provided, auto(9)\n        will return Area(2) anyway.\n\n    Returns\n    -------\n    int\n        interp method from 0 to 4\n    '
    if (interp == 9):
        if sizes:
            assert (len(sizes) == 4)
            (oh, ow, nh, nw) = sizes
            if ((nh > oh) and (nw > ow)):
                return 2
            elif ((nh < oh) and (nw < ow)):
                return 3
            else:
                return 1
        else:
            return 2
    if (interp == 10):
        return random.randint(0, 4)
    if (interp not in (0, 1, 2, 3, 4)):
        raise ValueError(('Unknown interp method %d' % interp))
    return interp