polywarp_image

sofia_redux.toolkit.image.warp.polywarp_image(image, x0, y0, x1, y1, order=1, method='cubic', cubic=None, mode='constant', cval=nan, ignorenans=True, get_transform=False)[source]

Warp an image by mapping 2 coordinate sets with a polynomial transform.

Represents the transform from one set of coordinates to another with a polynomial fit, then applies that transform to an image. After the coordinate warping coefficients have been determined, values are derived with one of the interpolation methods available in the Interpolate class.

This is a wrapper for the polywarp function originally converted from IDL, which does not fit into the standard API of toolkit.

Parameters:
imagearray_like

The 2 dimensional image array

x0array_like

The x-coordinates defining the first set of coordinates.

y0array_like

The y-coordinates defining the first set of coordinates.

x1array_like

The x-coordinates defining the second set of coordinates.

y1array_like

The y-coordinates defining the second set of coordinates.

orderint, optional

The polynomial order to fit. Coordinate sets must have a length of at least (order + 1)^2.

methodstr, optional

The interpolation method to use. Please see toolkit.interpolate.Interpolate.

cubicfloat, optional

The cubic parameter if cubic interpolation is used. Please see toolkit.interpolate.Interpolate.

modestr, optional

Defines edge handling during interpolation. Please see toolkit.interpolate.Interpolate.

cvalint or float, optional

If mode=constant, defines the value of points outside the boundary.

ignorenansbool, optional

If True, do not include NaN values during interpolation.

get_transformbool, optional

if True, return the transformation object as the second element of a 2-tuple in the return value

Returns
——-
warped_imagenumpy.ndarray of numpy.float64

The warped image with the same shape as image.