imshow
Display image
Syntax
Description
imshow( displays the grayscale
image I)I in a figure. imshow uses the
default display range for the image data type and optimizes figure, axes, and
image object properties for image display.
imshow(
displays the grayscale image I,[low high])I, specifying the display
range as a two-element vector, [low high]. For more
information, see the DisplayRange argument.
imshow( displays the grayscale
image I,[])I, scaling the display based on the range of pixel
values in I. imshow uses
[min(I(:)) max(I(:))] as the display range.
imshow displays the minimum value in
I as black and the maximum value as white. For more
information, see the DisplayRange argument.
imshow( displays the binary image
BW)BW in a figure. For binary images,
imshow displays pixels with the value
0 (zero) as black and 1 as
white.
imshow(___,
displays an image, using name-value arguments to control aspects of the
operation. Name=Value)
returns the image object created by himage = imshow(___)imshow.
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
To change the colormap after you create the image, use the
colormapcommand.You can display multiple images with different colormaps in the same figure using
imshowwith thetiledlayoutandnexttilefunctions.You can use the Image Viewer app as an integrated environment for displaying images and performing common image processing tasks.
You can set Image Processing Toolbox™ preferences that modify the behavior of
imshowby using theiptsetpreffunction.The
imshowfunction is not supported when you start MATLAB with the-nojvmoption.Figure titles can appear cut off in the Live Editor. To ensure the whole title is visible, set the
PositionContraintproperty of the parent axes object to"outerposition". Update the property value after theimshowfunction and before thetitlefunction.If you specify the parent axes using theI = imread("peppers.png"); imshow(I) ax = gca; ax.PositionConstraint = "outerposition"; title("Peppers");
Parentname-value argument, set thePositionConstraintproperty of the specified parent axes object. For more details about axes position properties, see Control Axes Layout.In some cases,
imshowdeletes the current axes and creates new axes. If a figure contains only one axes of default size,imshowretains the axes the first time you call it, but deletes the axes and creates a new axes if you callimshowagain. To retain a persistent axes, such as when updating the image displayed in a graphical user interface, callhold onafter the first call toimshow. Alternatively, you can update the image without callingimshowmultiple times by updating theCDataproperty of theImageobject returned byimshow, instead.














