This file is indexed.

/usr/share/doc/octave/octave.html/Representing-Images.html is in octave-doc 4.2.2-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Representing Images (GNU Octave)</title>

<meta name="description" content="Representing Images (GNU Octave)">
<meta name="keywords" content="Representing Images (GNU Octave)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<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.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
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.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">
<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> &nbsp; [<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="XREFim2double"></a><dl>
<dt><a name="index-im2double"></a>: <em></em> <strong>im2double</strong> <em>(<var>img</var>)</em></dt>
<dt><a name="index-im2double-1"></a>: <em></em> <strong>im2double</strong> <em>(<var>img</var>, &quot;indexed&quot;)</em></dt>
<dd><p>Convert image to double precision.
</p>
<p>The conversion of <var>img</var> to double precision, is dependent
on the type of input image.  The following input classes are
supported:
</p>
<dl compact="compact">
<dt>&lsquo;<samp>uint8, uint16, and int16</samp>&rsquo;</dt>
<dd><p>The range of values from the class is scaled to the interval [0 1].
</p>
</dd>
<dt>&lsquo;<samp>logical</samp>&rsquo;</dt>
<dd><p>True and false values are assigned a value of 0 and 1 respectively.
</p>
</dd>
<dt>&lsquo;<samp>single</samp>&rsquo;</dt>
<dd><p>Values are cast to double.
</p>
</dd>
<dt>&lsquo;<samp>double</samp>&rsquo;</dt>
<dd><p>Returns the same image.
</p>
</dd>
</dl>

<p>If <var>img</var> is an indexed image, then the second argument should be
the string <code>&quot;indexed&quot;</code>.  If so, then <var>img</var> must either be
of floating point class, or unsigned integer class and it will simply
be cast to double.  If it is an integer class, a +1 offset is applied.
</p>

<p><strong>See also:</strong> <a href="Numeric-Data-Types.html#XREFdouble">double</a>.
</p></dd></dl>


<a name="XREFiscolormap"></a><dl>
<dt><a name="index-iscolormap"></a>: <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, of class single or double, with 3 columns.
Each row represents a single color.  The 3 columns contain red, green,
and blue intensities respectively.
</p>
<p>All values in a colormap should be in the [0 1] range but this is not
enforced.  Each function must decide what to do for values outside this
range.
</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>: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>I</var>)</em></dt>
<dt><a name="index-gray2ind-1"></a>: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>I</var>, <var>n</var>)</em></dt>
<dt><a name="index-gray2ind-2"></a>: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>BW</var>)</em></dt>
<dt><a name="index-gray2ind-3"></a>: <em><var>img</var> =</em> <strong>gray2ind</strong> <em>(<var>BW</var>, <var>n</var>)</em></dt>
<dt><a name="index-gray2ind-4"></a>: <em>[<var>img</var>, <var>map</var>] =</em> <strong>gray2ind</strong> <em>(&hellip;)</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>: <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>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 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>: <em>[<var>x</var>, <var>map</var>] =</em> <strong>rgb2ind</strong> <em>(<var>rgb</var>)</em></dt>
<dt><a name="index-rgb2ind-1"></a>: <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 color 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 color 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>: <em><var>rgb</var> =</em> <strong>ind2rgb</strong> <em>(<var>x</var>, <var>map</var>)</em></dt>
<dt><a name="index-ind2rgb-1"></a>: <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="XREFframe2im"></a><dl>
<dt><a name="index-frame2im"></a>: <em>[<var>x</var>, <var>map</var>] =</em> <strong>frame2im</strong> <em>(<var>f</var>)</em></dt>
<dd><p>Convert movie frame to indexed image.
</p>
<p>A movie frame is simply a struct with the fields <code>&quot;cdata&quot;</code> and
<code>&quot;colormap&quot;</code>.
</p>
<p>Support for N-dimensional images or movies is given when <var>f</var> is a
struct array.  In such cases, <var>x</var> will be a MxNx1xK or MxNx3xK
for indexed and RGB movies respectively, with each frame concatenated
along the 4th dimension.
</p>

<p><strong>See also:</strong> <a href="#XREFim2frame">im2frame</a>.
</p></dd></dl>


<a name="XREFim2frame"></a><dl>
<dt><a name="index-im2frame"></a>: <em></em> <strong>im2frame</strong> <em>(<var>rgb</var>)</em></dt>
<dt><a name="index-im2frame-1"></a>: <em></em> <strong>im2frame</strong> <em>(<var>x</var>, <var>map</var>)</em></dt>
<dd><p>Convert image to movie frame.
</p>
<p>A movie frame is simply a struct with the fields <code>&quot;cdata&quot;</code> and
<code>&quot;colormap&quot;</code>.
</p>
<p>Support for N-dimensional images is given when each image projection,
matrix sizes of MxN and MxNx3 for RGB images, is concatenated
along the fourth dimension.  In such cases, the returned value is a struct
array.
</p>

