Rectangle
Spatial extents of 2-D rectangular region
Description
A Rectangle object stores the spatial extents of a 2-D
rectangular region.
Creation
You can create a Rectangle object in these ways.
centerCropWindow2d— Create aRectangleof a specified size whose position is centered on an image of different size.randomWindow2d— Create aRectanglewhose position is selected randomly from within an image of different size. You can specify the size of the rectangle or a range of valid aspect ratios and relative areas of the rectangle.Running the command
creates ar = images.spatialref.Rectangle(XLimits,YLimits)
Rectangleobject and sets theXLimitsandYLimitsproperties.
Properties
Examples
Version History
Introduced in R2019b
See Also
Cuboid | centerCropWindow2d | randomWindow2d | imcrop
Topics
- Augment Images for Deep Learning Workflows (Deep Learning Toolbox)



