HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
(Remap value range by spline or name)

Functions

ImageBuf OIIO_API ImageBufAlgo::color_map (const ImageBuf &src, int srcchannel, int nknots, int channels, cspan< float > knots, ROI roi={}, int nthreads=0)
 
ImageBuf OIIO_API ImageBufAlgo::color_map (const ImageBuf &src, int srcchannel, string_view mapname, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::color_map (ImageBuf &dst, const ImageBuf &src, int srcchannel, int nknots, int channels, cspan< float > knots, ROI roi={}, int nthreads=0)
 
bool OIIO_API ImageBufAlgo::color_map (ImageBuf &dst, const ImageBuf &src, int srcchannel, string_view mapname, ROI roi={}, int nthreads=0)
 

Detailed Description

Remap value range by spline or name

Return (or copy into dst) pixel values determined by looking up a color map using values of the source image, using either the channel specified by srcchannel, or the luminance of src's RGB if srcchannel is -1. This happens for all pixels within the ROI (which defaults to all of src), and if dst is not already initialized, it will be initialized to the ROI and with color channels equal to channels.

In the variant that takes a knots parameter, this specifies the values of a linearly-interpolated color map given by knots[nknots*channels]. An input value of 0.0 is mapped to knots[0..channels-1] (one value for each color channel), and an input value of 1.0 is mapped to knots[(nknots-1)*channels..knots.size()-1].

In the variant that takes a mapname parameter, this is the name of a color map. Recognized map names include: "inferno", "viridis", "magma", "plasma", all of which are perceptually uniform, strictly increasing in luminance, look good when converted to grayscale, and work for people with all types of colorblindness. Also "turbo" has most of these properties (except for being strictly increasing in luminance) and is a nice rainbow-like pattern. Also supported are the following color maps that do not have those desirable qualities (and are thus not recommended, but are present for back-compatibility or for use by clueless people): "blue-red", "spectrum", and "heat". In all cases, the implied channels is 3.

Function Documentation

ImageBuf OIIO_API ImageBufAlgo::color_map ( const ImageBuf src,
int  srcchannel,
int  nknots,
int  channels,
cspan< float knots,
ROI  roi = {},
int  nthreads = 0 
)
ImageBuf OIIO_API ImageBufAlgo::color_map ( const ImageBuf src,
int  srcchannel,
string_view  mapname,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::color_map ( ImageBuf dst,
const ImageBuf src,
int  srcchannel,
int  nknots,
int  channels,
cspan< float knots,
ROI  roi = {},
int  nthreads = 0 
)
bool OIIO_API ImageBufAlgo::color_map ( ImageBuf dst,
const ImageBuf src,
int  srcchannel,
string_view  mapname,
ROI  roi = {},
int  nthreads = 0 
)