docs/html/group__imageFormat.html
| | Jetson Inference
DNN Vision Library |
Image Formats Utilities Library (jetson-utils)
Enumerations and helper functions for different types of image formats. More...
|
|
| enum | imageFormat {
IMAGE_RGB8 =0, IMAGE_RGBA8, IMAGE_RGB32F, IMAGE_RGBA32F,
IMAGE_BGR8, IMAGE_BGRA8, IMAGE_BGR32F, IMAGE_BGRA32F,
IMAGE_YUYV, IMAGE_YUY2 =IMAGE_YUYV, IMAGE_YVYU, IMAGE_UYVY,
IMAGE_I420, IMAGE_YV12, IMAGE_NV12, IMAGE_BAYER_BGGR,
IMAGE_BAYER_GBRG, IMAGE_BAYER_GRBG, IMAGE_BAYER_RGGB, IMAGE_GRAY8,
IMAGE_GRAY32F, IMAGE_COUNT, IMAGE_UNKNOWN =999, IMAGE_DEFAULT =IMAGE_RGBA32F
} |
| | The imageFormat enum is used to identify the pixel format and colorspace of an image. More...
|
| |
| enum | imageBaseType { IMAGE_UINT8, IMAGE_FLOAT } |
| | The imageBaseType enum is used to identify the base data type of an imageFormat - either uint8 or float. More...
|
| |
|
|
| imageBaseType | imageFormatBaseType (imageFormat format) |
| | Get the base type of an image format (uint8 or float). More...
|
| |
| const char * | imageFormatToStr (imageFormat format) |
| | Convert an imageFormat enum to a string. More...
|
| |
| imageFormat | imageFormatFromStr (const char *str) |
| | Parse an imageFormat enum from a string. More...
|
| |
| size_t | imageFormatChannels (imageFormat format) |
| | Get the number of image channels in each format. More...
|
| |
| size_t | imageFormatDepth (imageFormat format) |
| | Get the pixel bit depth (in bits, not bytes). More...
|
| |
| size_t | imageFormatSize (imageFormat format, size_t width, size_t height) |
| | Compute the size of an image (in bytes) More...
|
| |
| bool | imageFormatIsRGB (imageFormat format) |
| | Check if an image format is one of the RGB/RGBA formats. More...
|
| |
| bool | imageFormatIsBGR (imageFormat format) |
| | Check if an image format is one of the BGR/BGRA formats. More...
|
| |
| bool | imageFormatIsYUV (imageFormat format) |
| | Check if an image format is one of the YUV formats. More...
|
| |
| bool | imageFormatIsGray (imageFormat format) |
| | Check if an image format is one of the grayscale formats. More...
|
| |
| bool | imageFormatIsBayer (imageFormat format) |
| | Check if an image format is one of the Bayer formats. More...
|
| |
Enumerations and helper functions for different types of image formats.
| enum imageBaseType |
The imageBaseType enum is used to identify the base data type of an imageFormat - either uint8 or float.
For example, the IMAGE_RGB8 format has a base type of uint8, while IMAGE_RGB32F is float.
You can retrieve the base type of each format with imageFormatBaseType()
| Enumerator |
|---|
| IMAGE_UINT8 |
| IMAGE_FLOAT |
| enum imageFormat |
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Supported data types are based on uint8 and float, with colorspaces including RGB/RGBA, BGR/BGRA, grayscale, YUV, and Bayer.
There are also a variety of helper functions available that provide info about each format at runtime - for example, the pixel bit depth (imageFormatDepth()) the number of image channels (imageFormatChannels()), and computing the size of an image from it's dimensions (
See alsoimageFormatSize()). To convert between Image I/O formats using the GPU, there is also the cudaConvertColor() function.
In addition to the enums below, each format can also be identified by a string. The string corresponding to each format is included in the documentation below. These strings are more commonly used from Python, but can also be used from C++ with the imageFormatFromStr() and imageFormatToStr() functions.
| Enumerator |
|---|
| IMAGE_RGB8 |
uchar3 RGB8 (‘'rgb8’`)
| | IMAGE_RGBA8 |
uchar4 RGBA8 (‘'rgba8’`)
| | IMAGE_RGB32F |
float3 RGB32F (‘'rgb32f’`)
| | IMAGE_RGBA32F |
float4 RGBA32F (‘'rgba32f’`)
| | IMAGE_BGR8 |
uchar3 BGR8 (‘'bgr8’`)
| | IMAGE_BGRA8 |
uchar4 BGRA8 (‘'bgra8’`)
| | IMAGE_BGR32F |
float3 BGR32F (‘'bgr32f’`)
| | IMAGE_BGRA32F |
float4 BGRA32F (‘'bgra32f’`)
| | IMAGE_YUYV |
YUV YUYV 4:2:2 packed (‘'yuyv’`)
| | IMAGE_YUY2 |
Duplicate of YUYV (‘'yuy2’`)
| | IMAGE_YVYU |
YUV YVYU 4:2:2 packed (‘'yvyu’`)
| | IMAGE_UYVY |
YUV UYVY 4:2:2 packed (‘'uyvy’`)
| | IMAGE_I420 |
YUV I420 4:2:0 planar (‘'i420’`)
| | IMAGE_YV12 |
YUV YV12 4:2:0 planar (‘'yv12’`)
| | IMAGE_NV12 |
YUV NV12 4:2:0 planar (‘'nv12’`)
| | IMAGE_BAYER_BGGR |
8-bit Bayer BGGR (‘'bayer-bggr’`)
| | IMAGE_BAYER_GBRG |
8-bit Bayer GBRG (‘'bayer-gbrg’`)
| | IMAGE_BAYER_GRBG |
8-bit Bayer GRBG (‘'bayer-grbg’`)
| | IMAGE_BAYER_RGGB |
8-bit Bayer RGGB (‘'bayer-rggb’`)
| | IMAGE_GRAY8 |
uint8 grayscale (‘'gray8’`)
| | IMAGE_GRAY32F |
float grayscale (‘'gray32f’`)
| | IMAGE_COUNT |
The number of image formats.
| | IMAGE_UNKNOWN |
Unknown/undefined format.
| | IMAGE_DEFAULT |
Default format (IMAGE_RGBA32F)
|
|
| imageBaseType imageFormatBaseType | ( | imageFormat | format | ) | |
| inline |
Get the base type of an image format (uint8 or float).
See alsoimageBaseType
|
| size_t imageFormatChannels | ( | imageFormat | format | ) | |
| inline |
Get the number of image channels in each format.
For example, IMAGE_RGB8 has 3 channels, while IMAGE_RGBA8 has 4.
|
| size_t imageFormatDepth | ( | imageFormat | format | ) | |
| inline |
Get the pixel bit depth (in bits, not bytes).
The bit depth is the size in bits of each pixel in the image. For example, IMAGE_RGB8 has a bit depth of 24. This function returns bits instead of bytes, because some formats have a bit depth that's not evenly divisible by 8 (a byte). YUV 4:2:0 formats like I420, YV12, and NV12 have a depth of 12 bits.
If you are calculating the overall size of an image, it's recommended to use the imageFormatSize() function instead. It will automatically convert to bytes.
|
| imageFormat imageFormatFromStr | ( | const char * | str | ) | |
| inline |
Parse an imageFormat enum from a string.
See alsoimageFormat for the strings that correspond to each format. Returnsthe imageFormat, or IMAGE_UNKNOWN on an unrecognized string.
|
| bool imageFormatIsBayer | ( | imageFormat | format | ) | |
| inline |
Check if an image format is one of the Bayer formats.
Returnstrue if the imageFormat is a Bayer format (IMAGE_BAYER_BGGR, IMAGE_BAYER_GBRG, IMAGE_BAYER_GRBG, IMAGE_BAYER_RGGB) otherwise, returns false.
|
| bool imageFormatIsBGR | ( | imageFormat | format | ) | |
| inline |
Check if an image format is one of the BGR/BGRA formats.
Returnstrue if the imageFormat is a BGR/BGRA format (IMAGE_BGR8, IMAGE_BGRA8, IMAGE_BGR32F, IMAGE_BGRA32F) otherwise, returns false.
|
| bool imageFormatIsGray | ( | imageFormat | format | ) | |
| inline |
Check if an image format is one of the grayscale formats.
Returnstrue if the imageFormat is grayscale (IMAGE_GRAY8, IMAGE_GRAY32) otherwise, returns false.
|
| bool imageFormatIsRGB | ( | imageFormat | format | ) | |
| inline |
Check if an image format is one of the RGB/RGBA formats.
Returnstrue if the imageFormat is a RGB/RGBA format (IMAGE_RGB8, IMAGE_RGBA8, IMAGE_RGB32F, IMAGE_RGBA32F) otherwise, returns false.
|
| bool imageFormatIsYUV | ( | imageFormat | format | ) | |
| inline |
Check if an image format is one of the YUV formats.
Returnstrue if the imageFormat is a YUV format (IMAGE_YUYV, IMAGE_YVYU, IMAGE_UYVY, IMAGE_I420, IMAGE_YV12, IMAGE_NV12) otherwise, returns false.
|
| size_t imageFormatSize | ( | imageFormat | format, | | | | size_t | width, | | | | size_t | height | | | ) | | |
| inline |
Compute the size of an image (in bytes)
|
| const char* imageFormatToStr | ( | imageFormat | format | ) | |
| inline |
Convert an imageFormat enum to a string.
See alsoimageFormat for the strings that correspond to each format.