Jetson Inference
DNN Vision Library

Colorspace conversion functions for various YUV formats, RGB, BGR, ect. More...

8-bit RGB/BGR to Floating-point RGBA

cudaError_t cudaRGB8ToRGBA32 (uchar3 *input, float4 *output, size_t width, size_t height)
 Convert 8-bit fixed-point RGB image to 32-bit floating-point RGBA image. More...
 
cudaError_t cudaBGR8ToRGBA32 (uchar3 *input, float4 *output, size_t width, size_t height)
 Convert 8-bit fixed-point BGR image to 32-bit floating-point RGBA image. More...
 

Floating-point RGBA to 8-bit RGB/RGBA

cudaError_t cudaRGBA32ToRGB8 (float4 *input, uchar3 *output, size_t width, size_t height)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGB image. More...
 
cudaError_t cudaRGBA32ToRGB8 (float4 *input, uchar3 *output, size_t width, size_t height, const float2 &inputRange)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGB image, with the floating-point input range specified by the user. More...
 
cudaError_t cudaRGBA32ToRGBA8 (float4 *input, uchar4 *output, size_t width, size_t height)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGBA image. More...
 
cudaError_t cudaRGBA32ToRGBA8 (float4 *input, uchar4 *output, size_t width, size_t height, const float2 &inputRange)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGBA image, with the floating-point input range specified by the user. More...
 

Floating-point RGBA to 8-bit BGR/BGRA

cudaError_t cudaRGBA32ToBGR8 (float4 *input, uchar3 *output, size_t width, size_t height)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGR image. More...
 
cudaError_t cudaRGBA32ToBGR8 (float4 *input, uchar3 *output, size_t width, size_t height, const float2 &inputRange)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGR image, with the floating-point input range specified by the user. More...
 
cudaError_t cudaRGBA32ToBGRA8 (float4 *input, uchar4 *output, size_t width, size_t height)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGRA image. More...
 
cudaError_t cudaRGBA32ToBGRA8 (float4 *input, uchar4 *output, size_t width, size_t height, const float2 &inputRange)
 Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGRA image, with the floating-point input range specified by the user. More...
 

RGBA to YUV 4:2:0 planar (I420 & YV12)

cudaError_t cudaRGBAToI420 (uchar4 *input, uint8_t *output, size_t width, size_t height)
 Convert an RGBA uchar4 buffer into YUV I420 planar. More...
 
cudaError_t cudaRGBAToI420 (uchar4 *input, size_t inputPitch, uint8_t *output, size_t outputPitch, size_t width, size_t height)
 Convert an RGBA uchar4 texture into YUV I420 planar. More...
 
cudaError_t cudaRGBAToYV12 (uchar4 *input, uint8_t *output, size_t width, size_t height)
 Convert an RGBA uchar4 buffer into YUV YV12 planar. More...
 
cudaError_t cudaRGBAToYV12 (uchar4 *input, size_t inputPitch, uint8_t *output, size_t outputPitch, size_t width, size_t height)
 Convert an RGBA uchar4 texture into YUV YV12 planar. More...
 

YUV 4:2:2 packed (UYVY & YUYV) to RGBA

cudaError_t cudaUYVYToRGBA (uchar2 *input, uchar4 *output, size_t width, size_t height)
 Convert a UYVY 422 packed image into RGBA uchar4. More...
 
cudaError_t cudaUYVYToRGBA (uchar2 *input, size_t inputPitch, uchar4 *output, size_t outputPitch, size_t width, size_t height)
 Convert a UYVY 422 packed image into RGBA uchar4. More...
 
cudaError_t cudaYUYVToRGBA (uchar2 *input, uchar4 *output, size_t width, size_t height)
 Convert a YUYV 422 packed image into RGBA uchar4. More...
 
cudaError_t cudaYUYVToRGBA (uchar2 *input, size_t inputPitch, uchar4 *output, size_t outputPitch, size_t width, size_t height)
 Convert a YUYV 422 packed image into RGBA uchar4. More...
 

UYUV 4:2:2 packed (UYVY & YUYV) to grayscale

cudaError_t cudaUYVYToGray (uchar2 *input, float *output, size_t width, size_t height)
 Convert a UYVY 422 packed image into a floating-point grayscale image. More...
 
cudaError_t cudaUYVYToGray (uchar2 *input, size_t inputPitch, float *output, size_t outputPitch, size_t width, size_t height)
 Convert a UYVY 422 packed image into a floating-point grayscale image. More...
 
cudaError_t cudaYUYVToGray (uchar2 *input, float *output, size_t width, size_t height)
 Convert a YUYV 422 packed image into a floating-point grayscale image. More...
 
