- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

Functions
transform
Complete List of ArrayFire Functions ArrayFire Functions by Category » Image Processing » | Image transformations

Transform an input image. More...

## Functions
AFAPI array | transform (const array &in, const array &transform, const dim_t odim0=0, const dim_t odim1=0, const interpType method=AF_INTERP_NEAREST, const bool inverse=true)
| C++ Interface for transforming an image. More...
AFAPI af_err | af_transform (af_array *out, const af_array in, const af_array transform, const dim_t odim0, const dim_t odim1, const af_interp_type method, const bool inverse)
| C Interface for transforming an image. More...

## Detailed Description

Transform an input image.

The transform function uses an affine transform matrix to tranform an input image into a new one.

The transform matrix `tf` is a 3x2 matrix of type float. The matrix operation is applied to each location (x, y) that is then transformed to (x', y') of the new array. Hence the transformation is an element-wise operation.

The operation is as below: tf = [r00 r10 r01 r11 t0 t1]

x' = x * r00 + y * r01 + t0; y' = x * r10 + y * r11 + t1;

Interpolation types of AF_INTERP_NEAREST and AF_INTERP_BILINEAR are allowed.

Affine transforms can be used for various purposes. af::translate, af::scale and af::skew are specializations of the transform function.

## Function Documentation

AFAPI af_err af_transform | ( | af_array * | out,
|  | const af_array | in,
|  | const af_array | transform,
|  | const dim_t | odim0,
|  | const dim_t | odim1,
|  | const af_interp_type | method,
|  | const bool | inverse
| ) |  |

C Interface for transforming an image.

Parameters

  [out] | out | will contain the transformed image
  [in] | in | is input image
  [in] | transform | is transformation matrix
  [in] | odim0 | is the first output dimension
  [in] | odim1 | is the second output dimension
  [in] | method | is the interpolation type (Nearest by default)
  [in] | inverse | if true applies inverse transform, if false applies forward transoform

Returns
  AF_SUCCESS if the color transformation is successful, otherwise an appropriate error code is returned.

AFAPI array af::transform | ( | const array & | in,
|  | const array & | transform,
|  | const dim_t | odim0 = `0`,
|  | const dim_t | odim1 = `0`,
|  | const interpType | method = `AF_INTERP_NEAREST`,
|  | const bool | inverse = `true`
| ) |  |

C++ Interface for transforming an image.

Parameters

  [in] | in | is input image
  [in] | transform | is transformation matrix
  [in] | odim0 | is the first output dimension
  [in] | odim1 | is the second output dimension
  [in] | method | is the interpolation type (Nearest by default)
  [in] | inverse | if true applies inverse transform, if false applies forward transoform

Returns
  the transformed image