imshow() - Image Processing
exampleimshow(I) displays
the image I in a Handle Graphics® figure, where I is
a grayscale, RGB (truecolor), or binary image. For binary images, imshow displays
pixels with the value 0 (zero) as black and 1 as
white.
exampleimshow(I,RI) displays
the image I with associated 2-D spatial referencing
object RI.
exampleimshow(X,map) displays
the indexed image X with the colormap map.
A color map matrix may 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 light, the second green, and the
third blue. Color intensity can be specified on the interval 0.0 to
1.0.
imshow(X,RX,map) displays
the indexed image X with associated 2-D spatial
referencing object RX and colormap MAP.
exampleimshow(filename) displays
the image stored in the graphics file specified by the text string filename.
imshow(___,Name,Value...) displays
the image, specifying additional options with one or more Name,Value pair
arguments, using any of the previous syntaxes.
exampleimshow(gpuarrayIM,___) displays
the image contained in a gpuArray. This syntax
requires the Parallel Computing Toolbox™.
exampleimshow(I,[low high]) displays
the grayscale image I, specifying the display range
as a two-element vector, [low high]. For more information,
see theDisplayRange parameter.
imshow(___,Name,Value,...) displays an
image, using name-value pairs to control aspects of the operation.
himage = imshow(___) returns
the handle to the image object created by imshow.
Syntax
imshow(I) exampleimshow(I,RI) exampleimshow(X,map) exampleimshow(X,RX,map)imshow(filename) exampleimshow(___,Name,Value...)imshow(gpuarrayIM,___) exampleimshow(I,[low high]) exampleimshow(___,Name,Value,...)himage = imshow(___)
Example
Display image from fileSpecify image file.imshow('board.tif')Display indexed imageRead indexed image and associated color map from file
and display it.[X,map] = imread('trees.tif');
imshow(X,map)Display grayscale imageRead grayscale image from file and display it.I = imread('cameraman.tif');
imshow(I)Display grayscale image, adjusting display rangeRead grayscale image and specify display range.I = imread('cameraman.tif');
h = imshow(I,[0 80]);Display grayscale image using associated spatial referencing objectRead image into workspace.I = imread('pout.tif');
Create a spatial referencing object associated with the
image. Then specify X and Y limits
in a world coordinate system.RI = imref2d(size(I));
RI.XWorldLimits = [0 3];
RI.YWorldLimits = [2 5];
Display the image, specifying the spatial referencing
object.imshow(I,RI);Display Image on a GPURead image into a gpuArray.X = gpuArray(imread('pout.tif'));
Display it.figure; imshow(X)
Output / Return Value
Limitations
Alternatives / See Also
Reference