affine_transform(input, matrix, offset=0.0, output_shape=None, output=None, order=None, mode='constant', cval=0.0, prefilter=True)¶
Apply an affine transformation.
Given an output image pixel index vector
o, the pixel value is determined from the input image at position
cupy.dot(matrix, o) + offset.
- input (cupy.ndarray) – The input array.
- matrix (cupy.ndarray) –
The inverse coordinate transformation matrix, mapping output coordinates to input coordinates. If
ndimis the number of dimensions of
input, the given matrix must have one of the following shapes:
(ndim, ndim): the linear transformation matrix for each output coordinate.
(ndim,): assume that the 2D transformation matrix is diagonal, with the diagonal specified by the given value.
(ndim + 1, ndim + 1): assume that the transformation is specified using homogeneous coordinates. In this case, any value passed to
(ndim, ndim + 1): as above, but the bottom row of a homogeneous transformation matrix is always
[0, 0, ..., 1], and may be omitted.
- offset (float or sequence) – The offset into the array where the
transform is applied. If a float,
offsetis the same for each axis. If a sequence,
offsetshould contain one value for each axis.
- output_shape (tuple of ints) – Shape tuple.
- output (cupy.ndarray or dtype) – The array in which to place the output, or the dtype of the returned array.
- order (int) – The order of the spline interpolation. If it is not given,
order 1 is used. It is different from
scipy.ndimageand can change in the future. Currently it supports only order 0 and 1.
- mode (str) – Points outside the boundaries of the input are filled
according to the given mode (
'opencv'). Default is
- cval (scalar) – Value used for points outside the boundaries of
the input if
mode='opencv'. Default is 0.0
- prefilter (bool) – It is not used yet. It just exists for compatibility
The transformed input. If
outputis given as a parameter,