cudaError_t cudaYUYVToGray (uchar2 *input, size_t inputPitch, float *output, size_t outputPitch, size_t width, size_t height)
 Convert a YUYV 422 packed image into a floating-point grayscale image. More...
 

YUV NV12 to RGBA

cudaError_t cudaNV12ToRGBA (uint8_t *input, uchar4 *output, size_t width, size_t height)
 Convert an NV12 texture (semi-planar 4:2:0) to RGBA uchar4 format. More...
 
cudaError_t cudaNV12ToRGBA (uint8_t *input, size_t inputPitch, uchar4 *output, size_t outputPitch, size_t width, size_t height)
 Convert an NV12 texture (semi-planar 4:2:0) to RGBA uchar4 format. More...
 
cudaError_t cudaNV12ToRGBA32 (uint8_t *input, float4 *output, size_t width, size_t height)
 Convert an NV12 texture (semi-planar 4:2:0) to RGBA float4 format. More...
 
cudaError_t cudaNV12ToRGBA32 (uint8_t *input, size_t inputPitch, float4 *output, size_t outputPitch, size_t width, size_t height)
 Convert an NV12 texture (semi-planar 4:2:0) to RGBA float4 format. More...
 
cudaError_t cudaNV12SetupColorspace (float hue=0.0f)
 Setup NV12 color conversion constants. More...
 

Detailed Description

Colorspace conversion functions for various YUV formats, RGB, BGR, ect.

Function Documentation

◆ cudaBGR8ToRGBA32()

cudaError_t cudaBGR8ToRGBA32 ( uchar3 *  input,
float4 *  output,
size_t  width,
size_t  height 
)

Convert 8-bit fixed-point BGR image to 32-bit floating-point RGBA image.

◆ cudaNV12SetupColorspace()

cudaError_t cudaNV12SetupColorspace ( float  hue = 0.0f)

Setup NV12 color conversion constants.

cudaNV12SetupColorspace() isn't necessary for the user to call, it will be called automatically by cudaNV12ToRGBA() with a hue of 0.0. However if you want to setup custom constants (ie with a hue different than 0), then you can call cudaNV12SetupColorspace() at any time, overriding the default.

◆ cudaNV12ToRGBA() [1/2]

cudaError_t cudaNV12ToRGBA ( uint8_t *  input,
uchar4 *  output,
size_t  width,
size_t  height 
)

Convert an NV12 texture (semi-planar 4:2:0) to RGBA uchar4 format.

NV12 = 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling.

◆ cudaNV12ToRGBA() [2/2]

