To display images using these functions, you must be using Octave with
the X Window System, and you must have either
xv installed. You do not need to be running X in order to
manipulate images, however, so some of these functions may be useful
even if you are not able to view the results.
colormap (map) sets the current colormap to map. The
color map should be an n row by 3 column matrix. The columns
contain red, green, and blue intensities respectively. All entries
should be between 0 and 1 inclusive. The new colormap is returned.
colormap ("default") restores the default colormap (a gray scale
colormap with 64 entries). The default colormap is returned.
With no arguments,
colormap returns the current color map.
image (x) displays a matrix as a color image. The elements
of x are indices into the current colormap and should have values
between 1 and the length of the colormap.
image (x, zoom) changes the zoom factor. The default
value is 4.
imagesc (x) displays a scaled version of the matrix
x. The matrix is scaled so that its entries are indices into the
current colormap. The scaled matrix is returned.
imagesc (x, zoom) sets the magnification, the default
value is 4.
imshow (x) displays an indexed image using the current
imshow (x, map) displays an indexed image using the
imshow (i, n) displays a gray scale intensity image.
imshow (r, g, b) displays an RGB image.
y = ind2gray (x) converts an indexed image to a gray
scale intensity image. The current colormap is used to determine the
intensities. The intensity values lie between 0 and 1 inclusive.
y = ind2gray (x, map) uses the specified
colormap instead of the current one in the conversion process.
[r, g, b] = ind2rgb (x) uses the current
colormap for the conversion.
[r, g, b] = ind2rgb (x, map) uses
the specified colormap.
[x, map] = loadimage (file) loads an image and
it's associated color map from the specified file. The image must
be stored in Octave's image format.
[x, map] = rgb2ind (r, g, b)
saveimage (file, x) saves matrix x to file
in Octave's image format. The current colormap is also saved in the file.
saveimage (file, x, "img") saves the image in the
default format and is the same as
saveimage (file, x).
saveimage (file, x, "ppm") saves the image in ppm
format instead of the default Octave image format.
saveimage (file, x, "ps") saves the image in
PostScript format instead of the default Octave image format. (Note:
images saved in PostScript format can not be read back into Octave with
saveimage (file, x, fmt, map) saves the
image along with the specified colormap in the specified format.
Note: if the colormap contains only two entries and these entries are black and white, the bitmap ppm and PostScript formats are used. If the image is a gray scale image (the entries within each row of the colormap are equal) the gray scale ppm and PostScript image formats are used, otherwise the full color formats are used.
Go to the first, previous, next, last section, table of contents.