outputLimits
Find output spatial limits given input spatial limits
Syntax
Description
[
estimates the output spatial limits corresponding to a set of input spatial limits,
xLimitsOut
,yLimitsOut
] = outputLimits(tform
,xLimitsIn
,yLimitsIn
)xLimitsIn
and yLimitsIn
, given 2-D
geometric transformation tform
.
[
estimates the output spatial limits, given 3-D geometric transformation
xLimitsOut
,yLimitsOut
,zLimitsOut
] = outputLimits(tform
,xLimitsIn
,yLimitsIn
,zLimitsIn
)tform
.
Examples
Estimate Output Limits for 2-D Geometric Transformation
Define a 3-by-3 geometric transformation matrix. This example specifies a matrix for an affine transformation consisting of vertical shear and horizontal stretch.
A = [2 0 0; 0.33 1 0; 0 0 1];
Create an affinetform2d
object from the transformation matrix.
tform = affinetform2d(A);
Read an image and calculate the size of the image.
I = imread("pout.tif");
[height,width,~] = size(I)
height = 291
width = 240
Estimate the output spatial limits.
[xlim,ylim] = outputLimits(tform,[1 width],[1 height])
xlim = 1×2
2 480
ylim = 1×2
1.3300 370.2000
Estimate Output Limits for 3-D Geometric Transformation
Define a rigid geometric transformation consisting only of translation.
t = [10 20.5 15]; tform = transltform3d(t);
Estimate the output spatial limits for a volume of size 128-by-128-by-128 voxels.
[xlim,ylim,zlim] = outputLimits(tform,[1 128],[1 128],[1 128])
xlim = 1×2
11 138
ylim = 1×2
21.5000 148.5000
zlim = 1×2
16 143
Input Arguments
tform
— Geometric transformation
geometric transformation object
Geometric transformation, specified as a geometric transformation object listed in the table.
Geometric Transformation Object | Description |
---|---|
2-D Linear Geometric Transformations | |
transltform2d | Translation transformation |
rigidtform2d | Rigid transformation: translation and rotation |
simtform2d | Similarity transformation: translation, rotation, and isotropic scaling |
affinetform2d | Affine transformation: translation, rotation, anisotropic scaling, reflection, and shearing |
projtform2d | Projective transformation |
3-D Linear Geometric Transformations | |
transltform3d | Translation transformation |
rigidtform3d | Rigid transformation: translation and rotation |
simtform3d | Similarity transformation: translation, rotation, and isotropic scaling |
affinetform3d | Affine transformation: translation, rotation, anisotropic scaling, reflection, and shearing |
Nonlinear Geometric Transformations | |
geometricTransform2d | Custom 2-D geometric transformation using point-wise mapping functions |
geometricTransform3d | Custom 3-D geometric transformation using point-wise mapping functions |
LocalWeightedMeanTransformation2D | 2-D local weighted means transformation |
PiecewiseLinearTransformation2D | 2-D piecewise linear transformation |
PolynomialTransformation2D | 2-D polynomial transformation |
Note
You can also specify tform
as an object of type
rigid2d
, rigid3d
, affine2d
, affine3d
, or projective2d
. However,
these objects are not recommended. For more information, see Version History.
xLimitsIn
— Input spatial limits in the x-dimension
1-by-2 numeric vector
Input spatial limits in the x-dimension, specified as a 1-by-2 numeric vector.
Data Types: double
yLimitsIn
— Input spatial limits in the y-dimension
1-by-2 numeric vector
Input spatial limits in the y-dimension, specified as a 1-by-2 numeric vector.
Data Types: double
zLimitsIn
— Input spatial limits in the z-dimension
1-by-2 numeric vector
Input spatial limits in the z-dimension, specified as a
1-by-2 numeric vector. Specify zLimitsIn
only when
tform
is an object representing a 3-D geometric
transformation.
Data Types: double
Output Arguments
xLimitsOut
— Output spatial limits in the x-dimension
1-by-2 numeric vector
Output spatial limits in the x-dimension, returned as a 1-by-2 numeric vector.
Data Types: double
yLimitsOut
— Output spatial limits in the y-dimension
1-by-2 numeric vector
Output spatial limits in the y-dimension, returned as a 1-by-2 numeric vector.
Data Types: double
Version History
Introduced in R2013aR2022b: Supports new geometric transformation objects
Starting in R2022b, most Image Processing Toolbox™ functions create and perform geometric transformations using the
premultiply convention. Accordingly, you can now specify tform
as a geometric transformation object that uses the premultiply convention, such as
an affinetform2d
object.
Although outputLimits
still supports objects that use the
postmultiply convention, such as an affine2d
object, these objects are
not recommended. You can streamline your geometric transformation workflows by
switching to the new premultiply geometric transformation objects. For more
information, see Migrate Geometric Transformations to Premultiply Convention.
There is no change to the support for nonlinear geometric transformation objects.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)