Jetson Inference
DNN Vision Library

Defines various colormaps and color mapping functions. More...

Enumerations

enum  cudaColormapType {
  COLORMAP_INFERNO, COLORMAP_MAGMA, COLORMAP_PARULA, COLORMAP_PLASMA,
  COLORMAP_TURBO, COLORMAP_VIRIDIS, COLORMAP_INFERNO_INVERTED, COLORMAP_MAGMA_INVERTED,
  COLORMAP_PARULA_INVERTED, COLORMAP_PLASMA_INVERTED, COLORMAP_TURBO_INVERTED, COLORMAP_VIRIDIS_INVERTED,
  COLORMAP_FLOW, COLORMAP_NONE, COLORMAP_LINEAR, COLORMAP_DEFAULT = COLORMAP_VIRIDIS
}
 Enumeration of built-in colormaps. More...
 

Functions

cudaColormapType cudaColormapFromStr (const char *colormap)
 Parse a cudaColormapType enum from a string. More...
 
const char * cudaColormapToStr (cudaColormapType colormap)
 Convert a cudaColormapType enum to a string. More...
 
template<typename T >
cudaError_t cudaColormap (float *input, T *output, size_t width, size_t height, const float2 &input_range=make_float2(0, 255), cudaDataFormat input_format=FORMAT_DEFAULT, cudaColormapType colormap=COLORMAP_DEFAULT, cudaStream_t stream=NULL)
 Apply a colormap from an input image or vector field to RGB/RGBA. More...
 
cudaError_t cudaColormap (float *input, void *output, size_t width, size_t height, const float2 &input_range=make_float2(0, 255), cudaDataFormat input_format=FORMAT_DEFAULT, imageFormat output_format=IMAGE_UNKNOWN, cudaColormapType colormap=COLORMAP_DEFAULT, cudaStream_t stream=NULL)
 Apply a colormap from an input image or vector field to RGB/RGBA. More...
 
template<typename T >
cudaError_t cudaColormap (float *input, size_t input_width, size_t input_height, T *output, size_t output_width, size_t output_height, const float2 &input_range=make_float2(0, 255), cudaDataFormat input_format=FORMAT_DEFAULT, cudaColormapType colormap=COLORMAP_DEFAULT, cudaFilterMode filter=FILTER_LINEAR, cudaStream_t stream=NULL)
 Apply a colormap from an input image or vector field to RGB/RGBA. More...
 
cudaError_t cudaColormap (float *input, size_t input_width, size_t input_height, void *output, size_t output_width, size_t output_height, const float2 &input_range=make_float2(0, 255), cudaDataFormat input_format=FORMAT_DEFAULT, imageFormat output_format=IMAGE_UNKNOWN, cudaColormapType colormap=COLORMAP_DEFAULT, cudaFilterMode filter=FILTER_LINEAR, cudaStream_t stream=NULL)
 Apply a colormap from an input image or vector field to RGB/RGBA. More...
 
cudaError_t cudaColormapInit ()
 Initialize the colormap palettes by allocating them in CUDA memory. More...
 
cudaError_t cudaColormapFree ()
 Free the colormap palettes after they are done being used. More...
 

Detailed Description

Defines various colormaps and color mapping functions.

Enumeration Type Documentation

◆ cudaColormapType

Enumeration of built-in colormaps.

See also
cudaColormapTypeFromStr() and cudaColormapTypeToStr()
Enumerator
COLORMAP_INFERNO 

Inferno colormap, see http://bids.github.io/colormap/.

COLORMAP_MAGMA 

Magma colormap, see http://bids.github.io/colormap/.

COLORMAP_PARULA 

Parula colormap, see https://www.mathworks.com/help/matlab/ref/parula.html.

COLORMAP_PLASMA 

Plasma colormap, see http://bids.github.io/colormap/.

COLORMAP_TURBO 

Turbo colormap, see https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html.

COLORMAP_VIRIDIS 

Viridis colormap, see http://bids.github.io/colormap/.

COLORMAP_INFERNO_INVERTED 

Inferno colormap (inverted), see http://bids.github.io/colormap/.

COLORMAP_MAGMA_INVERTED 

Magma colormap (inverted), see http://bids.github.io/colormap/.

COLORMAP_PARULA_INVERTED 

Parula colormap (inverted), see https://www.mathworks.com/help/matlab/ref/parula.html.

COLORMAP_PLASMA_INVERTED 

Plasma colormap (inverted), see http://bids.github.io/colormap/.

COLORMAP_TURBO_INVERTED 

Turbo colormap (inverted), see https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html.

COLORMAP_VIRIDIS_INVERTED 

Viridis colormap (inverted), see http://bids.github.io/colormap/.

