Crop image
creates an interactive Crop Image
tool associated with the image displayed in the current figure. With this syntax and the
other interactive syntaxes, the Crop Image tool blocks the MATLAB® command line until you complete the operation. J
= imcropimcrop
returns the cropped image, J
.
For more information about using the Crop Image tool, see Interactive Behavior.
crops the image J
= imcrop(I
,rect
)I
according to the position and dimensions specified
in the crop rectangle rect
or an
images.spatialref.Rectangle
object. The crop rectangle,
rect
, is a vector of the form [x, y, width,
height]
that specifies the size and position of the cropped image in spatial
coordinates. The cropped image includes all pixels in the input image that are completely
or partially enclosed by the rectangle.
The actual size of the output image does not always correspond exactly with the width
and height specified by rect
. For example, suppose
rect
is [20 20 40 30]
, using the default spatial
coordinate system. The upper left corner of the specified rectangle is the center of the
pixel with spatial (x,y) coordinates (20,20). The lower right corner of the rectangle is the
center of the pixel with spatial (x,y) coordinates (60,50). The resulting output image has size 31-by-41
pixels, not 30-by-40 pixels.
drawrectangle
| images.spatialref.Rectangle
| imcrop3
| zoom