Display image
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
parameter.
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
parameter.
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 the indexed image X
,map
)X
with the colormap
map
. A colormap matrix can have any number of rows, but
it must have exactly 3 columns. Each row is interpreted as a color, with the
first element specifying the intensity of red, the second green, and the third
blue. Color intensity can be specified on the interval [0, 1].
imshow(___,
displays an image, using
name-value pairs to control aspects of the operation. Name,Value
)
returns
the image object created by himage
= imshow(___)imshow
.
To change the colormap after you create the image,
use the colormap
command. Specify the axes that
contains the image as the first input argument and the colormap you
want as the second input argument. For an example, see Change Colormap of Displayed Image.
You can display multiple images with different colormaps in the same figure
using imshow
with the tiledlayout
and nexttile
functions.
You can create an axes on top of the axes created by
imshow
by using the hold on
command
after calling imshow
.
If you have Image Processing Toolbox™, then you can use the Image Viewer app as an integrated environment for displaying images and performing common image processing tasks.
If you have Image Processing Toolbox, then you can set toolbox preferences that modify the behavior of
imshow
by using the iptsetpref
function.
The imshow
function is not supported
when you start MATLAB with the -nojvm
option.