<p><strong>See also:</strong> <a href="#XREFframe2im">frame2im</a>.
</p></dd></dl>


<a name="XREFcolormap"></a><dl>
<dt><a name="index-colormap"></a>: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>()</em></dt>
<dt><a name="index-colormap-1"></a>: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<var>map</var>)</em></dt>
<dt><a name="index-colormap-2"></a>: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<code>&quot;default&quot;</code>)</em></dt>
<dt><a name="index-colormap-3"></a>: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<var>map_name</var>)</em></dt>
<dt><a name="index-colormap-4"></a>: <em><var>cmap</var> =</em> <strong>colormap</strong> <em>(<var>hax</var>, &hellip;)</em></dt>
<dt><a name="index-colormap-5"></a>: <em></em> <strong>colormap</strong> <em><var>map_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 (<code>&quot;default&quot;</code>)</code> restores the default colormap (the
<code>viridis</code> map with 64 entries).  The default colormap is returned.
</p>
<p>The map may also be specified by a string, <var>map_name</var>, which
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>The list of built-in colormaps is:
</p>
<table>
<thead><tr><th width="15%">Map</th><th width="85%">Description</th></tr></thead>
<tr><td width="15%">viridis</td><td width="85%">default</td></tr>
<tr><td width="15%">jet</td><td width="85%">colormap traversing blue, cyan, green, yellow, red.</td></tr>
<tr><td width="15%">cubehelix</td><td width="85%">colormap traversing black, blue, green, red, white with increasing intensity.</td></tr>
<tr><td width="15%">hsv</td><td width="85%">cyclic colormap traversing Hue, Saturation, Value space.</td></tr>
<tr><td width="15%">rainbow</td><td width="85%">colormap traversing red, yellow, blue, green, violet.</td></tr>
<tr><td width="15%">&mdash;&mdash;&mdash;&mdash;-</td><td width="85%">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</td></tr>
<tr><td width="15%">hot</td><td width="85%">colormap traversing black, red, orange, yellow, white.</td></tr>
<tr><td width="15%">cool</td><td width="85%">colormap traversing cyan, purple, magenta.</td></tr>
<tr><td width="15%">spring</td><td width="85%">colormap traversing magenta to yellow.</td></tr>
<tr><td width="15%">summer</td><td width="85%">colormap traversing green to yellow.</td></tr>
<tr><td width="15%">autumn</td><td width="85%">colormap traversing red, orange, yellow.</td></tr>
<tr><td width="15%">winter</td><td width="85%">colormap traversing blue to green.</td></tr>
<tr><td width="15%">&mdash;&mdash;&mdash;&mdash;-</td><td width="85%">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</td></tr>
<tr><td width="15%">gray</td><td width="85%">colormap traversing black to white in shades of gray.</td></tr>
<tr><td width="15%">bone</td><td width="85%">colormap traversing black, gray-blue, white.</td></tr>
<tr><td width="15%">copper</td><td width="85%">colormap traversing black to light copper.</td></tr>
<tr><td width="15%">pink</td><td width="85%">colormap traversing black, gray-pink, white.</td></tr>
<tr><td width="15%">ocean</td><td width="85%">colormap traversing black, dark-blue, white.</td></tr>
<tr><td width="15%">&mdash;&mdash;&mdash;&mdash;-</td><td width="85%">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</td></tr>
<tr><td width="15%">colorcube</td><td width="85%">equally spaced colors in RGB color space.</td></tr>
<tr><td width="15%">flag</td><td width="85%">cyclic 4-color map of red, white, blue, black.</td></tr>
<tr><td width="15%">lines</td><td width="85%">cyclic colormap with colors from axes <code>&quot;ColorOrder&quot;</code> property.</td></tr>
<tr><td width="15%">prism</td><td width="85%">cyclic 6-color map of red, orange, yellow, green, blue, violet.</td></tr>
<tr><td width="15%">&mdash;&mdash;&mdash;&mdash;-</td><td width="85%">&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;</td></tr>
<tr><td width="15%">white</td><td width="85%">all white colormap (no colors).</td></tr>
</table>

