To display images using these functions, you must be using Octave with
the X Window System, and you must have either xloadimage
or
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
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.
gray (n)
gray2ind
image
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
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
imshow (x)
displays an indexed image using the current
colormap.
imshow (x, map)
displays an indexed image using the
specified colormap.
imshow (i, n)
displays a gray scale intensity image.
imshow (r, g, b)
displays an RGB image.
ind2gray
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.
ind2rgb
[r, g, b] = ind2rgb (x)
uses the current
colormap for the conversion.
[r, g, b] = ind2rgb (x, map)
uses
the specified colormap.
loadimage
[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.
ocean (n)
rgb2ind
[x, map] = rgb2ind (r, g, b)
saveimage
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
loadimage.)
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.