tformfwd

Apply forward spatial transformation

Syntax

[X, Y] = tformfwd(T, U, V)
[X1, X2, X3,...] = tformfwd(T, U1, U2, U3,...)
X = tformfwd(T, U)
X = tformfwd(T, U)
[X1, X2, X3,...] = tformfwd(T, U)
X = tformfwd(T, U1, U2, U3,...)
X = tformfwd(U,T)

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

[U1(k) U2(k) ... UNDIMS_IN(k)]

to the point

[X1(k) X2(k) ... XNDIMS_OUT(k)].

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.

Examples

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 tformfwd. Results should equal [x, y]

[xm, ym] = tformfwd(tform, u, v) 

See Also

cp2tform, fliptform, maketform, tforminv

  


© 1984-2010 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments