Next: Representing Images, Previous: Loading and Saving Images, Up: Image Processing [Contents][Index]

### 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 (grayscale 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.

  `"xdata"`

    If value1 is a two element vector, it must contain horizontal axis limits in the form [xmin xmax]; Otherwise value1 must be a vector and only the first and last elements will be used for xmin and xmax respectively.

  `"ydata"`

    If value1 is a two element vector, it must contain vertical axis limits in the form [ymin ymax]; Otherwise value1 must be a vector and only the first and last elements will be used for ymin and ymax respectively.

  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: image (…, "prop", val, …)
Function File: image ("prop1", val1, …)
Function File: h = image (…)

  Display a matrix as an indexed color image.

  The elements of img are indices into the current colormap. x and y are optional 2-element vectors, `[min, max]`, which specify the range for the axis labels. If a range is specified as `[max, min]` then the image will be reversed along that axis. For convenience, x and y may be specified as N-element vectors matching the length of the data in img. However, only the first and last elements will be used to determine the axis limits. Warning: x and y are ignored when using gnuplot 4.0 or earlier.

  Multiple property/value pairs may be specified for the image object, but they must appear in pairs.

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

  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)`.

  Calling Forms: The `image` function can be called in two forms: High-Level and Low-Level. When invoked with normal options, the High-Level form is used which first calls `newplot` to prepare the graphic figure and axes. When the only inputs to `image` are property/value pairs the Low-Level form is used which creates a new instance of an image object and inserts it in the current axes.

  See also: imshow, imagesc, colormap.

Function File: imagesc (img)
Function File: imagesc (x, y, img)
Function File: imagesc (…, climits)
Function File: imagesc (…, "prop", val, …)
Function File: imagesc ("prop1", val1, …)
Function File: imagesc (hax, …)
Function File: h = imagesc (…)

  Display a scaled version of the matrix img as a color image. The colormap is scaled so that the entries of the matrix occupy the entire colormap. If `climits = [lo, hi]` is 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 img.

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

  Calling Forms: The `imagesc` function can be called in two forms: High-Level and Low-Level. When invoked with normal options, the High-Level form is used which first calls `newplot` to prepare the graphic figure and axes. When the only inputs to `image` are property/value pairs the Low-Level form is used which creates a new instance of an image object and inserts it in the current axes.

  See also: image, imshow, caxis.

Next: Representing Images, Previous: Loading and Saving Images, Up: Image Processing [Contents][Index]