1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.51
from ./octave.texi on 18 June 1999 -->
<TITLE>GNU Octave - Image Processing</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_27.html">previous</A>, <A HREF="octave_29.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
<P><HR><P>
<H1><A NAME="SEC163" HREF="octave_toc.html#TOC163">Image Processing</A></H1>
<P>
Octave can display images with the X Window System using the
<CODE>xloadimage</CODE> program. 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.
</P>
<P>
Loading images only works with Octave's image format (a file with a
matrix containing the image data, and a matrix containing the
colormap). Contributions of robust, well-written functions to read
other image formats are welcome. If you can provide them, or would like
to improve Octave's image processing capabilities in other ways, please
contact @email{bug-octave@bevo.che.wisc.edu}.
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>colormap</B> <I>(<VAR>map</VAR>)</I>
<DD><A NAME="IDX814"></A>
<DT><U>Function File:</U> <B>colormap</B> <I>("default")</I>
<DD><A NAME="IDX815"></A>
Set the current colormap.
</P>
<P>
<CODE>colormap (<VAR>map</VAR>)</CODE> sets the current colormap to <VAR>map</VAR>. The
color map should be an <VAR>n</VAR> 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.
</P>
<P>
<CODE>colormap ("default")</CODE> restores the default colormap (a gray scale
colormap with 64 entries). The default colormap is returned.
</P>
<P>
With no arguments, <CODE>colormap</CODE> returns the current color map.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>gray</B> <I>(<VAR>n</VAR>)</I>
<DD><A NAME="IDX816"></A>
Return a gray colormap with <VAR>n</VAR> entries corresponding to values from
0 to <VAR>n</VAR>. The argument <VAR>n</VAR> should be a scalar. If it is
omitted, 64 is assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>img</VAR>, <VAR>map</VAR>] = <B>gray2ind</B> <I>(<VAR></VAR>)</I>
<DD><A NAME="IDX817"></A>
Convert a gray scale intensity image to an Octave indexed image.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>image</B> <I>(<VAR>x</VAR>, <VAR>zoom</VAR>)</I>
<DD><A NAME="IDX818"></A>
Display a matrix as a color image. The elements of <VAR>x</VAR> are indices
into the current colormap and should have values between 1 and the
length of the colormap. If <VAR>zoom</VAR> is omitted, a value of 4 is
assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>imagesc</B> <I>(<VAR>x</VAR>, <VAR>zoom</VAR>)</I>
<DD><A NAME="IDX819"></A>
Display a scaled version of the matrix <VAR>x</VAR> as a color image. The
matrix is scaled so that its entries are indices into the current
colormap. The scaled matrix is returned. If <VAR>zoom</VAR> is omitted, a
value of 4 is assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>imshow</B> <I>(<VAR>x</VAR>, <VAR>map</VAR>)</I>
<DD><A NAME="IDX820"></A>
<DT><U>Function File:</U> <B>imshow</B> <I>(<VAR>x</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX821"></A>
<DT><U>Function File:</U> <B>imshow</B> <I>(<VAR>i</VAR>, <VAR>n</VAR>)</I>
<DD><A NAME="IDX822"></A>
<DT><U>Function File:</U> <B>imshow</B> <I>(<VAR>r</VAR>, <VAR>g</VAR>, <VAR>b</VAR>)</I>
<DD><A NAME="IDX823"></A>
Display images.
</P>
<P>
<CODE>imshow (<VAR>x</VAR>)</CODE> displays an indexed image using the current
colormap.
</P>
<P>
<CODE>imshow (<VAR>x</VAR>, <VAR>map</VAR>)</CODE> displays an indexed image using the
specified colormap.
</P>
<P>
<CODE>imshow (<VAR>i</VAR>, <VAR>n</VAR>)</CODE> displays a gray scale intensity image.
</P>
<P>
<CODE>imshow (<VAR>r</VAR>, <VAR>g</VAR>, <VAR>b</VAR>)</CODE> displays an RGB image.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>ind2gray</B> <I>(<VAR>x</VAR>, <VAR>map</VAR>)</I>
<DD><A NAME="IDX824"></A>
Convert an Octave indexed image to a gray scale intensity image.
If <VAR>map</VAR> is omitted, the current colormap is used to determine the
intensities.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>r</VAR>, <VAR>g</VAR>, <VAR>b</VAR>] = <B>ind2rgb</B> <I>(<VAR>x</VAR>, <VAR>map</VAR>)</I>
<DD><A NAME="IDX825"></A>
Convert an indexed image to red, green, and blue color components.
If <VAR>map</VAR> is omitted, the current colormap is used for the conversion.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>x</VAR>, <VAR>map</VAR>] = <B>loadimage</B> <I>(<VAR>file</VAR>)</I>
<DD><A NAME="IDX826"></A>
Load an image file and it's associated color map from the specified
<VAR>file</VAR>. The image must be stored in Octave's image format.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>rgb2ntsc</B> <I>(<VAR>rgb</VAR>)</I>
<DD><A NAME="IDX827"></A>
Image format conversion.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>ntsc2rgb</B> <I>(<VAR>yiq</VAR>)</I>
<DD><A NAME="IDX828"></A>
Image format conversion.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>ocean</B> <I>(<VAR>n</VAR>)</I>
<DD><A NAME="IDX829"></A>
Create color colormap. The argument <VAR>n</VAR> should be a scalar. If it
is omitted, 64 is assumed.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> [<VAR>x</VAR>, <VAR>map</VAR>] = <B>rgb2ind</B> <I>(<VAR>r</VAR>, <VAR>g</VAR>, <VAR>b</VAR>)</I>
<DD><A NAME="IDX830"></A>
Convert and RGB image to an Octave indexed image.
</DL>
</P>
<P>
<DL>
<DT><U>Function File:</U> <B>saveimage</B> <I>(<VAR>file</VAR>, <VAR>x</VAR>, <VAR>fmt</VAR>, <VAR>map</VAR>)</I>
<DD><A NAME="IDX831"></A>
Save the matrix <VAR>x</VAR> to <VAR>file</VAR> in image format <VAR>fmt</VAR>. Valid
values for <VAR>fmt</VAR> are
</P>
<DL COMPACT>
<DT><CODE>"img"</CODE>
<DD>
Octave's image format. The current colormap is also saved in the file.
<DT><CODE>"ppm"</CODE>
<DD>
Portable pixmap format.
<DT><CODE>"ps"</CODE>
<DD>
PostScript format. Note that images saved in PostScript format can not
be read back into Octave with loadimage.
</DL>
<P>
If the fourth argument is supplied, the specified colormap will also be
saved along with the image.
</P>
<P>
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.
</DL>
</P>
<P>
<DL>
<DT><U>Built-in Variable:</U> <B>IMAGEPATH</B>
<DD><A NAME="IDX832"></A>
A colon separated list of directories in which to search for image
files.
</DL>
</P>
<P><HR><P>
Go to the <A HREF="octave_1.html">first</A>, <A HREF="octave_27.html">previous</A>, <A HREF="octave_29.html">next</A>, <A HREF="octave_40.html">last</A> section, <A HREF="octave_toc.html">table of contents</A>.
</BODY>
</HTML>
|