# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# tforminv

Apply inverse spatial transformation

## Syntax

``````[U,V] = tforminv(T,X,Y)``````
``[U1,U2,...,U_ndims_in] = tforminv(T,X1,X2,...,X_ndims_out)``
``U = tforminv(T,X)``
``[U1,U2,...,U_ndims_in] = tforminv(T,X)``
``U = tforminv(T,X1,X2,...,X_ndims_in)``

## Description

example

``````[U,V] = tforminv(T,X,Y)``` applies the 2D-to-2D inverse spatial transformation defined in `T` to coordinate arrays `X` and `Y`, mapping the point `[X(k) Y(k)]` to the point `[U(k) V(k)]`.Both `T.ndims_in` and `T.ndims_out` must equal 2. `X` and `Y` are typically column vectors, but they can have any dimensionality. `U` and `V` are the same size as `X` and `Y````
````[U1,U2,...,U_ndims_in] = tforminv(T,X1,X2,...,X_ndims_out)` applies the `ndims_out`-to-`ndims_in` inverse transformation defined in `T` to the coordinate arrays `X1,X2,...,X_ndims_out`. The transformation maps the point ```[X1(k) X2(k) ... X_ndims_out(k)]``` to the point ```[U1(k) U2(k) ... U_ndims_in(k)]```.The number of input coordinate arrays, `ndims_out`, must equal `T.ndims_out`. The number of output coordinate arrays, `ndims_in`, must equal `T.ndims_in`. The arrays `X1,X2,...,X_ndims_out` can have any dimensionality, but must be the same size. The output arrays `U1,U2,...,U_ndims_in` must be this size also.```
````U = tforminv(T,X)` applies the `ndims_out`-to-`ndims_in` inverse transformation defined in `T` to array `X`. When `X` is a 2-D matrix with dimensions m-by-`ndims_out` matrix, `U` is a 2-D matrix with dimensions m-by-`ndims_in`. `tforminv` applies the transformation to to each row of `X`. `tforminv` maps the point `X`(k, : ) to the point `U`(k, : ).When `X` is an (N+1)-dimensional array, `tforminv` maps the point `X`(k1, k2, … ,kN, : ) to the point `U`(k1, k2, … ,kN, : ).`size(X,N+1)` must equal `ndims_out`. `U` is an (N+1)-dimensional array, with `size(U,I)` equal to `size(X,I)` for `I` = 1, … ,N, and `size(U,N+1)` equal to `ndims_in`. The syntax `U = tforminv(X,T)` is an older form of this syntax that remains supported for backward compatibility.```
````[U1,U2,...,U_ndims_in] = tforminv(T,X)` maps one (N+1)-dimensional array to `ndims_in` equally sized N-dimensional arrays.```
````U = tforminv(T,X1,X2,...,X_ndims_in)` maps `ndims_out` N-dimensional arrays to one (N+1)-dimensional array.```

## Examples

collapse all

Create an affine transformation that maps the triangle with vertices (0,0), (6,3), (-2,5) to the triangle with vertices (-1,-1), (0,-10), (4,4).

```u = [ 0 6 -2]'; v = [ 0 3 5]'; x = [-1 0 4]'; y = [-1 -10 4]'; tform = maketform('affine',[u v],[x y]);```

Validate the mapping by applying `tforminv`. The results should equal `u` and `v`.

`[um, vm] = tforminv(tform, x, y)`
```um = 0 6.0000 -2.0000 ```
```vm = 0 3.0000 5.0000 ```

## Input Arguments

collapse all

Spatial transformation, specified as a `TFORM` spatial transformation structure. Create `T` using `maketform`, `fliptform`, or `cp2tform`.

Data Types: `struct`

Input coordinate points, specified as a numeric array. The size and dimensionality of `X` can have additional limitations depending on the syntax used.

Data Types: `double`

Input coordinate points, specified as a numeric array. `Y` must be the same size as `X`.

Data Types: `double`

Input coordinate points, specified as multiple numeric arrays. The size and dimensionality of `X1,X2,...,X_ndims_out` can have additional limitations depending on the syntax used.

Data Types: `double`

## Output Arguments

collapse all

Coordinate array of output points, returned as a numeric array. The size and dimensionality of `U` can have additional limitations depending on the syntax used.

Coordinate array of output points, returned as a numeric array. `V` is the same size as `Y`.

Coordinates of output points, returned as multiple arrays. The size and dimensionality of `U1,U2,...,U_ndims_in` can have additional limitations depending on the syntax used.