### 32.2 Displaying Images

A natural part of image processing is visualization of an image. The most basic function for this is the `imshow` function that shows the image given in the first input argument.

— Function File: imshow (im)
— Function File: imshow (im, limits)
— Function File: imshow (im, map)
— Function File: imshow (rgb, ...)
— Function File: imshow (filename)
— Function File: imshow (..., string_param1, value1, ...)
— Function File: h = imshow (...)

> Display the image im, where im can be a 2-dimensional (gray-scale image) or a 3-dimensional (RGB image) matrix.

> If limits is a 2-element vector `[`low`,` high`]`, the image is shown using a display range between low and high. If an empty matrix is passed for limits, the display range is computed as the range between the minimal and the maximal value in the image.

> If map is a valid color map, the image will be shown as an indexed image using the supplied color map.

> If a file name is given instead of an image, the file will be read and shown.

> If given, the parameter string_param1 has value value1. string_param1 can be any of the following:

> "displayrange"
>   value1 is the display range as described above.

> The optional return value h is a graphics handle to the image.

> See also: image, imagesc, colormap, gray2ind, rgb2ind.

— Function File: image (img)
— Function File: image (x, y, img)
— Function File: h = image (...)

> Display a matrix as a color image. The elements of img are indices into the current colormap, and the colormap will be scaled so that the extremes of img are mapped to the extremes of the colormap.

> The axis values corresponding to the matrix elements are specified in x and y. If you're not using gnuplot 4.2 or later, these variables are ignored.

> Implementation Note: The origin (0, 0) for images is located in the upper left. For ordinary plots, the origin is located in the lower left. Octave handles this inversion by plotting the data normally, and then reversing the direction of the y-axis by setting the `ydir` property to `"reverse"`. This has implications whenever an image and an ordinary plot need to be overlaid. The recommended solution is to display the image and then plot the reversed ydata using, for example, `flipud (ydata,1)`.

> The optional return value h is a graphics handle to the image.

> See also: imshow, imagesc, colormap.

— Function File: imagesc (A)
— Function File: imagesc (x, y, A)
— Function File: imagesc (..., limits)
— Function File: imagesc (h, ...)
— Function File: h = imagesc (...)

> Display a scaled version of the matrix A as a color image. The colormap is scaled so that the entries of the matrix occupy the entire colormap. If limits = [lo, hi] are given, then that range is set to the 'clim' of the current axes.

> The axis values corresponding to the matrix elements are specified in x and y, either as pairs giving the minimum and maximum values for the respective axes, or as values for each row and column of the matrix A.

> The optional return value h is a graphics handle to the image.

> See also: image, imshow, caxis.