Image Processing Toolbox User's Guide |
Find output bounds for spatial transformation
Syntax
Description
outbounds =
findbounds(TFORM,
inbounds)
estimates the output bounds corresponding to a given spatial transformation and a set of input bounds. TFORM
is a spatial transformation structure as returned by maketform
. inbounds is 2-by-NUM_DIMS
matrix. The first row of inbounds specifies the lower bounds for each dimension, and the second row specifies the upper bounds. NUM_DIMS
has to be consistent with the ndims_in
field of TFORM
.
outbounds has the same form as inbounds. It is an estimate of the smallest rectangular region completely containing the transformed rectangle represented by the input bounds. Since outbounds is only an estimate, it might not completely contain the transformed input rectangle.
Notes
imtransform
uses findbounds to compute the 'OutputBounds'
parameter if the user does not provide it.
If TFORM
contains a forward transformation (a nonempty forward_fcn
field), then findbounds works by transforming the vertices of the input bounds rectangle and then taking minimum and maximum values of the result.
If TFORM
does not contain a forward transformation, then findbounds estimates the output bounds using the Nelder-Mead optimization function fminsearch
. If the optimization procedure fails, findbounds issues a warning and returns outbounds = inbounds.
Example
inbounds = [0 0; 1 1] tform = maketform('affine',[2 0 0; .5 3 0; 0 0 1]) outbounds = findbounds(tform, inbounds)
See Also
cp2tform
, imtransform
, maketform
, tformarray
, tformfwd
, tforminv
filter2 | fliptform |
© 1994-2005 The MathWorks, Inc.