cudaError_t cudaNV12ToRGBA ( uint8_t *  input,
size_t  inputPitch,
uchar4 *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert an NV12 texture (semi-planar 4:2:0) to RGBA uchar4 format.

NV12 = 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling.

◆ cudaNV12ToRGBA32() [1/2]

cudaError_t cudaNV12ToRGBA32 ( uint8_t *  input,
float4 *  output,
size_t  width,
size_t  height 
)

Convert an NV12 texture (semi-planar 4:2:0) to RGBA float4 format.

NV12 = 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling.

◆ cudaNV12ToRGBA32() [2/2]

cudaError_t cudaNV12ToRGBA32 ( uint8_t *  input,
size_t  inputPitch,
float4 *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert an NV12 texture (semi-planar 4:2:0) to RGBA float4 format.

NV12 = 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling.

◆ cudaRGB8ToRGBA32()

cudaError_t cudaRGB8ToRGBA32 ( uchar3 *  input,
float4 *  output,
size_t  width,
size_t  height 
)

Convert 8-bit fixed-point RGB image to 32-bit floating-point RGBA image.

◆ cudaRGBA32ToBGR8() [1/2]

cudaError_t cudaRGBA32ToBGR8 ( float4 *  input,
uchar3 *  output,
size_t  width,
size_t  height 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGR image.

Assumes 0.0-255.0f input range, output range is 0-255.

◆ cudaRGBA32ToBGR8() [2/2]

cudaError_t cudaRGBA32ToBGR8 ( float4 *  input,
uchar3 *  output,
size_t  width,
size_t  height,
const float2 &  inputRange 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGR image, with the floating-point input range specified by the user.

Output range is 0-255.

◆ cudaRGBA32ToBGRA8() [1/2]

cudaError_t cudaRGBA32ToBGRA8 ( float4 *  input,
uchar4 *  output,
size_t  width,
size_t  height 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGRA image.

Assumes 0.0-255.0f input range, output range is 0-255.

◆ cudaRGBA32ToBGRA8() [2/2]

cudaError_t cudaRGBA32ToBGRA8 ( float4 *  input,
uchar4 *  output,
size_t  width,
size_t  height,
const float2 &  inputRange 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point BGRA image, with the floating-point input range specified by the user.

Output range is 0-255.

◆ cudaRGBA32ToRGB8() [1/2]

cudaError_t cudaRGBA32ToRGB8 ( float4 *  input,
uchar3 *  output,
size_t  width,
size_t  height 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGB image.

Assumes 0.0-255.0f input range, output range is 0-255.

◆ cudaRGBA32ToRGB8() [2/2]

cudaError_t cudaRGBA32ToRGB8 ( float4 *  input,
uchar3 *  output,
size_t  width,
size_t  height,
const float2 &  inputRange 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGB image, with the floating-point input range specified by the user.

Output range is 0-255.

◆ cudaRGBA32ToRGBA8() [1/2]

cudaError_t cudaRGBA32ToRGBA8 ( float4 *  input,
uchar4 *  output,
size_t  width,
size_t  height 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGBA image.

Assumes 0.0-255.0f input range, output range is 0-255.

◆ cudaRGBA32ToRGBA8() [2/2]

cudaError_t cudaRGBA32ToRGBA8 ( float4 *  input,
uchar4 *  output,
size_t  width,
size_t  height,
const float2 &  inputRange 
)

Convert 32-bit floating-point RGBA image into 8-bit fixed-point RGBA image, with the floating-point input range specified by the user.

Output range is 0-255.

◆ cudaRGBAToI420() [1/2]

cudaError_t cudaRGBAToI420 ( uchar4 *  input,
uint8_t *  output,
size_t  width,
size_t  height 
)

Convert an RGBA uchar4 buffer into YUV I420 planar.

◆ cudaRGBAToI420() [2/2]

cudaError_t cudaRGBAToI420 ( uchar4 *  input,
size_t  inputPitch,
uint8_t *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert an RGBA uchar4 texture into YUV I420 planar.

◆ cudaRGBAToYV12() [1/2]

cudaError_t cudaRGBAToYV12 ( uchar4 *  input,
uint8_t *  output,
size_t  width,
size_t  height 
)

Convert an RGBA uchar4 buffer into YUV YV12 planar.

◆ cudaRGBAToYV12() [2/2]

cudaError_t cudaRGBAToYV12 ( uchar4 *  input,
size_t  inputPitch,
uint8_t *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert an RGBA uchar4 texture into YUV YV12 planar.

◆ cudaUYVYToGray() [1/2]

cudaError_t cudaUYVYToGray ( uchar2 *  input,
float *  output,
size_t  width,
size_t  height 
)

Convert a UYVY 422 packed image into a floating-point grayscale image.

◆ cudaUYVYToGray() [2/2]

cudaError_t cudaUYVYToGray ( uchar2 *  input,
size_t  inputPitch,
float *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert a UYVY 422 packed image into a floating-point grayscale image.

◆ cudaUYVYToRGBA() [1/2]

cudaError_t cudaUYVYToRGBA ( uchar2 *  input,
uchar4 *  output,
size_t  width,
size_t  height 
)

Convert a UYVY 422 packed image into RGBA uchar4.

◆ cudaUYVYToRGBA() [2/2]

cudaError_t cudaUYVYToRGBA ( uchar2 *  input,
size_t  inputPitch,
uchar4 *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert a UYVY 422 packed image into RGBA uchar4.

◆ cudaYUYVToGray() [1/2]

cudaError_t cudaYUYVToGray ( uchar2 *  input,
float *  output,
size_t  width,
size_t  height 
)

Convert a YUYV 422 packed image into a floating-point grayscale image.

◆ cudaYUYVToGray() [2/2]

cudaError_t cudaYUYVToGray ( uchar2 *  input,
size_t  inputPitch,
float *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert a YUYV 422 packed image into a floating-point grayscale image.

◆ cudaYUYVToRGBA() [1/2]

cudaError_t cudaYUYVToRGBA ( uchar2 *  input,
uchar4 *  output,
size_t  width,
size_t  height 
)

Convert a YUYV 422 packed image into RGBA uchar4.

◆ cudaYUYVToRGBA() [2/2]

cudaError_t cudaYUYVToRGBA ( uchar2 *  input,
size_t  inputPitch,
uchar4 *  output,
size_t  outputPitch,
size_t  width,
size_t  height 
)

Convert a YUYV 422 packed image into RGBA uchar4.