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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Octave: Representing Images</title>
<meta name="description" content="GNU Octave: Representing Images">
<meta name="keywords" content="GNU Octave: Representing Images">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Image-Processing.html#Image-Processing" rel="up" title="Image Processing">
<link href="Plotting-on-top-of-Images.html#Plotting-on-top-of-Images" rel="next" title="Plotting on top of Images">
<link href="Displaying-Images.html#Displaying-Images" rel="prev" title="Displaying Images">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {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}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Representing-Images"></a>
<div class="header">
<p>
Next: <a href="Plotting-on-top-of-Images.html#Plotting-on-top-of-Images" accesskey="n" rel="next">Plotting on top of Images</a>, Previous: <a href="Displaying-Images.html#Displaying-Images" accesskey="p" rel="prev">Displaying Images</a>, Up: <a href="Image-Processing.html#Image-Processing" 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#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Representing-Images-1"></a>
<h3 class="section">32.3 Representing Images</h3>
<p>In general Octave supports four different kinds of images, grayscale
images, RGB images, binary images, and indexed images. A grayscale
image is represented with an M-by-N matrix in which each
element corresponds to the intensity of a pixel. An RGB image is
represented with an M-by-N-by-3 array where each
3-vector corresponds to the red, green, and blue intensities of each
pixel.
</p>
<p>The actual meaning of the value of a pixel in a grayscale or RGB
image depends on the class of the matrix. If the matrix is of class
<code>double</code> pixel intensities are between 0 and 1, if it is of class
<code>uint8</code> intensities are between 0 and 255, and if it is of class
<code>uint16</code> intensities are between 0 and 65535.
</p>
<p>A binary image is an M-by-N matrix of class <code>logical</code>.
A pixel in a binary image is black if it is <code>false</code> and white
if it is <code>true</code>.
</p>
<p>An indexed image consists of an M-by-N matrix of integers
and a C-by-3 color map. Each integer corresponds to an
index in the color map, and each row in the color map corresponds to
an RGB color. The color map must be of class <code>double</code> with values
between 0 and 1.
</p>
<a name="XREFiscolormap"></a><dl>
<dt><a name="index-iscolormap"></a>Function File: <em></em> <strong>iscolormap</strong> <em>(<var>cmap</var>)</em></dt>
<dd><p>Return true if <var>cmap</var> is a colormap.
</p>
<p>A colormap is a real matrix with <var>n</var> rows and 3 columns.
Each row represents a single color. The columns contain red, green,
and blue intensities respectively. All entries must be between 0 and 1
inclusive.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>, <a href="#XREFrgbplot">rgbplot</a>.
</p></dd></dl>
<a name="XREFgray2ind"></a><dl>
<dt><a name="index-gray2ind"></a>Function File: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>I</var>)</em></dt>
<dt><a name="index-gray2ind-1"></a>Function File: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>I</var>, <var>n</var>)</em></dt>
<dt><a name="index-gray2ind-2"></a>Function File: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>BW</var>)</em></dt>
<dt><a name="index-gray2ind-3"></a>Function File: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>BW</var>, <var>n</var>)</em></dt>
<dt><a name="index-gray2ind-4"></a>Function File: <em>[<var>img</var>, <var>map</var>] =</em> <strong>gray2ind</strong> <em>(…)</em></dt>
<dd><p>Convert a grayscale or binary intensity image to an indexed image.
</p>
<p>The indexed image will consist of <var>n</var> different intensity values.
If not given <var>n</var> defaults to 64 for grayscale images or 2 for
binary black and white images.
</p>
<p>The output <var>img</var> is of class uint8 if <var>n</var> is less than or
equal to 256; Otherwise the return class is uint16.
</p>
<p><strong>See also:</strong> <a href="#XREFind2gray">ind2gray</a>, <a href="#XREFrgb2ind">rgb2ind</a>.
</p></dd></dl>
<a name="XREFind2gray"></a><dl>
<dt><a name="index-ind2gray"></a>Function File: <em><var>I</var> =</em> <strong>ind2gray</strong> <em>(<var>x</var>, <var>map</var>)</em></dt>
<dd><p>Convert a color indexed image to a grayscale intensity image.
</p>
<p>The image <var>x</var> must be an indexed image which will be converted using the
colormap <var>cmap</var>. If <var>cmap</var> does not contain enough colors for the
image, pixels in <var>x</var> outside the range are mapped to the last color in
the map before conversion to grayscale.
</p>
<p>The output <var>I</var> is of the same class as the input <var>x</var> and may be
one of <code>uint8</code>, <code>uint16</code>, <code>single</code>, or <code>double</code>.
</p>
<p>Implementation Note: There are several ways of converting colors to
grayscale intensities. This functions uses the luminance value obtained
from <code>rgb2ntsc</code> which is <code>I = 0.299*R + 0.587*G + 0.114*B</code>.
Other possibilities include the value component from <code>rgb2hsv</code> or
using a single color channel from <code>ind2rgb</code>.
</p>
<p><strong>See also:</strong> <a href="#XREFgray2ind">gray2ind</a>, <a href="#XREFind2rgb">ind2rgb</a>.
</p></dd></dl>
<a name="XREFrgb2ind"></a><dl>
<dt><a name="index-rgb2ind"></a>Function File: <em>[<var>x</var>, <var>map</var>] =</em> <strong>rgb2ind</strong> <em>(<var>rgb</var>)</em></dt>
<dt><a name="index-rgb2ind-1"></a>Function File: <em>[<var>x</var>, <var>map</var>] =</em> <strong>rgb2ind</strong> <em>(<var>R</var>, <var>G</var>, <var>B</var>)</em></dt>
<dd><p>Convert an image in red-green-blue (RGB) color space to an indexed image.
</p>
<p>The input image <var>rgb</var> can be specified as a single matrix of size
MxNx3, or as three separate variables, <var>R</var>, <var>G</var>, and
<var>B</var>, its three colour channels, red, green, and blue.
</p>
<p>It outputs an indexed image <var>x</var> and a colormap <var>map</var> to interpret
an image exactly the same as the input. No dithering or other form of color
quantization is performed. The output class of the indexed image <var>x</var>
can be uint8, uint16 or double, whichever is required to specify the
number of unique colors in the image (which will be equal to the number
of rows in <var>map</var>) in order
</p>
<p>Multi-dimensional indexed images (of size MxNx3xK) are also
supported, both via a single input (<var>rgb</var>) or its three colour channels
as separate variables.
</p>
<p><strong>See also:</strong> <a href="#XREFind2rgb">ind2rgb</a>, <a href="Color-Conversion.html#XREFrgb2hsv">rgb2hsv</a>, <a href="Color-Conversion.html#XREFrgb2ntsc">rgb2ntsc</a>.
</p></dd></dl>
<a name="XREFind2rgb"></a><dl>
<dt><a name="index-ind2rgb"></a>Function File: <em><var>rgb</var> =</em> <strong>ind2rgb</strong> <em>(<var>x</var>, <var>map</var>)</em></dt>
<dt><a name="index-ind2rgb-1"></a>Function File: <em>[<var>R</var>, <var>G</var>, <var>B</var>] =</em> <strong>ind2rgb</strong> <em>(<var>x</var>, <var>map</var>)</em></dt>
<dd><p>Convert an indexed image to red, green, and blue color components.
</p>
<p>The image <var>x</var> must be an indexed image which will be converted using the
colormap <var>map</var>. If <var>map</var> does not contain enough colors for the
image, pixels in <var>x</var> outside the range are mapped to the last color in
the map.
</p>
<p>The output may be a single RGB image (MxNx3 matrix where M and N
are the original image <var>x</var> dimensions, one for each of the red, green
and blue channels). Alternatively, the individual red, green, and blue
color matrices of size MxN may be returned.
</p>
<p>Multi-dimensional indexed images (of size MxNx1xK) are also
supported.
</p>
<p><strong>See also:</strong> <a href="#XREFrgb2ind">rgb2ind</a>, <a href="#XREFind2gray">ind2gray</a>, <a href="Color-Conversion.html#XREFhsv2rgb">hsv2rgb</a>, <a href="Color-Conversion.html#XREFntsc2rgb">ntsc2rgb</a>.
</p></dd></dl>
<a name="XREFcolormap"></a><dl>
<dt><a name="index-colormap"></a>Function File: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>()</em></dt>
<dt><a name="index-colormap-1"></a>Function File: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<var>map</var>)</em></dt>
<dt><a name="index-colormap-2"></a>Function File: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>("default")</em></dt>
<dt><a name="index-colormap-3"></a>Function File: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>("<var>map_name</var>")</em></dt>
<dt><a name="index-colormap-4"></a>Function File: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<var>hax</var>, …)</em></dt>
<dt><a name="index-colormap-5"></a>Command: <em></em> <strong>colormap</strong> <em><var>map_name</var></em></dt>
<dt><a name="index-colormap-6"></a>Function File: <em><var>cmaps</var> =</em> <strong>colormap</strong> <em>("list")</em></dt>
<dt><a name="index-colormap-7"></a>Function File: <em></em> <strong>colormap</strong> <em>("register", "<var>name</var>")</em></dt>
<dt><a name="index-colormap-8"></a>Function File: <em></em> <strong>colormap</strong> <em>("unregister", "<var>name</var>")</em></dt>
<dd><p>Query or set the current colormap.
</p>
<p>With no input arguments, <code>colormap</code> returns the current color map.
</p>
<p><code>colormap (<var>map</var>)</code> sets the current colormap to <var>map</var>. The
colormap should be an <var>n</var> row by 3 column matrix. The columns
contain red, green, and blue intensities respectively. All entries
must be between 0 and 1 inclusive. The new colormap is returned.
</p>
<p><code>colormap ("default")</code> restores the default colormap (the
<code>jet</code> map with 64 entries). The default colormap is returned.
</p>
<p>The map may also be specified by a string, <code>"<var>map_name</var>"</code>, where
<var>map_name</var> is the name of a function that returns a colormap.
</p>
<p>If the first argument <var>hax</var> is an axes handle, then the colormap for
the parent figure of <var>hax</var> is queried or set.
</p>
<p>For convenience, it is also possible to use this function with the
command form, <code>colormap <var>map_name</var></code>.
</p>
<p><code>colormap ("list")</code> returns a cell array with all of the available
colormaps. The options <code>"register"</code> and <code>"unregister"</code>
add or remove the colormap <var>name</var> from this list.
</p>
<p><strong>See also:</strong> <a href="#XREFjet">jet</a>.
</p></dd></dl>
<a name="XREFrgbplot"></a><dl>
<dt><a name="index-rgbplot"></a>Function File: <em></em> <strong>rgbplot</strong> <em>(<var>cmap</var>)</em></dt>
<dt><a name="index-rgbplot-1"></a>Function File: <em></em> <strong>rgbplot</strong> <em>(<var>cmap</var>, <var>style</var>)</em></dt>
<dt><a name="index-rgbplot-2"></a>Function File: <em><var>h</var> =</em> <strong>rgbplot</strong> <em>(…)</em></dt>
<dd><p>Plot the components of a colormap.
</p>
<p>Two different <var>style</var>s are available for displaying the <var>cmap</var>:
</p>
<dl compact="compact">
<dt>profile (default)</dt>
<dd><p>Plot the RGB line profile of the colormap for each of the channels (red,
green and blue) with the plot lines colored appropriately. Each line
represents the intensity of each RGB components across the colormap.
</p>
</dd>
<dt>composite</dt>
<dd><p>Draw the colormap across the X-axis so that the actual index colors are
visible rather than the individual color components.
</p>
</dd>
</dl>
<p>The optional return value <var>h</var> is a graphics handle to the created plot.
</p>
<p>Run <code>demo rgbplot</code> to see an example of <code>rgbplot</code> and each style
option.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFautumn"></a><dl>
<dt><a name="index-autumn"></a>Function File: <em><var>map</var> =</em> <strong>autumn</strong> <em>()</em></dt>
<dt><a name="index-autumn-1"></a>Function File: <em><var>map</var> =</em> <strong>autumn</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap ranges from red through orange
to yellow.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFbone"></a><dl>
<dt><a name="index-bone"></a>Function File: <em><var>map</var> =</em> <strong>bone</strong> <em>()</em></dt>
<dt><a name="index-bone-1"></a>Function File: <em><var>map</var> =</em> <strong>bone</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from black to white with
gray-blue shades.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFcolorcube"></a><dl>
<dt><a name="index-colorcube"></a>Function File: <em><var>map</var> =</em> <strong>colorcube</strong> <em>()</em></dt>
<dt><a name="index-colorcube-1"></a>Function File: <em><var>map</var> =</em> <strong>colorcube</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap is composed of as many equally
spaced colors (not grays) in the RGB color space as possible. If there
are not a perfect number <var>n</var> of regularly spaced colors then the
remaining entries in the colormap are gradients of pure red, green, blue,
and gray.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFcool"></a><dl>
<dt><a name="index-cool"></a>Function File: <em><var>map</var> =</em> <strong>cool</strong> <em>()</em></dt>
<dt><a name="index-cool-1"></a>Function File: <em><var>map</var> =</em> <strong>cool</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. The colormap varies from cyan to magenta.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFcopper"></a><dl>
<dt><a name="index-copper"></a>Function File: <em><var>map</var> =</em> <strong>copper</strong> <em>()</em></dt>
<dt><a name="index-copper-1"></a>Function File: <em><var>map</var> =</em> <strong>copper</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from black to
a light copper tone.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFflag"></a><dl>
<dt><a name="index-flag"></a>Function File: <em><var>map</var> =</em> <strong>flag</strong> <em>()</em></dt>
<dt><a name="index-flag-1"></a>Function File: <em><var>map</var> =</em> <strong>flag</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap cycles through red, white, blue,
and black with each index change.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFgray"></a><dl>
<dt><a name="index-gray"></a>Function File: <em><var>map</var> =</em> <strong>gray</strong> <em>()</em></dt>
<dt><a name="index-gray-1"></a>Function File: <em><var>map</var> =</em> <strong>gray</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create gray colormap. This colormap varies from black to white with
shades of gray.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFhot"></a><dl>
<dt><a name="index-hot"></a>Function File: <em><var>map</var> =</em> <strong>hot</strong> <em>()</em></dt>
<dt><a name="index-hot-1"></a>Function File: <em><var>map</var> =</em> <strong>hot</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap ranges from black through dark red,
red, orange, yellow, to white.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFhsv"></a><dl>
<dt><a name="index-hsv"></a>Function File: <em></em> <strong>hsv</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap begins with red, changes through
yellow, green, cyan, blue, and magenta, before returning to red.
It is useful for displaying periodic functions. The map is obtained by
linearly varying the hue through all possible values while keeping constant
maximum saturation and value. The equivalent code is
<code>hsv2rgb ([(0:N-1)'/N, ones(N,2)])</code>.
</p>
<p>The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFjet"></a><dl>
<dt><a name="index-jet"></a>Function File: <em><var>map</var> =</em> <strong>jet</strong> <em>()</em></dt>
<dt><a name="index-jet-1"></a>Function File: <em><var>map</var> =</em> <strong>jet</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap ranges from dark blue through blue,
cyan, green, yellow, red, to dark red.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFlines"></a><dl>
<dt><a name="index-lines"></a>Function File: <em><var>map</var> =</em> <strong>lines</strong> <em>()</em></dt>
<dt><a name="index-lines-1"></a>Function File: <em><var>map</var> =</em> <strong>lines</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap is composed of the list of colors
in the current axes <code>"ColorOrder"</code> property. The default is blue,
green, red, cyan, pink, yellow, and gray.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFocean"></a><dl>
<dt><a name="index-ocean"></a>Function File: <em><var>map</var> =</em> <strong>ocean</strong> <em>()</em></dt>
<dt><a name="index-ocean-1"></a>Function File: <em><var>map</var> =</em> <strong>ocean</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from black to white with shades
of blue.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFpink"></a><dl>
<dt><a name="index-pink"></a>Function File: <em><var>map</var> =</em> <strong>pink</strong> <em>()</em></dt>
<dt><a name="index-pink-1"></a>Function File: <em><var>map</var> =</em> <strong>pink</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from black to white with
shades of gray-pink. It gives a sepia tone when used on grayscale images.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFprism"></a><dl>
<dt><a name="index-prism"></a>Function File: <em><var>map</var> =</em> <strong>prism</strong> <em>()</em></dt>
<dt><a name="index-prism-1"></a>Function File: <em><var>map</var> =</em> <strong>prism</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap cycles through red, orange, yellow,
green, blue and violet with each index change.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFrainbow"></a><dl>
<dt><a name="index-rainbow"></a>Function File: <em><var>map</var> =</em> <strong>rainbow</strong> <em>()</em></dt>
<dt><a name="index-rainbow-1"></a>Function File: <em><var>map</var> =</em> <strong>rainbow</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap ranges from red through orange,
yellow, green, blue, to violet.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFspring"></a><dl>
<dt><a name="index-spring"></a>Function File: <em><var>map</var> =</em> <strong>spring</strong> <em>()</em></dt>
<dt><a name="index-spring-1"></a>Function File: <em><var>map</var> =</em> <strong>spring</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from magenta to yellow.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFsummer"></a><dl>
<dt><a name="index-summer"></a>Function File: <em><var>map</var> =</em> <strong>summer</strong> <em>()</em></dt>
<dt><a name="index-summer-1"></a>Function File: <em><var>map</var> =</em> <strong>summer</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from green to yellow.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFwhite"></a><dl>
<dt><a name="index-white"></a>Function File: <em><var>map</var> =</em> <strong>white</strong> <em>()</em></dt>
<dt><a name="index-white-1"></a>Function File: <em><var>map</var> =</em> <strong>white</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap is completely white.
The argument <var>n</var> should be a scalar. If it
is omitted, the length of the current colormap or 64 is assumed.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFwinter"></a><dl>
<dt><a name="index-winter"></a>Function File: <em><var>map</var> =</em> <strong>winter</strong> <em>()</em></dt>
<dt><a name="index-winter-1"></a>Function File: <em><var>map</var> =</em> <strong>winter</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. This colormap varies from blue to green.
The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFcontrast"></a><dl>
<dt><a name="index-contrast"></a>Function File: <em><var>cmap</var> =</em> <strong>contrast</strong> <em>(<var>x</var>)</em></dt>
<dt><a name="index-contrast-1"></a>Function File: <em><var>cmap</var> =</em> <strong>contrast</strong> <em>(<var>x</var>, <var>n</var>)</em></dt>
<dd><p>Return a gray colormap that maximizes the contrast in an image. The
returned colormap will have <var>n</var> rows. If <var>n</var> is not defined
then the size of the current colormap is used.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>, <a href="#XREFbrighten">brighten</a>.
</p></dd></dl>
<p>An additional colormap is <code>gmap40</code>. This code map contains only
colors with integer values of the red, green and blue components. This
is a workaround for a limitation of gnuplot 4.0, that does not allow the color
of line or patch objects to be set. <code>gmap40</code> is chiefly useful to gnuplot
4.0 users, and particularly in conjunction with the <var>bar</var>, <var>surf</var>,
and <var>contour</var> functions.
</p>
<a name="XREFgmap40"></a><dl>
<dt><a name="index-gmap40"></a>Function File: <em><var>map</var> =</em> <strong>gmap40</strong> <em>()</em></dt>
<dt><a name="index-gmap40-1"></a>Function File: <em><var>map</var> =</em> <strong>gmap40</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap. The colormap consists of red, green, blue, yellow,
magenta and cyan. This colormap is specifically designed for users of
gnuplot 4.0 where these 6 colors are the allowable ones for patch objects.
The argument <var>n</var> must be a scalar.
If unspecified, a length of 6 is assumed. Larger values of <var>n</var> result
in a repetition of the above colors.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<p>The following three functions modify the existing colormap rather than
replace it.
</p>
<a name="XREFbrighten"></a><dl>
<dt><a name="index-brighten"></a>Function File: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>map</var>, <var>beta</var>)</em></dt>
<dt><a name="index-brighten-1"></a>Function File: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>beta</var>)</em></dt>
<dt><a name="index-brighten-2"></a>Function File: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>h</var>, <var>beta</var>)</em></dt>
<dd><p>Brighten or darken a colormap. If the <var>map</var> argument is omitted, the
function is applied to the current colormap. The first argument can also be
a valid graphics handle <var>h</var>, in which case <code>brighten</code> is applied to
the colormap associated with this handle.
</p>
<p>The argument <var>beta</var> must be a scalar between -1 and 1, where a
negative value darkens and a positive value brightens the colormap.
</p>
<p>If no output is specified then the result is written to the current colormap.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>, <a href="#XREFcontrast">contrast</a>.
</p></dd></dl>
<a name="XREFspinmap"></a><dl>
<dt><a name="index-spinmap"></a>Function File: <em></em> <strong>spinmap</strong> <em>()</em></dt>
<dt><a name="index-spinmap-1"></a>Function File: <em></em> <strong>spinmap</strong> <em>(<var>t</var>)</em></dt>
<dt><a name="index-spinmap-2"></a>Function File: <em></em> <strong>spinmap</strong> <em>(<var>t</var>, <var>inc</var>)</em></dt>
<dt><a name="index-spinmap-3"></a>Function File: <em></em> <strong>spinmap</strong> <em>("inf")</em></dt>
<dd><p>Cycle the colormap for <var>t</var> seconds with a color increment of <var>inc</var>.
Both parameters are optional. The default cycle time is 5 seconds and the
default increment is 2. If the option <code>"inf"</code> is given then cycle
continuously until <kbd>Control-C</kbd> is pressed.
</p>
<p>When rotating the original color 1 becomes color 2, color 2 becomes
color 3, etc. A positive or negative increment is allowed and a higher
value of <var>inc</var> will cause faster cycling through the colormap.
</p>
<p><strong>See also:</strong> <a href="#XREFcolormap">colormap</a>.
</p></dd></dl>
<a name="XREFwhitebg"></a><dl>
<dt><a name="index-whitebg"></a>Function File: <em></em> <strong>whitebg</strong> <em>()</em></dt>
<dt><a name="index-whitebg-1"></a>Function File: <em></em> <strong>whitebg</strong> <em>(<var>color</var>)</em></dt>
<dt><a name="index-whitebg-2"></a>Function File: <em></em> <strong>whitebg</strong> <em>("none")</em></dt>
<dt><a name="index-whitebg-3"></a>Function File: <em></em> <strong>whitebg</strong> <em>(<var>hfig</var>, …)</em></dt>
<dd><p>Invert the colors in the current color scheme.
</p>
<p>The root properties are also inverted such that all subsequent plot use the
new color scheme.
</p>
<p>If the optional argument <var>color</var> is present then the background color
is set to <var>color</var> rather than inverted. <var>color</var> may be a string
representing one of the eight known colors or an RGB triplet. The special
string argument <code>"none"</code> restores the plot to the default colors.
</p>
<p>If the first argument <var>hfig</var> is a figure handle, then operate on
this figure rather than the current figure returned by <code>gcf</code>. The
root properties will not be changed.
</p>
<p><strong>See also:</strong> <a href="Managing-Default-Properties.html#XREFreset">reset</a>, <a href="Graphics-Objects.html#XREFget">get</a>, <a href="Graphics-Objects.html#XREFset">set</a>.
</p></dd></dl>
<p>The following functions can be used to manipulate colormaps.
</p>
<a name="XREFcmunique"></a><dl>
<dt><a name="index-cmunique"></a>Function File: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmunique</strong> <em>(<var>X</var>, <var>map</var>)</em></dt>
<dt><a name="index-cmunique-1"></a>Function File: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmunique</strong> <em>(<var>RGB</var>)</em></dt>
<dt><a name="index-cmunique-2"></a>Function File: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmunique</strong> <em>(<var>I</var>)</em></dt>
<dd><p>Convert an input image <var>X</var> to an ouput indexed image <var>Y</var> which uses
the smallest colormap possible <var>newmap</var>.
</p>
<p>When the input is an indexed image (<var>X</var> with colormap <var>map</var>) the
output is a colormap <var>newmap</var> from which any repeated rows have been
eliminated. The output image, <var>Y</var>, is the original input image with
the indices adjusted to match the new, possibly smaller, colormap.
</p>
<p>When the input is an RGB image (an MxNx3 array), the output
colormap will contain one entry for every unique color in the original image.
In the worst case the new map could have as many rows as the number of
pixels in the original image.
</p>
<p>When the input is a grayscale image <var>I</var>, the output colormap will
contain one entry for every unique intensity value in the original image.
In the worst case the new map could have as many rows as the number of
pixels in the original image.
</p>
<p>Implementation Details:
</p>
<p><var>newmap</var> is always an Mx3 matrix, even if the input image is
an intensity grayscale image <var>I</var> (all three RGB planes are
assigned the same value).
</p>
<p>The output image is of class uint8 if the size of the new colormap is
less than or equal to 256. Otherwise, the output image is of class double.
</p>
<p><strong>See also:</strong> <a href="#XREFrgb2ind">rgb2ind</a>, <a href="#XREFgray2ind">gray2ind</a>.
</p></dd></dl>
<a name="XREFcmpermute"></a><dl>
<dt><a name="index-cmpermute"></a>Function File: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmpermute</strong> <em>(<var>X</var>, <var>map</var>)</em></dt>
<dt><a name="index-cmpermute-1"></a>Function File: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmpermute</strong> <em>(<var>X</var>, <var>map</var>, <var>index</var>)</em></dt>
<dd><p>Reorder colors in a colormap.
</p>
<p>When called with only two arguments, <code>cmpermute</code> randomly rearranges
the colormap <var>map</var> and returns a new colormap <var>newmap</var>. It also
returns the indexed image <var>Y</var> which is the equivalent of the original
input image <var>X</var> when displayed using <var>newmap</var>.
</p>
<p>When called with an optional third argument the order of colors in the
new colormap is defined by <var>index</var>.
</p>
<p><strong>Caution:</strong> <code>index</code> should not have repeated elements or the
function will fail.
</p>
</dd></dl>
<hr>
<div class="header">
<p>
Next: <a href="Plotting-on-top-of-Images.html#Plotting-on-top-of-Images" accesskey="n" rel="next">Plotting on top of Images</a>, Previous: <a href="Displaying-Images.html#Displaying-Images" accesskey="p" rel="prev">Displaying Images</a>, Up: <a href="Image-Processing.html#Image-Processing" 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#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|