Jetson Inference
DNN Vision Library
cudaGrayscale.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, 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_GRAYSCALE_CONVERT_H
24 #define __CUDA_GRAYSCALE_CONVERT_H
25 
26 
27 #include "cudaUtility.h"
28 
29 
35 
37 
42 cudaError_t cudaGray8ToGray32( uint8_t* input, float* output, size_t width, size_t height );
43 
54 cudaError_t cudaGray32ToGray8( float* input, uint8_t* output, size_t width, size_t height,
55  const float2& pixelRange=make_float2(0,255) );
56 
58 
59 
65 
67 
76 cudaError_t cudaRGB8ToGray8( uchar3* input, uint8_t* output, size_t width, size_t height, bool swapRedBlue=false );
77 
86 cudaError_t cudaRGBA8ToGray8( uchar4* input, uint8_t* output, size_t width, size_t height, bool swapRedBlue=false );
87 
101 cudaError_t cudaRGB32ToGray8( float3* input, uint8_t* output, size_t width, size_t height,
102  bool swapRedBlue=false, const float2& pixelRange=make_float2(0,255) );
103 
117 cudaError_t cudaRGBA32ToGray8( float4* input, uint8_t* output, size_t width, size_t height,
118  bool swapRedBlue=false, const float2& pixelRange=make_float2(0,255) );
119 
121 
122 
128 
130 
139 cudaError_t cudaRGB8ToGray32( uchar3* input, float* output, size_t width, size_t height, bool swapRedBlue=false );
140 
149 cudaError_t cudaRGBA8ToGray32( uchar4* input, float* output, size_t width, size_t height, bool swapRedBlue=false );
150 
159 cudaError_t cudaRGB32ToGray32( float3* input, float* output, size_t width, size_t height, bool swapRedBlue=false );
160 
169 cudaError_t cudaRGBA32ToGray32( float4* input, float* output, size_t width, size_t height, bool swapRedBlue=false );
170 
172 
173 
179 
181 
186 cudaError_t cudaGray8ToRGB8( uint8_t* input, uchar3* output, size_t width, size_t height );
187 
192 cudaError_t cudaGray8ToRGBA8( uint8_t* input, uchar4* output, size_t width, size_t height );
193 
198 cudaError_t cudaGray8ToRGB32( uint8_t* input, float3* output, size_t width, size_t height );
199 
204 cudaError_t cudaGray8ToRGBA32( uint8_t* input, float4* output, size_t width, size_t height );
205 
207 
208 
214 
216 
228 cudaError_t cudaGray32ToRGB8( float* input, uchar3* output, size_t width, size_t height,
229  const float2& pixelRange=make_float2(0,255) );
230 
241 cudaError_t cudaGray32ToRGBA8( float* input, uchar4* output, size_t width, size_t height,
242  const float2& pixelRange=make_float2(0,255) );
243 
248 cudaError_t cudaGray32ToRGB32( float* input, float3* output, size_t width, size_t height );
249 
254 cudaError_t cudaGray32ToRGBA32( float* input, float4* output, size_t width, size_t height );
255 
257 
258 #endif
cudaRGB8ToGray32
cudaError_t cudaRGB8ToGray32(uchar3 *input, float *output, size_t width, size_t height, bool swapRedBlue=false)
Convert uchar3 RGB/BGR image into float grayscale.
cudaGray32ToGray8
cudaError_t cudaGray32ToGray8(float *input, uint8_t *output, size_t width, size_t height, const float2 &pixelRange=make_float2(0, 255))
Convert float grayscale image into uint8 grayscale.
cudaRGBA8ToGray32
cudaError_t cudaRGBA8ToGray32(uchar4 *input, float *output, size_t width, size_t height, bool swapRedBlue=false)
Convert uchar4 RGBA/BGRA image into float grayscale.
cudaRGBA32ToGray32
cudaError_t cudaRGBA32ToGray32(float4 *input, float *output, size_t width, size_t height, bool swapRedBlue=false)
Convert float4 RGB/BGR image into float grayscale.
cudaUtility.h
cudaGray32ToRGB8
cudaError_t cudaGray32ToRGB8(float *input, uchar3 *output, size_t width, size_t height, const float2 &pixelRange=make_float2(0, 255))
Convert float grayscale image into uchar3 RGB/BGR.
cudaGray8ToRGBA32
cudaError_t cudaGray8ToRGBA32(uint8_t *input, float4 *output, size_t width, size_t height)
Convert uint8 grayscale image into float4 RGB/BGR.
cudaGray8ToRGB32
cudaError_t cudaGray8ToRGB32(uint8_t *input, float3 *output, size_t width, size_t height)
Convert uint8 grayscale image into float3 RGB/BGR.
cudaGray8ToRGB8
cudaError_t cudaGray8ToRGB8(uint8_t *input, uchar3 *output, size_t width, size_t height)
Convert uint8 grayscale image into uchar3 RGB/BGR.
cudaRGBA32ToGray8
cudaError_t cudaRGBA32ToGray8(float4 *input, uint8_t *output, size_t width, size_t height, bool swapRedBlue=false, const float2 &pixelRange=make_float2(0, 255))
Convert float4 RGBA/BGRA image into uint8 grayscale.
cudaGray32ToRGBA8
cudaError_t cudaGray32ToRGBA8(float *input, uchar4 *output, size_t width, size_t height, const float2 &pixelRange=make_float2(0, 255))
Convert float grayscale image into uchar4 RGB/BGR.
cudaGray8ToGray32
cudaError_t cudaGray8ToGray32(uint8_t *input, float *output, size_t width, size_t height)
Convert uint8 grayscale image into float grayscale.
cudaGray32ToRGB32
cudaError_t cudaGray32ToRGB32(float *input, float3 *output, size_t width, size_t height)
Convert float grayscale image into float3 RGB/BGR.
cudaRGBA8ToGray8
cudaError_t cudaRGBA8ToGray8(uchar4 *input, uint8_t *output, size_t width, size_t height, bool swapRedBlue=false)
Convert uchar4 RGBA/BGRA image into uint8 grayscale.
cudaRGB32ToGray8
cudaError_t cudaRGB32ToGray8(float3 *input, uint8_t *output, size_t width, size_t height, bool swapRedBlue=false, const float2 &pixelRange=make_float2(0, 255))
Convert float3 RGB/BGR image into uint8 grayscale.
cudaGray32ToRGBA32
cudaError_t cudaGray32ToRGBA32(float *input, float4 *output, size_t width, size_t height)
Convert float grayscale image into float4 RGB/BGR.
cudaGray8ToRGBA8
cudaError_t cudaGray8ToRGBA8(uint8_t *input, uchar4 *output, size_t width, size_t height)
Convert uint8 grayscale image into uchar4 RGB/BGR.
make_float2
__host__ __device__ float2 make_float2(float s)
Definition: cudaMath.h:81
cudaRGB32ToGray32
cudaError_t cudaRGB32ToGray32(float3 *input, float *output, size_t width, size_t height, bool swapRedBlue=false)
Convert float3 RGB/BGR image into float grayscale.
cudaRGB8ToGray8
cudaError_t cudaRGB8ToGray8(uchar3 *input, uint8_t *output, size_t width, size_t height, bool swapRedBlue=false)
Convert uchar3 RGB/BGR image into uint8 grayscale.