Image Processing Toolbox User's Guide Previous page   Next Page
imshow

Display image

Syntax

Description

imshow(I) displays the grayscale image I.

imshow(I,[low high]) displays the grayscale image I, specifying the display range for I in [low high]. The value low (and any value less than low) displays as black; the value high (and any value greater than high) displays as white. Values in between are displayed as intermediate shades of gray, using the default number of gray levels. If you use an empty matrix ([]) for [low high], imshow uses [min(I(:)) max(I(:))]; that is, the minimum value in I is displayed as black, and the maximum value is displayed as white.

imshow(RGB) displays the truecolor image RGB.

imshow(BW) displays the binary image BW. imshow displays pixels with the value 0 (zero) as black and pixels with the value 1 as white.

imshow(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(filename) displays the image stored in the graphics file filename. The file must contain an image that can be read by imread or dicomread. imshow calls imread or dicomread to read the image from the file, but does not store the image data in the MATLAB workspace. If the file contains multiple images, the first one will be displayed. The file must be in the current directory or on the MATLAB path.

himage = imshow(...) returns the handle to the image object created by imshow.

imshow(...,param1,val1,param2,val2,...) displays the image, specifying parameters and corresponding values that control various aspects of the image display. The following table lists all imshow parameters. Parameter names can be abbreviated, and case does not matter..

Parameter
Value
'DisplayRange'
Two-element vector [LOW HIGH] that controls the display range of an intensity image. See above for more details about how to set [LOW HIGH].
Note: Including the parameter name is optional, except when the image is specified by a filename. The syntax imshow(I,[LOW HIGH]) is equivalent to imshow(I,'DisplayRange',[LOW HIGH]). However, the 'DisplayRange' parameter must be specified when calling imshow with a filename, for example imshow(filename,'DisplayRange'[LOW HIGH]).
'InitialMagnification'
Any scalar value, or the text string 'fit' that specifies the initial magnification used to display the image. When set to 100, imshow displays the image at 100% magnification (one screen pixel for each image pixel). When set to 'fit', imshow scales the entire image to fit in the window.
Initially, imshow always displays the entire image. If the magnification value is large enough that the image would be too big to display on the screen, imshow warns and displays the image at the largest magnification that fits on the screen.
By default, the initial magnification parameter is set to the value returned by iptgetpref('ImshowInitialMagnification').
'XData'
Two-element vector that establishes a nondefault spatial coordinate system by specifying the image XData. The value can have more than two elements, but only the first and last elements are actually used..
'YData'
Two-element vector that establishes a nondefault spatial coordinate system by specifying the image YData. The value can have more than two elements, but only the first and last elements are actually used..

Class Support

A truecolor image can be uint8, uint16, double, or single. An indexed image can be logical, uint8, double, or single. An intensity image can be logical, uint8, double, single, int16, or uint16. The input image must be nonsparse.

If your image is int16 or single, the CData in the resulting image object will be double. For all other classes, the CData matches the input image class..

Related Toolbox Preferences

You can use the iptsetpref function to set several toolbox preferences that modify the behavior of imshow.

For more information about these preferences, see iptsetpref.

Remarks

imshow is the toolbox's fundamental image display function, optimizing figure, axes, and image object property settings for image display. imtool provides all the image display capabilities of imshow but also provides access to several other tools for navigating and exploring images, such as the Pixel Region tool, Image Information tool, and the Adjust Contrast tool. imtool presents an integrated environment for displaying images and performing some common image processing tasks.

Examples

Display an image from a file

Display an indexed image

Display an intensity image

Display an intensity image, adjusting the diplay range

See Also

imread, imtool, iptgetpref, iptsetpref, subimage, truesize, warp

image, imagesc in the MATLAB Function Reference


Previous page  imscrollpanel imsubtract Next page

© 1994-2005 The MathWorks, Inc.