GNU Octave Manual Version 3 by John W. Eaton, David Bateman, Søren Hauberg Paperback (6"x9"), 568 pages ISBN 095461206X RRP £24.95 ($39.95) |
30.4 Plotting on top of Images
If gnuplot is being used to display images it is possible to plot on
top of images. Since an image is a matrix it is indexed by row and
column values. The plotting system is, however, based on the
traditional (x, y) system. To minimize the difference between
the two systems Octave places the origin of the coordinate system in
the point corresponding to the pixel at (1, 1). So, to plot
points given by row and column values on top of an image, one should
simply call plot
with the column values as the first argument
and the row values as the second. As an example the following code
generates an image with random intensities between 0 and 1, and shows
the image with red circles over pixels with an intensity above
0.99.
I = rand (100, 100); [row, col] = find (I > 0.99); hold ("on"); imshow (I); plot (col, row, "ro"); hold ("off");
ISBN 095461206X | GNU Octave Manual Version 3 | See the print edition |