Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Create spatial transformation structure (`TFORM`

)

`maketform`

is not recommended. Use `fitgeotrans`

, `affine2d`

, `affine3d`

,
or `projective2d`

instead.

`T = maketform('affine',A)`

`T = maketform('affine',U,X)`

`T = maketform('projective',A)`

`T = maketform('projective',U,X)`

`T = maketform('custom',NDIMS_IN,NDIMS_OUT,FORWARD_FCN,INVERSE_FCN,TDATA)`

`T = maketform('box',tsize,LOW,HIGH)`

`T = maketform('box',INBOUNDS, OUTBOUNDS)`

`T = maketform('composite',T1,T2,...,TL)`

`T = maketform('composite', [T1 T2 ... TL])`

creates
a multidimensional spatial transformation structure`T`

= maketform('affine',`A`

)`T`

for
an N-dimensional affine transformation. `A`

is a
nonsingular real (N+1)-by-(N+1) or (N+1)-by-N matrix. If `A`

is
(N+1)-by-(N+1), the last column of `A`

must be `[zeros(N,1);1]`

.
Otherwise, `A`

is augmented automatically, such that
its last column is `[zeros(N,1);1]`

. The matrix `A`

defines
a forward transformation such that `tformfwd(U,T)`

,
where `U`

is a 1-by-N vector, returns a 1-by-N vector `X`

,
such that `X = U * A(1:N,1:N) + A(N+1,1:N)`

. `T`

has
both forward and inverse transformations.

A spatial transformation structure (called a `TFORM`

struct)
that can be used with the `tformfwd`

, `tforminv`

, `fliptform`

, `imtransform`

,
or `tformarray`

functions.

creates
a `T`

= maketform('projective',`A`

)`TFORM`

struct for an N-dimensional projective
transformation. `A`

is a nonsingular real (N+1)-by-(N+1)
matrix. `A(N+1,N+1)`

cannot be 0. The matrix `A`

defines
a forward transformation such that `tformfwd(U,T)`

,
where `U`

is a 1-by-N vector, returns a 1-by-N vector `X`

,
such that `X = W(1:N)/W(N+1)`

, where ```
W =
[U 1] * A
```

. The transformation structure `T`

has
both forward and inverse transformations.

creates
a custom `T`

= maketform('custom',`NDIMS_IN,NDIMS_OUT`

,`FORWARD_FCN,INVERSE_FCN`

,`TDATA`

)`TFORM`

struct `T`

based
on user-provided function handles and parameters. `NDIMS_IN`

and `NDIMS_OUT`

are
the numbers of input and output dimensions. `FORWARD_FCN`

and `INVERSE_FCN`

are
function handles to forward and inverse functions. The forward function
must support the following syntax: `X = FORWARD_FCN(U,T)`

.
The inverse function must support the following syntax: ```
U
= INVERSE_FCN(X,T)
```

. In these syntaxes, `U`

is
a `P`

-by-`NDIMS_IN`

matrix whose
rows are points in the transformation input space. `X`

is
a `P`

-by-`NDIMS_OUT`

matrix whose
rows are points in the transformation output space. The `TDATA`

argument
can be any MATLAB^{®} array and is typically used to store parameters
of the custom transformation. It is accessible to `FORWARD_FCN`

and `INVERSE_FCN`

via
the `tdata`

field of `T`

. Either `FORWARD_FCN`

or `INVERSE_FCN`

can
be empty, although at least `INVERSE_FCN`

must be
defined to use `T`

with `tformarray`

or `imtransform`

.

or`T`

= maketform('box',`tsize`

,`LOW,HIGH`

)`T = maketform('box',INBOUNDS, OUTBOUNDS)`

builds
an N-dimensional affine `TFORM`

struct `T`

.
The `tsize`

argument is an N-element vector of positive
integers. `LOW`

and `HIGH`

are also
N-element vectors. The transformation maps an input box defined by
the opposite corners `ones(1,N)`

and `tsize`

,
or by corners `INBOUNDS(1,:)`

and `INBOUND(2,:)`

,
to an output box defined by the opposite corners `LOW`

and `HIGH`

or `OUTBOUNDS(1,:)`

and `OUTBOUNDS(2,:)`

. `LOW(K)`

and `HIGH(K)`

must
be different unless `tsize(K)`

is 1, in which case
the affine scale factor along the Kth dimension is assumed to be 1.0.
Similarly, `INBOUNDS(1,K)`

and `INBOUNDS(2,K)`

must
be different unless `OUTBOUNDS(1,K)`

and `OUTBOUNDS(2,K)`

are
the same, and conversely. The `'box'`

`TFORM`

is
typically used to register the row and column subscripts of an image
or array to some world coordinate system.

or`T`

= maketform('composite',`T1,T2,...,TL`

)`T = maketform('composite', [T1 T2 ... TL])`

builds
a `TFORM`

struct `T`

whose forward
and inverse functions are the functional compositions of the forward
and inverse functions of `T1, T2, ..., TL`

.

The inputs `T1, T2, ..., TL`

are ordered just
as they would be when using the standard notation for function composition: ```
T
= T1
```

$$\circ $$ `T2`

$$\circ $$ ... $$\circ $$ `TL`

and note
also that composition is associative, but not commutative. This means
that to apply `T`

to the input `U`

,
one must apply `TL`

first and `T1`

last.
Thus if `L = 3`

, for example, then `tformfwd(U,T)`

is
the same as `tformfwd(tformfwd(tformfwd(U,T3),T2),T1)`

.
The components `T1`

through `TL`

must
be compatible in terms of the numbers of input and output dimensions. `T`

has
a defined forward transform function only if all the component transforms
have defined forward transform functions. `T`

has
a defined inverse transform function only if all the component functions
have defined inverse transform functions.

An affine or projective transformation can also be expressed like this equation, for a 3-by-2

`A`

:[X Y]' = A' * [U V 1] '

Or, like this equation, for a 3-by-3

`A`

:[X Y 1]' = A' * [U V 1]'

`fliptform`

| `imtransform`

| `tformarray`

| `tformfwd`

| `tforminv`

Was this topic helpful?