<p><strong>See also:</strong> <a href="#XREFviridis">viridis</a>, <a href="#XREFjet">jet</a>, <a href="#XREFcubehelix">cubehelix</a>, <a href="#XREFhsv">hsv</a>, <a href="#XREFrainbow">rainbow</a>, <a href="#XREFhot">hot</a>, <a href="#XREFcool">cool</a>, <a href="#XREFspring">spring</a>, <a href="#XREFsummer">summer</a>, <a href="#XREFautumn">autumn</a>, <a href="#XREFwinter">winter</a>, <a href="#XREFgray">gray</a>, <a href="#XREFbone">bone</a>, <a href="#XREFcopper">copper</a>, <a href="#XREFpink">pink</a>, <a href="#XREFocean">ocean</a>, <a href="#XREFcolorcube">colorcube</a>, <a href="#XREFflag">flag</a>, <a href="#XREFlines">lines</a>, <a href="#XREFprism">prism</a>, <a href="#XREFwhite">white</a>.
</p></dd></dl>


<a name="XREFrgbplot"></a><dl>
<dt><a name="index-rgbplot"></a>: <em></em> <strong>rgbplot</strong> <em>(<var>cmap</var>)</em></dt>
<dt><a name="index-rgbplot-1"></a>: <em></em> <strong>rgbplot</strong> <em>(<var>cmap</var>, <var>style</var>)</em></dt>
<dt><a name="index-rgbplot-2"></a>: <em><var>h</var> =</em> <strong>rgbplot</strong> <em>(&hellip;)</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 an RGB component 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>: <em><var>map</var> =</em> <strong>autumn</strong> <em>()</em></dt>
<dt><a name="index-autumn-1"></a>: <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.
</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="XREFbone"></a><dl>
<dt><a name="index-bone"></a>: <em><var>map</var> =</em> <strong>bone</strong> <em>()</em></dt>
<dt><a name="index-bone-1"></a>: <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.
</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="XREFcolorcube"></a><dl>
<dt><a name="index-colorcube"></a>: <em><var>map</var> =</em> <strong>colorcube</strong> <em>()</em></dt>
<dt><a name="index-colorcube-1"></a>: <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.
</p>
<p>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.
</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="XREFcool"></a><dl>
<dt><a name="index-cool"></a>: <em><var>map</var> =</em> <strong>cool</strong> <em>()</em></dt>
<dt><a name="index-cool-1"></a>: <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.
</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="XREFcopper"></a><dl>
<dt><a name="index-copper"></a>: <em><var>map</var> =</em> <strong>copper</strong> <em>()</em></dt>
<dt><a name="index-copper-1"></a>: <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.
</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="XREFcubehelix"></a><dl>
<dt><a name="index-cubehelix"></a>: <em><var>map</var> =</em> <strong>cubehelix</strong> <em>()</em></dt>
<dt><a name="index-cubehelix-1"></a>: <em><var>map</var> =</em> <strong>cubehelix</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create cubehelix colormap.
</p>
<p>This colormap varies from black to white going though blue, green, and red
tones while maintaining a monotonically increasing perception of intensity.
This is achieved by traversing a color cube from black to white through
a helix, hence the name cubehelix, while taking into account the perceived
brightness of each channel according to the NTSC specifications from 1953.
</p>
<div class="example">
<pre class="example">rgbplot (cubehelix (256))
</pre></div>

