http://www.mathworks.com/access/helpdesk/help/toolbox/images/index.html?/access/helpdesk/help/toolbox/images/f12-26140.html
不共线三点决定一个affine homography
任意三点不共线四点决定一个projective homography
help maketform
MAKETFORM Create spatial transformation structure (TFORM).
T = MAKETFORM(TRANSFORMTYPE,...) creates a multidimensional spatial
transformation structure (a 'TFORM struct') that can be used with
TFORMFWD, TFORMINV, FLIPTFORM, IMTRANSFORM, or TFORMARRAY.
TRANSFORMTYPE can be 'affine', 'projective', 'custom', 'box', or
'composite'. Spatial transformations are also called geometric
transformations.
T = MAKETFORM('affine',A) builds a TFORM struct 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), then 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]. 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.
T = MAKETFORM('projective',A) builds 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. 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. T has
both forward and inverse transformations.
T = MAKETFORM('affine',U,X) builds a TFORM struct for a
two-dimensional affine transformation that maps each row of U
to the corresponding row of X. U and X are each 3-by-2 and
define the corners of input and output triangles. The corners
may not be collinear.
T = MAKETFORM('projective',U,X) builds a TFORM struct for a
two-dimensional projective transformation that maps each row of U
to the corresponding row of X. U and X are each 4-by-2 and
define the corners of input and output quadrilaterals. No three
corners may be collinear.
T = MAKETFORM('custom',NDIMS_IN,NDIMS_OUT,FORWARD_FCN,INVERSE_FCN,
TDATA) builds a custom TFORM struct 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. Those functions
must support the syntaxes X = FORWARD_FCN(U,T) and U =
INVERSE_FCN(X,T), where U is a P-by-NDIMS_IN matrix whose rows are
points in the transformation's input space, and X is a
P-by-NDIMS_OUT matrix whose rows are points in the transformation's
output space. TDATA can be any MATLAB array and is typically used to
store parameters of the custom transformation. It is accessible to
FORWARD_FCN and INVERSE_FNC 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.
T = MAKETFORM('composite',T1,T2,...,TL) or T = MAKETFORM('composite',
[T1 T2 ... TL]) builds a TFORM whose forward and inverse functions
are the functional compositions of the forward and inverse functions
of the T1, T2, ..., TL. For example, if L = 3 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 of the component transforms have defined forward transform
functions. T has a defined inverse transform function only if all of
the component functions have defined inverse transform functions.
T = MAKETFORM('box',TSIZE,LOW,HIGH) or T = MAKETFORM('box',INBOUNDS,
OUTBOUNDS) builds an N-dimensional affine TFORM struct, T. TSIZE is
an N-element vector of positive integers, and 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, alternatively, 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 K-th dimension is assumed to be
1.0. Similarly, INBOUNDS(1,K) and INBOUNDS(2,K) must be different
unless OUTBOUNDS(1,K) and OUTBOUNDS(1,K) are the same, and vice versa.
The 'box' TFORM is typically used to register the row and column
subscripts of an image or array to some "world" coordinate system.
Example
-------
Make and apply an affine transformation.
T = maketform('affine',[.5 0 0; .5 2 0; 0 0 1]);
tformfwd([10 20],T);
I = imread('cameraman.tif');
transformedI = imtransform(I,T);
figure, imshow(I), figure, imshow(transformedI)
See also fliptform, imtransform, tformarray, tformfwd, tforminv.
Reference page in Help browser
doc maketform
Wednesday, November 21, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment