Skip to main content

Transform

Applies linear transformations to an image, such as scaling, rotation, skewing, or warping, altering its shape or orientation.

🖞ïļ Image options and parameters of transform method

transform method uses transformation matrix to rotate, translate, and/or scale the image. User needs to pass on the matrix that will be applied to the image. Matrix must have either 2 rows and 3 columns or 3 rows and 3 columns:

[abcdefghi]\begin{bmatrix} a & b & c\\ d & e & f \\ g & h & i \end{bmatrix}

If 2x3 matrix is passed, the algorithm will consider it as affine transformation so last row will be set as [0,0,1];

  • the first a and e are responsible for image scaling
  • b and d are responsible for shear. Combination of these 4 variables allows rotating. c and f are responsible for image translation.
  • g and h are used for an operation called projection. It allows changing image perspective.
  • i is a normalization factor. It acts like a "scaling factor" for the entire coordinate system. Think of it as a zoom lens setting.

For more information take a look at the tutorial about image transformations

caution

Matrix cannot be singular. Otherwise it cannot be inverted. Click here to learn more.

placeholderplaceholder
Ran in 0.00Ξs (Infinity ops/s)

Kinds of images compatible with algorithm​

Image propertyWhat it meansPossible values
bitDepthnumber of bits per channel[8,16]
componentsnumber of componentsany
alphais alpha channel allowedtrue

Parameters and its default values​

  • transformMatrix

  • options

Options​

PropertyRequiredDefault value
borderTypenoconstant
borderValueno0
fullImageno-
heightno-
interpolationTypenobilinear
inverseno-
widthno-