menpo/image/interpolation.py
def cython_interpolation(pixels, template_shape, h_transform, mode='constant',
                         order=1, cval=0.):
    r"""
    Interpolation utilizing skimage fast cython warp function. This method
    assumes that the warp takes the form of a homogeneous transform, and
    thus is much faster for operations such as scaling.

    Parameters
    ----------
    pixels : ``(M, N, ..., n_channels)`` `ndarray`
        The image to be sampled from, the final axis containing channel
        information.
    template_shape : `tuple`
        The shape of the new image that will be sampled
    mode : ``{constant, nearest, reflect, wrap}``, optional
        Points outside the boundaries of the input are filled according to the
        given mode.
    order : int, optional
        The order of the spline interpolation. The order has to be in the
        range [0,5].
    cval : `float`, optional
        The value that should be used for points that are sampled from
        outside the image bounds if mode is 'constant'

    Returns
    -------
    sampled_image : `ndarray`
        The pixel information sampled at each of the points.
    """
    # unfortunately they consider xy -> yx
    matrix = xy_yx.compose_before(h_transform).compose_before(xy_yx).h_matrix
    warped_channels = []
    # Loop over every channel in image - we know last axis is always channels
    # Note that map_coordinates uses the opposite (dims, points) convention
    # to us so we transpose
    for i in xrange(pixels.shape[-1]):
        warped_channels.append(_warp_fast(pixels[..., i], matrix,
                                          output_shape=template_shape,
                                          mode=mode, order=order, cval=cval))
    warped_channels = [v.reshape([-1, 1]) for v in warped_channels]
    return np.concatenate(warped_channels, axis=1)
r"""
    Interpolation utilizing skimage fast cython warp function. This method
    assumes that the warp takes the form of a homogeneous transform, and
    thus is much faster for operations such as scaling.

    Parameters
    ----------
    pixels : ``(M, N, ..., n_channels)`` `ndarray`
        The image to be sampled from, the final axis containing channel
        information.
    template_shape : `tuple`
        The shape of the new image that will be sampled
    mode : ``{constant, nearest, reflect, wrap}``, optional
        Points outside the boundaries of the input are filled according to the
        given mode.
    order : int, optional
        The order of the spline interpolation. The order has to be in the
        range [0,5].
    cval : `float`, optional
        The value that should be used for points that are sampled from
        outside the image bounds if mode is 'constant'

    Returns
    -------
    sampled_image : `ndarray`
        The pixel information sampled at each of the points.
    
r"""
Interpolation utilizing skimage fast cython warp function. This method
assumes that the warp takes the form of a homogeneous transform, and
thus is much faster for operations such as scaling.

Parameters



Returns

sampled_image : `ndarray`
The pixel information sampled at each of the points.
r " " " Interpolation utilizing skimage fast cython warp function . This method assumes that the warp takes the form of a homogeneous transform and thus is much faster for operations such as scaling . Parameters Returns sampled_image : ` ndarray ` The pixel information sampled at each of the points .
def cython_interpolation(pixels, template_shape, h_transform, mode='constant',
                         order=1, cval=0.):
    matrix = xy_yx.compose_before(h_transform).compose_before(xy_yx).h_matrix
    warped_channels = []
    for i in xrange(pixels.shape[-1]):
        warped_channels.append(_warp_fast(pixels[..., i], matrix,
                                          output_shape=template_shape,
                                          mode=mode, order=order, cval=cval))
    warped_channels = [v.reshape([-1, 1]) for v in warped_channels]
    return np.concatenate(warped_channels, axis=1)
def cython_interpolation ( pixels , template_shape , h_transform , mode = 'constant' , order = 1 , cval = 0. ) : matrix = xy_yx . compose_before ( h_transform ) . compose_before ( xy_yx ) . h_matrix warped_channels = [ ] for i in xrange ( pixels . shape [ - 1 ] ) : warped_channels . append ( _warp_fast ( pixels [ ... , i ] , matrix , output_shape = template_shape , mode = mode , order = order , cval = cval ) ) warped_channels = [ v . reshape ( [ - 1 , 1 ] ) for v in warped_channels ] return np . concatenate ( warped_channels , axis = 1 )
r"""
Interpolation utilizing skimage fast cython warp function.
r " " " Interpolation utilizing skimage fast cython warp function .
r"""
    Interpolation utilizing skimage fast cython warp function. This method
    assumes that the warp takes the form of a homogeneous transform, and
    thus is much faster for operations such as scaling.

    Parameters
    ----------
    pixels : ``(M, N, ..., n_channels)`` `ndarray`
        The image to be sampled from, the final axis containing channel
        information.
    template_shape : `tuple`
        The shape of the new image that will be sampled
    mode : ``{constant, nearest, reflect, wrap}``, optional
        Points outside the boundaries of the input are filled according to the
        given mode.
    order : int, optional
        The order of the spline interpolation. The order has to be in the
        range [0,5].
    cval : `float`, optional
        The value that should be used for points that are sampled from
        outside the image bounds if mode is 'constant'

    Returns
    -------
    sampled_image : `ndarray`
        The pixel information sampled at each of the points.
    """ # unfortunately they consider xy -> yx # Loop over every channel in image - we know last axis is always channels # Note that map_coordinates uses the opposite (dims, points) convention # to us so we transpose
pixels
template_shape
h_transform
mode
order
cval