Image Processing Toolbox User's Guide Previous page   Next Page
tformfwd

Apply forward spatial transformation

Syntax

Description

[X,Y] = tformfwd(T,U,V) applies the 2D-to-2D spatial transformation defined in T to coordinate arrays U and V, mapping the point [U(k) V(k)] to the point [X(k) Y(k)].

T is a TFORM struct created with maketform, fliptform, or cp2tform. Both T.ndims_in and T.ndims_out must equal 2. U and V are typically column vectors matching in length. In general, U and V can have any dimensionality, but must have the same size. In any case, X and Y will have the same size as U and V.

[X1,X2,X3,...] = tformfwd(T,U1,U2,U3,...) applies the ndims_in-to-ndims_out spatial transformation defined in TFORM structure T to the coordinate arrays U1,U2,...,UNDIMS_IN (where NDIMS_IN = T.ndims_in and NDIMS_OUT = T.ndims_out). The number of output arguments must equal NDIMS_OUT. The transformation maps the point

to the point

U1,U2,U3,... can have any dimensionality, but must be the same size.

X1,X2,X3,... must have this size also.

X = tformfwd(T,U) applies the ndims_in-to-ndims_out spatial transformation defined in TFORM structure T to each row of U, where U is an M-by-NDIMS_IN matrix. It maps the point U(k,:) to the point X(k,:). X is an M-by-NDIMS_OUT matrix.

X = tformfwd(T,U) , where U is an (N+1)-dimensional array, maps the point U(k1,k2,...,kN,:) to the point X(k1,k2,...,kN,:). size(U,N+1) must equal NDIMS_IN. X is an (N+1)-dimensional array, with size(X,I) equal to size(U,I) for I = 1,...,N and size(X,N+1) equal to NDIMS_OUT.

[X1,X2,X3,...] = tformfwd(T,U) maps an (N+1)-dimensional array to NDIMS_OUT equally sized N-dimensional arrays.

X = tformfwd(T,U1,U2,U3,...) maps NDIMS_IN N-dimensional arrays to one (N+1)-dimensional array.

Note

X = tformfwd(U,T) is an older form of the two-argument syntax that remains supported for backward compatibility.

Example

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).

Validate the mapping by applying tformfwd. Results should equal [x, y]

See Also

cp2tform, fliptform, maketform, tforminv


Previous page  tformarray tforminv Next page

© 1994-2005 The MathWorks, Inc.