FUNCTION REFERENCE
imcrop
Crop an image to a rectangle.
Crop an image to a rectangle.
Syntax
J = imcrop(I, rect)rect = [xmin ymin width height] in spatial coordinates, where pixel (r, c) covers [c-0.5, c+0.5] by [r-0.5, r+0.5]. The result holds every pixel the rectangle touches, so [20 20 40 30] gives 31 rows and 41 columns. The rectangle is clipped to the image; one outside it gives an empty array. Works on 2-D and M-by-N-by-C arrays.
Example
imcrop(magic(5), [2 2 2 1]) % rows 2-3, columns 2-4Differences from MATLAB: imcrop needs a rectangle: the interactive forms, the second output (rect), spatial referencing (imcrop(x, y, I, rect)) and indexed images are not supported.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.