which data type is used to crop an image
Answers
You can crop an image in Photoshop by using the Crop tool, which is one of the basic tools in your Tool Palette. Use the Tool Options to specify details like the photo's final aspect ratio and orientation. Drag and resize the crop box, then click the checkmark (or press Enter) when you're done.
Syntax
Icropped = imcrop
Icropped = imcrop(I)
Xcropped = imcrop(X,cmap)
___ = imcrop(h)
Icropped = imcrop(I,rect)
Xcropped = imcrop(X,cmap,rect)
___ = imcrop(xref,yref,___)
[___,rectout] = imcrop(___)
[xrefout,yrefout,___] = imcrop(___)
imcrop(___)
Description
Crop Image Interactively
Note
The interactive syntaxes do not support categorical images. For categorical images, you must specify the crop region, rect.
Icropped = imcrop creates an interactive Crop Image tool associated with the grayscale, truecolor, or binary image displayed in the current figure. imcrop returns the cropped image, Icropped.
With this syntax and the other interactive syntaxes, the Crop Image tool blocks the MATLAB® command line until you complete the operation. For more information about using the Crop Image tool, see Interactive Behavior.
example
Icropped = imcrop(I) displays the grayscale, truecolor, or binary image I in a figure window and creates an interactive Crop Image tool associated with the image.
Xcropped = imcrop(X,cmap) displays the indexed image X in a figure using the color map cmap, and creates an interactive Crop Image tool associated with that image. imcrop returns the cropped indexed image, Xcropped, which also has the color map cmap.
___ = imcrop(h) creates an interactive Crop Image tool associated with the image specified by the handle h.
Crop Image by Specifying Crop Region
example
Icropped = imcrop(I,rect) crops the image I according to the position and dimensions specified in the crop rectangle rect. 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.
example
Xcropped = imcrop(X,cmap,rect) crops the indexed image X with color map cmap according to the position and dimensions specified in the crop rectangle rect. imcrop returns the cropped indexed image, Xcropped, which also has the color map cmap.
___ = imcrop(xref,yref,___) crops the input image using the world coordinate system defined by xref and yref. After the xref and yref input arguments, you can specify the arguments of any syntax that includes an input image I or X.
Specify Additional Output Options
example
[___,rectout] = imcrop(___) also returns the position of the crop rectangle in rectout. You can use the input arguments of any other syntax.
[xrefout,yrefout,___] = imcrop(___) also returns the image limits of the input image in xrefout and yrefout.
imcrop(___) without output arguments displays the cropped image in a new figure window. This syntax does not support categorical images.