Jetson Inference
DNN Vision Library
cudaColormap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __CUDA_COLORMAP_H__
24 #define __CUDA_COLORMAP_H__
25 
26 
27 #include "cudaFilterMode.h"
28 #include "imageFormat.h"
29 
30 
37 {
38  // Palettized
46  // Palettized (inverted)
54  // Parametric
61 };
62 
68 cudaColormapType cudaColormapFromStr( const char* colormap );
69 
74 const char* cudaColormapToStr( cudaColormapType colormap );
75 
85 template<typename T>
86 cudaError_t cudaColormap( float* input, T* output,
87  size_t width, size_t height,
88  const float2& input_range=make_float2(0,255),
89  cudaDataFormat input_format=FORMAT_DEFAULT,
91  cudaStream_t stream=NULL) { return cudaColormap(input, (void*)output, width, height, input_range, input_format, imageFormatFromType<T>(), colormap, stream); }
92 
102 cudaError_t cudaColormap( float* input, void* output,
103  size_t width, size_t height,
104  const float2& input_range=make_float2(0,255),
105  cudaDataFormat input_format=FORMAT_DEFAULT,
106  imageFormat output_format=IMAGE_UNKNOWN,
108  cudaStream_t stream=NULL);
109 
120 template<typename T>
121 cudaError_t cudaColormap( float* input, size_t input_width, size_t input_height,
122  T* output, size_t output_width, size_t output_height,
123  const float2& input_range=make_float2(0,255),
124  cudaDataFormat input_format=FORMAT_DEFAULT,
127  cudaStream_t stream=NULL ) { return cudaColormap(input, input_width, input_height, output, output_width, output_height, input_range, input_format, imageFormatFromType<T>(), colormap, filter, stream); }
128 
139 cudaError_t cudaColormap( float* input, size_t input_width, size_t input_height,
140  void* output, size_t output_width, size_t output_height,
141  const float2& input_range=make_float2(0,255),
142  cudaDataFormat input_format=FORMAT_DEFAULT,
143  imageFormat output_format=IMAGE_UNKNOWN,
146  cudaStream_t stream=NULL );
147 
156 cudaError_t cudaColormapInit();
157 
163 cudaError_t cudaColormapFree();
164 
176 float4* cudaColormapPalette( cudaColormapType colormap );
177 
178 
179 #endif
180 
COLORMAP_PLASMA
@ COLORMAP_PLASMA
Plasma colormap, see http://bids.github.io/colormap/.
Definition: cudaColormap.h:42
COLORMAP_PLASMA_INVERTED
@ COLORMAP_PLASMA_INVERTED
Plasma colormap (inverted), see http://bids.github.io/colormap/.
Definition: cudaColormap.h:50
COLORMAP_INFERNO_INVERTED
@ COLORMAP_INFERNO_INVERTED
Inferno colormap (inverted), see http://bids.github.io/colormap/.
Definition: cudaColormap.h:47
COLORMAP_PARULA_INVERTED
@ COLORMAP_PARULA_INVERTED
Parula colormap (inverted), see https://www.mathworks.com/help/matlab/ref/parula.html.
Definition: cudaColormap.h:49
cudaDataFormat
cudaDataFormat
Enumeration of image layout formats.
Definition: cudaFilterMode.h:59
FILTER_LINEAR
@ FILTER_LINEAR
Bilinear filtering.
Definition: cudaFilterMode.h:38
COLORMAP_NONE
@ COLORMAP_NONE
Pass-through (no remapping applied)
Definition: cudaColormap.h:56
COLORMAP_VIRIDIS_INVERTED
@ COLORMAP_VIRIDIS_INVERTED
Viridis colormap (inverted), see http://bids.github.io/colormap/.
Definition: cudaColormap.h:52
COLORMAP_VIRIDIS
@ COLORMAP_VIRIDIS
Viridis colormap, see http://bids.github.io/colormap/.
Definition: cudaColormap.h:44
COLORMAP_INFERNO
@ COLORMAP_INFERNO
Inferno colormap, see http://bids.github.io/colormap/.
Definition: cudaColormap.h:39
COLORMAP_DEFAULT
@ COLORMAP_DEFAULT
Definition: cudaColormap.h:60
cudaColormapToStr
const char * cudaColormapToStr(cudaColormapType colormap)
Convert a cudaColormapType enum to a string.
cudaColormapFree
cudaError_t cudaColormapFree()
Free the colormap palettes after they are done being used.
cudaFilterMode
cudaFilterMode
Enumeration of interpolation filtering modes.
Definition: cudaFilterMode.h:35
COLORMAP_LINEAR
@ COLORMAP_LINEAR
Linearly remap the values to [0,255].
Definition: cudaColormap.h:57
COLORMAP_TURBO
@ COLORMAP_TURBO
Turbo colormap, see https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for....
Definition: cudaColormap.h:43
cudaColormapPalette
float4 * cudaColormapPalette(cudaColormapType colormap)
Retrieve a CUDA device pointer to one of the colormaps palettes.
cudaColormapInit
cudaError_t cudaColormapInit()
Initialize the colormap palettes by allocating them in CUDA memory.
COLORMAP_PARULA
@ COLORMAP_PARULA
Parula colormap, see https://www.mathworks.com/help/matlab/ref/parula.html.
Definition: cudaColormap.h:41
make_float2
__host__ __device__ float2 make_float2(float s)
Definition: cudaMath.h:81
cudaColormapType
cudaColormapType
Enumeration of built-in colormaps.
Definition: cudaColormap.h:36
cudaColormapFromStr
cudaColormapType cudaColormapFromStr(const char *colormap)
Parse a cudaColormapType enum from a string.
cudaFilterMode.h
COLORMAP_MAGMA_INVERTED
@ COLORMAP_MAGMA_INVERTED
Magma colormap (inverted), see http://bids.github.io/colormap/.
Definition: cudaColormap.h:48
COLORMAP_TURBO_INVERTED
@ COLORMAP_TURBO_INVERTED
Turbo colormap (inverted), see https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for....
Definition: cudaColormap.h:51
cudaColormap
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.
Definition: cudaColormap.h:86
FORMAT_DEFAULT
@ FORMAT_DEFAULT
Definition: cudaFilterMode.h:65
COLORMAP_FLOW
@ COLORMAP_FLOW
Optical flow x/y velocity (2D)
Definition: cudaColormap.h:55
imageFormat.h
imageFormat
imageFormat
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Definition: imageFormat.h:49
IMAGE_UNKNOWN
@ IMAGE_UNKNOWN
Unknown/undefined format.
Definition: imageFormat.h:84
COLORMAP_MAGMA
@ COLORMAP_MAGMA
Magma colormap, see http://bids.github.io/colormap/.
Definition: cudaColormap.h:40