Jetson Inference
DNN Vision Library
imageFormat.h File Reference
#include "cudaUtility.h"
#include "imageFormat.inl"

Go to the source code of this file.

Classes

struct  imageFormatType< format >
 
struct  imageFormatType< IMAGE_RGB8 >
 
struct  imageFormatType< IMAGE_RGBA8 >
 
struct  imageFormatType< IMAGE_RGB32F >
 
struct  imageFormatType< IMAGE_RGBA32F >
 

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...
 
void imageFormatErrorMsg (const char *module, const char *function, imageFormat format)
 Print out an error message that the image format isn't supported. More...
 
Internal Type Templates
template<typename T >
imageFormat imageFormatFromType ()
 
template<>
imageFormat imageFormatFromType< uchar3 > ()
 
template<>
imageFormat imageFormatFromType< uchar4 > ()
 
template<>
imageFormat imageFormatFromType< float3 > ()
 
template<>
imageFormat imageFormatFromType< float4 > ()
 

Function Documentation

◆ imageFormatErrorMsg()

void imageFormatErrorMsg ( const char *  module,
const char *  function,
imageFormat  format 
)
inline

Print out an error message that the image format isn't supported.

It assumes the supported formats are rgb8, rgba8, rgb32f, rgba32f. The module string is normally LOG_CUDA, LOG_TRT, LOG_GSTREAMER, ect. The function string is normally the function name this was called from. The provided imageFormat is the format of the unsupported image.

◆ imageFormatFromType()

template<typename T >
imageFormat imageFormatFromType ( )
inline

◆ imageFormatFromType< float3 >()

template<>
imageFormat imageFormatFromType< float3 > ( )
inline

◆ imageFormatFromType< float4 >()

template<>
imageFormat imageFormatFromType< float4 > ( )
inline

◆ imageFormatFromType< uchar3 >()

template<>
imageFormat imageFormatFromType< uchar3 > ( )
inline

◆ imageFormatFromType< uchar4 >()

template<>
imageFormat imageFormatFromType< uchar4 > ( )
inline