applypalette

From DavinciWiki
Revision as of 12:19, 2 May 2013 by Cedwards (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Description

Applies a 1-dimensional colour palette to a greyscale image

Arguments and Return Values

Arguments: The greyscale base image, the colour palette, and optionally the min/max values for the mapping

Return Value: An RGB image

Usage

Syntax: applypalette(baseimage, palette [, min = VAL] [, max = VAL])


This function maps the colours in a 1-dimensional RGB image (e.g. generated by buildgradient) to a greyscale image. For example, applying a "hot/cold" gradient to a thermographic image, or a hue wheel gradient to the hue information extracted from a colour image. The optional min and max values control which values in the greyscale image are mapped to the left and right (respectively) ends of the palette. If they are omitted, they default to 0.0 and 1.0, respectively.


Examples

The 'Modern Thermograph 3' colour gradient from The Mirror's Surface Breaks applied to thermal imagery of Big Bend National Park:

dv> gr_base_image
4000x2000x1 array of float, bip format [32,000,000 bytes]
dv> gradient_colour_00
1x1x3 array of float, bsq format [12 bytes]
0.0000000000
0.0000000000
0.0000000000

dv> gradient_colour_01
1x1x3 array of float, bsq format [12 bytes]
0.03921569139
0.0000000000
0.6980391741

dv> gradient_colour_02
1x1x3 array of float, bsq format [12 bytes]
1.000000000
0.0000000000
0.0000000000

dv> gradient_colour_03
1x1x3 array of float, bsq format [12 bytes]
1.000000000
0.9882352948
0.0000000000

dv> gradient_colour_04
1x1x3 array of float, bsq format [12 bytes]
1.000000000
1.000000000
1.000000000

dv> g = buildgradient(1, gradient_colour_00, 13763, gradient_colour_01, 27525, gradient_colour_02, 58327, gradient_colour_03, 65536, gradient_colour_04)
Generating a gradient using 5 colours and 3 channels.
65536x1x3 array of float, bsq format [786,432 bytes]

dv> i = applypalette(gr_base_image, g, min = 0.0, max = 1.0)
Applying the specified palette to the specified image.

GradientMap-Big Bend Thermal.PNG

Images

A gradient-map used to denote negative and positive values in the same image:

Vegetation Index-NYC-ASVI.PNG

DavinciWiki Mini-Nav Bar

Contents


Contact Developers

  • davinci-dev [AT] mars.asu.edu

All other topics

  • See navigation on the left

Related Functions

Recent Library Changes

Created On: 07-16-2012
Modified On: 05-02-2013

[[category:Image Stretching

]]

Personal tools