Jetson Inference
DNN Vision Library
|
Enumerations and helper functions for different types of image formats. More...
Enumerations | |
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... | |
Functions | |
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 (
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.
|
inline |
Get the base type of an image format (uint8 or float).
|
inline |
Get the number of image channels in each format.
For example, IMAGE_RGB8 has 3 channels, while IMAGE_RGBA8 has 4.
|
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.
|
inline |
Parse an imageFormat enum from a string.
|
inline |
Check if an image format is one of the Bayer formats.
|
inline |
Check if an image format is one of the BGR/BGRA formats.
|
inline |
Check if an image format is one of the grayscale formats.
|
inline |
Check if an image format is one of the RGB/RGBA formats.
|
inline |
Check if an image format is one of the YUV formats.
|
inline |
Compute the size of an image (in bytes)
|
inline |
Convert an imageFormat enum to a string.