COLORMAP_FLOW 

Optical flow x/y velocity (2D)

COLORMAP_NONE 

Pass-through (no remapping applied)

COLORMAP_LINEAR 

Linearly remap the values to [0,255].

Default colormap (Viridis)

COLORMAP_DEFAULT 

Function Documentation

◆ cudaColormap() [1/4]

template<typename T >
cudaError_t cudaColormap ( float *  input,
size_t  input_width,
size_t  input_height,
T *  output,
size_t  output_width,
size_t  output_height,
const float2 &  input_range = make_float2(0,255),
cudaDataFormat  input_format = FORMAT_DEFAULT,
cudaColormapType  colormap = COLORMAP_DEFAULT,
cudaFilterMode  filter = FILTER_LINEAR,
cudaStream_t  stream = NULL 
)

Apply a colormap from an input image or vector field to RGB/RGBA.

If the input and output dimensions differ, this function will rescale the image using bilinear or nearest-point interpolation as set by the filter mode.

Parameters
input_rangethe minimum and maximum values of the input image.
colormapthe colormap to apply (
See also
cudaColormapType)
Parameters
filterthe interpolation mode used for rescaling.
formatlayout of multi-channel input data (HWC or CHW).

◆ cudaColormap() [2/4]

cudaError_t cudaColormap ( float *  input,
size_t  input_width,
size_t  input_height,
void *  output,
size_t  output_width,
size_t  output_height,
const float2 &  input_range = make_float2(0, 255),
cudaDataFormat  input_format = FORMAT_DEFAULT,
imageFormat  output_format = IMAGE_UNKNOWN,
cudaColormapType  colormap = COLORMAP_DEFAULT,
cudaFilterMode  filter = FILTER_LINEAR,
cudaStream_t  stream = NULL 
)

Apply a colormap from an input image or vector field to RGB/RGBA.

If the input and output dimensions differ, this function will rescale the image using bilinear or nearest-point interpolation as set by the filter mode.

Parameters
input_rangethe minimum and maximum values of the input image.
colormapthe colormap to apply (
See also
cudaColormapType)
Parameters
filterthe interpolation mode used for rescaling.
formatlayout of multi-channel input data (HWC or CHW).

◆ cudaColormap() [3/4]

template<typename T >
cudaError_t cudaColormap ( float *  input,
T *  output,
size_t  width,
size_t  height,
const float2 &  input_range = make_float2(0,255),
cudaDataFormat  input_format = FORMAT_DEFAULT,
cudaColormapType  colormap = COLORMAP_DEFAULT,
cudaStream_t  stream = NULL 
)

Apply a colormap from an input image or vector field to RGB/RGBA.

If the input and output dimensions differ, this function will rescale the image using bilinear or nearest-point interpolation as set by the filter mode.

Parameters
input_rangethe minimum and maximum values of the input image.
colormapthe colormap to apply (
See also
cudaColormapType)
Parameters
formatlayout of multi-channel input data (HWC or CHW).

◆ cudaColormap() [4/4]

cudaError_t cudaColormap ( float *  input,
void *  output,
size_t  width,
size_t  height,
const float2 &  input_range = make_float2(0, 255),
cudaDataFormat  input_format = FORMAT_DEFAULT,
imageFormat  output_format = IMAGE_UNKNOWN,
cudaColormapType  colormap = COLORMAP_DEFAULT,
cudaStream_t  stream = NULL 
)

Apply a colormap from an input image or vector field to RGB/RGBA.

If the input and output dimensions differ, this function will rescale the image using bilinear or nearest-point interpolation as set by the filter mode.

Parameters
input_rangethe minimum and maximum values of the input image.
colormapthe colormap to apply (
See also
cudaColormapType)
Parameters
formatlayout of multi-channel input data (HWC or CHW).

◆ cudaColormapFree()

cudaError_t cudaColormapFree ( )

Free the colormap palettes after they are done being used.

Only needs to be called if the other colormap functions were.

◆ cudaColormapFromStr()

cudaColormapType cudaColormapFromStr ( const char *  colormap)

Parse a cudaColormapType enum from a string.

Returns
The parsed cudaColormapType, or COLORMAP_DEFAULT on error.

◆ cudaColormapInit()

cudaError_t cudaColormapInit ( )

Initialize the colormap palettes by allocating them in CUDA memory.

Note
cudaColormapInit() is automatically called the first time that any colormap is used, so it needn't be explicitly called by the user unless they wish to do it at start-up.
Returns
cudaSuccess on success or if already initialized.

◆ cudaColormapToStr()

const char* cudaColormapToStr ( cudaColormapType  colormap)

Convert a cudaColormapType enum to a string.