annotate doc/interpreter/image.txi @ 7018:fd42779a8428

[project @ 2007-10-13 00:52:12 by jwe]
author jwe
date Sat, 13 Oct 2007 00:52:13 +0000
parents c81a0f3f5a82
children e8d953d03f6a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6778
083721ae3dfa [project @ 2007-07-18 17:03:10 by jwe]
jwe
parents: 6535
diff changeset
1 @c Copyright (C) 1996, 1997, 2007 John W. Eaton
7018
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
2 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
3 @c This file is part of Octave.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
4 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
5 @c Octave is free software; you can redistribute it and/or modify it
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
6 @c under the terms of the GNU General Public License as published by the
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
7 @c Free Software Foundation; either version 3 of the License, or (at
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
8 @c your option) any later version.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
9 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
10 @c Octave is distributed in the hope that it will be useful, but WITHOUT
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
11 @c ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
12 @c FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
13 @c for more details.
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
14 @c
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
15 @c You should have received a copy of the GNU General Public License
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
16 @c along with Octave; see the file COPYING. If not, see
fd42779a8428 [project @ 2007-10-13 00:52:12 by jwe]
jwe
parents: 6788
diff changeset
17 @c <http://www.gnu.org/licenses/>.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
18
4167
aae05d51353c [project @ 2002-11-12 02:52:50 by jwe]
jwe
parents: 3803
diff changeset
19 @node Image Processing
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
20 @chapter Image Processing
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
21
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
22 Since an image basically is a matrix Octave is a very powerful
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
23 environment for processing and analysing images. To illustrate
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
24 how easy it is to do image processing in Octave, the following
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
25 example will load an image, smooth it by a 5-by-5 averaging filter,
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
26 and compute the gradient of the smoothed image.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
27
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
28 @example
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
29 I = loadimage ("default.img");
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
30 S = conv2 (I, ones (5, 5) / 25, "same");
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
31 [Dx, Dy] = gradient (S);
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
32 @end example
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
33
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
34 @noindent
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
35 In this example @code{S} contains the smoothed image, and @code{Dx}
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
36 and @code{Dy} contains the partial spatial derivatives of the image.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
37
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
38 @menu
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
39 * Loading and Saving Images::
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
40 * Displaying Images::
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
41 * Representing Images::
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
42 * Plotting on top of Images::
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
43 * Color Conversion::
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
44 @end menu
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
45
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
46 @node Loading and Saving Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
47 @section Loading and Saving Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
48
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
49 The first step in most image processing tasks is to load an image
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
50 into Octave. Currently Octave only support saving images in the
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
51 Portable Pixmap Format (PPM), PostScript, and Octave's own format, and
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
52 loading images in Octave's format. Most image processing code will
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
53 follow the structure of this code
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
54
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
55 @example
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
56 I = loadimage ("my_input_image.img");
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
57 J = process_my_image (I);
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
58 saveimage ("my_output_image.img", J);
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
59 @end example
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
60
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
61 @DOCSTRING(loadimage)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
62
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
63 @DOCSTRING(saveimage)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
64
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
65 @DOCSTRING(IMAGE_PATH)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
66
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
67 @node Displaying Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
68 @section Displaying Images
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
69
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
70 A natural part of image processing is visualization of an image.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
71 The most basic function for this is the @code{imshow} function that
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
72 shows the image given in the first input argument. This function uses
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
73 an external program to show the image. If gnuplot 4.2 or later is
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
74 available it will be used to display the image, otherwise the
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
75 @code{display}, @code{xv}, or @code{xloadimage} program is used. The
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
76 actual program can be selected with the @code{image_viewer} function.
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
77
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
78 @DOCSTRING(imshow)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
79
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
80 @DOCSTRING(image)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
81
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
82 @DOCSTRING(imagesc)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
83
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
84 @DOCSTRING(image_viewer)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
85
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
86 @node Representing Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
87 @section Representing Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
88
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
89 In general Octave supports four different kinds of images, gray-scale
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
90 images, RGB images, binary images, and indexed images. A gray-scale
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
91 image is represented with an M-by-N matrix in which each
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
92 element corresponds to the intensity of a pixel. An RGB image is
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
93 represented with an M-by-N-by3 array where each
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
94 3-vector corresponds to the red, green, and blue intensities of each
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
95 pixel.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
96
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
97 The actual meaning of the value of a pixel in a gray-scale or RGB
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
98 image depends on the class of the matrix. If the matrix is of class
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
99 @code{double} pixel intensities are between 0 and 1, if it is of class
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
100 @code{uint8} intensities are between 0 and 255, and if it is of class
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
101 @code{uint16} intensities are between 0 and 65535.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
102
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
103 A binary image is a M-by-N matrix of class @code{logical}.
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
104 A pixel in a binary image is black if it is @code{false} and white
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
105 if it is @code{true}.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
106
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
107 An indexed image consists of an M-by-N matrix of integers
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
108 and a C-by-3 color map. Each integer corresponds to an
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
109 index in the color map, and each row in the color map corresponds to
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
110 a RGB color. The color map must be of class @code{double} with values
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
111 between 0 and 1.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
112
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
113 @DOCSTRING(gray2ind)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
114
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
115 @DOCSTRING(ind2gray)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
116
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
117 @DOCSTRING(rgb2ind)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
118
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
119 @DOCSTRING(ind2rgb)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
120
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
121 @DOCSTRING(colormap)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
122
6788
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
123 @DOCSTRING(autumn)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
124
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
125 @DOCSTRING(bone)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
126
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
127 @DOCSTRING(cool)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
128
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
129 @DOCSTRING(copper)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
130
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
131 @DOCSTRING(gray)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
132
6788
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
133 @DOCSTRING(hot)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
134
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
135 @DOCSTRING(hsv)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
136
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
137 @DOCSTRING(jet)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
138
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
139 @DOCSTRING(ocean)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
140
6788
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
141 @DOCSTRING(pink)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
142
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
143 @DOCSTRING(prism)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
144
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
145 @DOCSTRING(rainbow)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
146
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
147 @DOCSTRING(spring)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
148
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
149 @DOCSTRING(summer)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
150
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
151 @DOCSTRING(white)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
152
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
153 @DOCSTRING(winter)
c81a0f3f5a82 [project @ 2007-07-23 22:05:29 by dbateman]
dbateman
parents: 6778
diff changeset
154
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
155 @node Plotting on top of Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
156 @section Plotting on top of Images
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
157
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
158 If gnuplot is being used to display images it is possible to plot on
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
159 top of images. Since an image is a matrix it is indexed by row and
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
160 column values. The plotting system is, however, based on the
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
161 traditional @math{(x, y)} system. To minimize the difference between
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
162 the two systems Octave places the origin of the coordinate system in
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
163 the point corresponding to the pixel at @math{(1, 1)}. So, to plot
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
164 points given by row and column values on top of an image, one should
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
165 simply call @code{plot} with the column values as the first argument
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
166 and the row values as the second. As an example the following code
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
167 generates an image with random intensities between 0 and 1, and shows
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
168 the image with red circles over pixels with an intensity above
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
169 @math{0.99}.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
170
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
171 @example
6535
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
172 I = rand (100, 100);
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
173 [row, col] = find (I > 0.99);
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
174 hold ("on");
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
175 imshow (I);
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
176 plot (col, row, "ro");
3ef1aa12f04c [project @ 2007-04-18 16:17:25 by jwe]
jwe
parents: 6529
diff changeset
177 hold ("off");
6529
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
178 @end example
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
179
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
180 @node Color Conversion
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
181 @section Color Conversion
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
182
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
183 Octave supports conversion from the RGB color system to NTSC and HSV
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
184 and vice versa.
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
185
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
186 @DOCSTRING(rgb2hsv)
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
187
853f99e292ec [project @ 2007-04-16 21:29:03 by jwe]
jwe
parents: 6502
diff changeset
188 @DOCSTRING(hsv2rgb)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
189
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
190 @DOCSTRING(rgb2ntsc)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
191
3373
36405da8e173 [project @ 1999-11-23 20:54:17 by jwe]
jwe
parents: 3294
diff changeset
192 @DOCSTRING(ntsc2rgb)
3294
bfe1573bd2ae [project @ 1999-10-19 10:06:07 by jwe]
jwe
parents:
diff changeset
193
3803
63c75bc3db82 [project @ 2001-02-28 08:24:40 by jwe]
jwe
parents: 3373
diff changeset
194