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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Displaying Images (GNU Octave (version 6.2.0))</title>
<meta name="description" content="Displaying Images (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Displaying Images (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Image-Processing.html" rel="up" title="Image Processing">
<link href="Representing-Images.html" rel="next" title="Representing Images">
<link href="Loading-and-Saving-Images.html" rel="prev" title="Loading and Saving Images">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<span id="Displaying-Images"></span><div class="header">
<p>
Next: <a href="Representing-Images.html" accesskey="n" rel="next">Representing Images</a>, Previous: <a href="Loading-and-Saving-Images.html" accesskey="p" rel="prev">Loading and Saving Images</a>, Up: <a href="Image-Processing.html" accesskey="u" rel="up">Image Processing</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Displaying-Images-1"></span><h3 class="section">32.2 Displaying Images</h3>
<p>A natural part of image processing is visualization of an image.
The most basic function for this is the <code>imshow</code> function that
shows the image given in the first input argument.
</p>
<span id="XREFimshow"></span><dl>
<dt id="index-imshow">: <em></em> <strong>imshow</strong> <em>(<var>im</var>)</em></dt>
<dt id="index-imshow-1">: <em></em> <strong>imshow</strong> <em>(<var>im</var>, <var>limits</var>)</em></dt>
<dt id="index-imshow-2">: <em></em> <strong>imshow</strong> <em>(<var>im</var>, <var>map</var>)</em></dt>
<dt id="index-imshow-3">: <em></em> <strong>imshow</strong> <em>(<var>rgb</var>, …)</em></dt>
<dt id="index-imshow-4">: <em></em> <strong>imshow</strong> <em>(<var>filename</var>)</em></dt>
<dt id="index-imshow-5">: <em></em> <strong>imshow</strong> <em>(…, <var>string_param1</var>, <var>value1</var>, …)</em></dt>
<dt id="index-imshow-6">: <em><var>h</var> =</em> <strong>imshow</strong> <em>(…)</em></dt>
<dd><p>Display the image <var>im</var>, where <var>im</var> can be a 2-dimensional
(grayscale image) or a 3-dimensional (RGB image) matrix.
</p>
<p>If <var>limits</var> is a 2-element vector <code>[<var>low</var>, <var>high</var>]</code>, the
image is shown using a display range between <var>low</var> and <var>high</var>. If
an empty matrix is passed for <var>limits</var>, the display range is computed
as the range between the minimal and the maximal value in the image.
</p>
<p>If <var>map</var> is a valid color map, the image will be shown as an indexed
image using the supplied color map.
</p>
<p>If a filename is given instead of an image, the file will be read and shown.
</p>
<p>If given, the parameter <var>string_param1</var> has value <var>value1</var>.
<var>string_param1</var> can be any of the following:
</p>
<dl compact="compact">
<dt><code>"displayrange"</code></dt>
<dd><p><var>value1</var> is the display range as described above.
</p>
</dd>
<dt><code>"colormap"</code></dt>
<dd><p><var>value1</var> is the colormap to use when displaying an indexed image.
</p>
</dd>
<dt><code>"xdata"</code></dt>
<dd><p>If <var>value1</var> is a 2-element vector, it must contain horizontal image
limits in the form [xfirst, xlast], where xfirst and xlast are the
abscissa of the centers of the corner pixels. Otherwise <var>value1</var>
must be a vector and only the first and last elements will be used
for xfirst and xlast respectively.
</p>
</dd>
<dt><code>"ydata"</code></dt>
<dd><p>If <var>value1</var> is a 2-element vector, it must contain vertical image
limits in the form [yfirst, ylast], where yfirst and ylast are the ordinates
of the center of the corner pixels. Otherwise <var>value1</var> must be a vector
and only the first and last elements will be used for yfirst and ylast
respectively.
</p>
</dd>
</dl>
<p>The optional return value <var>h</var> is a graphics handle to the image.
</p>
<p><strong>See also:</strong> <a href="#XREFimage">image</a>, <a href="#XREFimagesc">imagesc</a>, <a href="Representing-Images.html#XREFcolormap">colormap</a>, <a href="Representing-Images.html#XREFgray2ind">gray2ind</a>, <a href="Representing-Images.html#XREFrgb2ind">rgb2ind</a>.
</p></dd></dl>
<span id="XREFimage"></span><dl>
<dt id="index-image">: <em></em> <strong>image</strong> <em>(<var>img</var>)</em></dt>
<dt id="index-image-1">: <em></em> <strong>image</strong> <em>(<var>x</var>, <var>y</var>, <var>img</var>)</em></dt>
<dt id="index-image-2">: <em></em> <strong>image</strong> <em>(…, "<var>prop</var>", <var>val</var>, …)</em></dt>
<dt id="index-image-3">: <em></em> <strong>image</strong> <em>("<var>prop1</var>", <var>val1</var>, …)</em></dt>
<dt id="index-image-4">: <em><var>h</var> =</em> <strong>image</strong> <em>(…)</em></dt>
<dd><p>Display a matrix as an indexed color image.
</p>
<p>The elements of <var>img</var> are indices into the current colormap.
</p>
<p><var>x</var> and <var>y</var> are optional 2-element vectors, <code>[min, max]</code><!-- /@w -->,
which specify the coordinates of the centers of the corner pixels.
If a range is specified as <code>[max, min]</code><!-- /@w --> then the image will be
reversed along that axis. For convenience, <var>x</var> and <var>y</var> may be
specified as N-element vectors matching the length of the data in <var>img</var>.
However, only the first and last elements will be used to determine the axis
limits.
</p>
<p>Multiple property/value pairs may be specified for the image object, but
they must appear in pairs.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the image.
</p>
<p>Implementation Note: The origin (0, 0) for images is located in the
upper left. For ordinary plots, the origin is located in the lower
left. Octave handles this inversion by plotting the data normally,
and then reversing the direction of the y-axis by setting the
<code>ydir</code> property to <code>"reverse"</code>. This has implications whenever
an image and an ordinary plot need to be overlaid. The recommended
solution is to display the image and then plot the reversed ydata
using, for example, <code>flipud (ydata)</code>.
</p>
<p>Calling Forms: The <code>image</code> function can be called in two forms:
High-Level and Low-Level. When invoked with normal options, the High-Level
form is used which first calls <code>newplot</code> to prepare the graphic figure
and axes. When the only inputs to <code>image</code> are property/value pairs
the Low-Level form is used which creates a new instance of an image object
and inserts it in the current axes.
</p>
<p>Graphic Properties: The full list of properties is documented at
<a href="Image-Properties.html">Image Properties</a>.
</p>
<p><strong>See also:</strong> <a href="#XREFimshow">imshow</a>, <a href="#XREFimagesc">imagesc</a>, <a href="Representing-Images.html#XREFcolormap">colormap</a>.
</p></dd></dl>
<span id="XREFimagesc"></span><dl>
<dt id="index-imagesc">: <em></em> <strong>imagesc</strong> <em>(<var>img</var>)</em></dt>
<dt id="index-imagesc-1">: <em></em> <strong>imagesc</strong> <em>(<var>x</var>, <var>y</var>, <var>img</var>)</em></dt>
<dt id="index-imagesc-2">: <em></em> <strong>imagesc</strong> <em>(…, <var>climits</var>)</em></dt>
<dt id="index-imagesc-3">: <em></em> <strong>imagesc</strong> <em>(…, "<var>prop</var>", <var>val</var>, …)</em></dt>
<dt id="index-imagesc-4">: <em></em> <strong>imagesc</strong> <em>("<var>prop1</var>", <var>val1</var>, …)</em></dt>
<dt id="index-imagesc-5">: <em></em> <strong>imagesc</strong> <em>(<var>hax</var>, …)</em></dt>
<dt id="index-imagesc-6">: <em><var>h</var> =</em> <strong>imagesc</strong> <em>(…)</em></dt>
<dd><p>Display a scaled version of the matrix <var>img</var> as a color image.
</p>
<p>The colormap is scaled so that the entries of the matrix occupy the entire
colormap. If <code><var>climits</var> = [<var>lo</var>, <var>hi</var>]</code> is given, then
that range is set to the <code>"clim"</code> of the current axes.
</p>
<p><var>x</var> and <var>y</var> are optional 2-element vectors, <code>[min, max]</code><!-- /@w -->,
which specify the coordinates of the centers of the corner pixels.
If a range is specified as <code>[max, min]</code><!-- /@w --> then the image will be
reversed along that axis. For convenience, <var>x</var> and <var>y</var> may be
specified as N-element vectors matching the length of the data in <var>img</var>.
However, only the first and last elements will be used to determine
the image limits.
</p>
<p>The optional return value <var>h</var> is a graphics handle to the image.
</p>
<p>Calling Forms: The <code>imagesc</code> function can be called in two forms:
High-Level and Low-Level. When invoked with normal options, the High-Level
form is used which first calls <code>newplot</code> to prepare the graphic figure
and axes. When the only inputs to <code>image</code> are property/value pairs
the Low-Level form is used which creates a new instance of an image object
and inserts it in the current axes. The full list of properties is
documented at <a href="Image-Properties.html">Image Properties</a>.
</p>
<p><strong>See also:</strong> <a href="#XREFimage">image</a>, <a href="#XREFimshow">imshow</a>, <a href="Axis-Configuration.html#XREFcaxis">caxis</a>.
</p></dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Representing-Images.html" accesskey="n" rel="next">Representing Images</a>, Previous: <a href="Loading-and-Saving-Images.html" accesskey="p" rel="prev">Loading and Saving Images</a>, Up: <a href="Image-Processing.html" accesskey="u" rel="up">Image Processing</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|