Image Processing Toolbox User's Guide |
Creating TFORM Structures
After defining the transformation data (Defining the Transformation Data), you must create a TFORM
structure to specify the spatial transformation. You use the maketform
function to create a TFORM
structure. You pass the TFORM
structure to the imtransform
to perform the transformation. (You can also create a TFORM
using the cp2tform
function. For more information, see Image Registration.)
The example creates a TFORM
structure that specifies the parameters necessary for the translation operation.
To create a TFORM
you must specify the type of transformation you want to perform and pass in the transformation data. The example specifies 'affine'
as the transformation type because translation is an affine transformation but maketform
also supports projective transformations. In addition, by using the custom
and composite
options you can specify a virtually limitless variety of spatial transformations to be used with imtransform
. The following table lists the transformation types supported by maketform
.
Contents of a TFORM Structure
The TFORM
structure created by the maketform
function is a MATLAB data structure that contains the parameters needed to perform the requested transformation. (These are actually the parameters required by the low-level transformation function tformarray
, which imtransform
calls to perform the transformation -- see Performing N-Dimensional Spatial Transformations.)
tform_translate = ndims_in: 2 ndims_out: 2 forward_fcn: @fwd_affine inverse_fcn: @inv_affine tdata: [1x1 struct]
The following table describes each of these fields. Note that you do not have to specify the value of these fields; maketform
creates this structure.
The tdata
field contains the actual transformation matrix that you passed in as an argument or that maketform
inferred from the sets of points you specified. For example, the following is the transformation matrix for the forward transformation for the translation in Example: Performing a Translation.
Defining the Transformation Data | Performing the Spatial Transformation |
© 1994-2005 The MathWorks, Inc.