<p>The argument <var>n</var> must be a scalar.
If unspecified, the length of the current colormap, or 64, is used.
</p>
<p>Reference: Green, D. A., 2011,
<cite>&quot;A colour scheme for the display of astronomical intensity
images&quot;</cite>, Bulletin of the Astronomical Society of India, 39, 289.
</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>: <em><var>map</var> =</em> <strong>flag</strong> <em>()</em></dt>
<dt><a name="index-flag-1"></a>: <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.
</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="XREFgray"></a><dl>
<dt><a name="index-gray"></a>: <em><var>map</var> =</em> <strong>gray</strong> <em>()</em></dt>
<dt><a name="index-gray-1"></a>: <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.
</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="XREFhot"></a><dl>
<dt><a name="index-hot"></a>: <em><var>map</var> =</em> <strong>hot</strong> <em>()</em></dt>
<dt><a name="index-hot-1"></a>: <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.
</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="XREFhsv"></a><dl>
<dt><a name="index-hsv"></a>: <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.
</p>
<p>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>: <em><var>map</var> =</em> <strong>jet</strong> <em>()</em></dt>
<dt><a name="index-jet-1"></a>: <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.
</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="XREFlines"></a><dl>
<dt><a name="index-lines"></a>: <em><var>map</var> =</em> <strong>lines</strong> <em>()</em></dt>
<dt><a name="index-lines-1"></a>: <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>&quot;ColorOrder&quot;</code> property.  The default is blue,
orange, yellow, purple, green, light blue, and dark red.
</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="XREFocean"></a><dl>
<dt><a name="index-ocean"></a>: <em><var>map</var> =</em> <strong>ocean</strong> <em>()</em></dt>
<dt><a name="index-ocean-1"></a>: <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.
</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="XREFpink"></a><dl>
<dt><a name="index-pink"></a>: <em><var>map</var> =</em> <strong>pink</strong> <em>()</em></dt>
<dt><a name="index-pink-1"></a>: <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.
</p>
<p>This colormap gives a sepia tone when used on grayscale images.
</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="XREFprism"></a><dl>
<dt><a name="index-prism"></a>: <em><var>map</var> =</em> <strong>prism</strong> <em>()</em></dt>
<dt><a name="index-prism-1"></a>: <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.
</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="XREFrainbow"></a><dl>
<dt><a name="index-rainbow"></a>: <em><var>map</var> =</em> <strong>rainbow</strong> <em>()</em></dt>
<dt><a name="index-rainbow-1"></a>: <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.
</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="XREFspring"></a><dl>
<dt><a name="index-spring"></a>: <em><var>map</var> =</em> <strong>spring</strong> <em>()</em></dt>
<dt><a name="index-spring-1"></a>: <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.
</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="XREFsummer"></a><dl>
<dt><a name="index-summer"></a>: <em><var>map</var> =</em> <strong>summer</strong> <em>()</em></dt>
<dt><a name="index-summer-1"></a>: <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.
</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="XREFviridis"></a><dl>
<dt><a name="index-viridis"></a>: <em><var>map</var> =</em> <strong>viridis</strong> <em>()</em></dt>
<dt><a name="index-viridis-1"></a>: <em><var>map</var> =</em> <strong>viridis</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap.  This colormap ranges from dark purplish-blue through
blue, green, to yellow.
</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="XREFwhite"></a><dl>
<dt><a name="index-white"></a>: <em><var>map</var> =</em> <strong>white</strong> <em>()</em></dt>
<dt><a name="index-white-1"></a>: <em><var>map</var> =</em> <strong>white</strong> <em>(<var>n</var>)</em></dt>
<dd><p>Create color colormap.  This colormap is completely white.
</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="XREFwinter"></a><dl>
<dt><a name="index-winter"></a>: <em><var>map</var> =</em> <strong>winter</strong> <em>()</em></dt>
<dt><a name="index-winter-1"></a>: <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.
</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="XREFcontrast"></a><dl>
<dt><a name="index-contrast"></a>: <em><var>cmap</var> =</em> <strong>contrast</strong> <em>(<var>x</var>)</em></dt>
<dt><a name="index-contrast-1"></a>: <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.
</p>
<p>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>The following three functions modify the existing colormap rather than
replace it.
</p>
<a name="XREFbrighten"></a><dl>
<dt><a name="index-brighten"></a>: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>beta</var>)</em></dt>
<dt><a name="index-brighten-1"></a>: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>map</var>, <var>beta</var>)</em></dt>
<dt><a name="index-brighten-2"></a>: <em><var>map_out</var> =</em> <strong>brighten</strong> <em>(<var>h</var>, <var>beta</var>)</em></dt>
<dt><a name="index-brighten-3"></a>: <em></em> <strong>brighten</strong> <em>(&hellip;)</em></dt>
<dd><p>Brighten or darken a colormap.
</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 the <var>map</var> argument is omitted, the function is applied to the current
colormap.
</p>
<p>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>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>: <em></em> <strong>spinmap</strong> <em>()</em></dt>
<dt><a name="index-spinmap-1"></a>: <em></em> <strong>spinmap</strong> <em>(<var>t</var>)</em></dt>
<dt><a name="index-spinmap-2"></a>: <em></em> <strong>spinmap</strong> <em>(<var>t</var>, <var>inc</var>)</em></dt>
<dt><a name="index-spinmap-3"></a>: <em></em> <strong>spinmap</strong> <em>(&quot;inf&quot;)</em></dt>
<dd><p>Cycle the colormap for <var>t</var> seconds with a color increment of <var>inc</var>.
</p>
<p>Both parameters are optional.  The default cycle time is 5 seconds and the
default increment is 2.  If the option <code>&quot;inf&quot;</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>: <em></em> <strong>whitebg</strong> <em>()</em></dt>
<dt><a name="index-whitebg-1"></a>: <em></em> <strong>whitebg</strong> <em>(<var>color</var>)</em></dt>
<dt><a name="index-whitebg-2"></a>: <em></em> <strong>whitebg</strong> <em>(&quot;none&quot;)</em></dt>
<dt><a name="index-whitebg-3"></a>: <em></em> <strong>whitebg</strong> <em>(<var>hfig</var>, &hellip;)</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>&quot;none&quot;</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>: <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>: <em>[<var>Y</var>, <var>newmap</var>] =</em> <strong>cmunique</strong> <em>(<var>RGB</var>)</em></dt>
<dt><a name="index-cmunique-2"></a>: <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>: <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>: <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> &nbsp; [<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>