Jetson Inference
DNN Vision Library
|
TTF font rasterization and image overlay rendering using CUDA. More...
Classes | |
class | cudaFont |
TTF font rasterization and image overlay rendering using CUDA. More... | |
Functions | |
float | adaptFontSize (uint32_t dimension) |
Determine an appropriate font size given a particular dimension to use (typically an image's width). More... | |
TTF font rasterization and image overlay rendering using CUDA.
class cudaFont |
TTF font rasterization and image overlay rendering using CUDA.
Public Member Functions | |
~cudaFont () | |
Destructor. More... | |
bool | OverlayText (void *image, imageFormat format, uint32_t width, uint32_t height, const char *str, int x, int y, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5) |
Render text overlay onto image. More... | |
bool | OverlayText (void *image, imageFormat format, uint32_t width, uint32_t height, const std::vector< std::pair< std::string, int2 > > &text, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5) |
Render text overlay onto image. More... | |
template<typename T > | |
bool | OverlayText (T *image, uint32_t width, uint32_t height, const char *str, int x, int y, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5) |
Render text overlay onto image. More... | |
template<typename T > | |
bool | OverlayText (T *image, uint32_t width, uint32_t height, const std::vector< std::pair< std::string, int2 > > &text, const float4 &color=make_float4(0, 0, 0, 255), const float4 &background=make_float4(0, 0, 0, 0), int backgroundPadding=5) |
Render text overlay onto image. More... | |
float | GetSize () const |
Return the size of the font (height in pixels) More... | |
int4 | TextExtents (const char *str, int x=0, int y=0) |
Return the bounding rectangle of the given text string. More... | |
Static Public Member Functions | |
static cudaFont * | Create (float size=32.0f) |
Create new CUDA font overlay object using baked fonts. More... | |
static cudaFont * | Create (const char *font, float size) |
Create new CUDA font overlay object using baked fonts. More... | |
static cudaFont * | Create (const std::vector< std::string > &fonts, float size) |
Create new CUDA font overlay object using baked fonts. More... | |
Protected Member Functions | |
cudaFont () | |
bool | init (const char *font, float size) |
Protected Attributes | |
float | mSize |
uint8_t * | mFontMapCPU |
uint8_t * | mFontMapGPU |
int | mFontMapWidth |
int | mFontMapHeight |
void * | mCommandCPU |
void * | mCommandGPU |
int | mCmdIndex |
float4 * | mRectsCPU |
float4 * | mRectsGPU |
int | mRectIndex |
struct cudaFont::GlyphInfo | mGlyphInfo [NumGlyphs] |
Static Protected Attributes | |
static const uint32_t | MaxCommands = 1024 |
static const uint32_t | FirstGlyph = 32 |
static const uint32_t | LastGlyph = 255 |
static const uint32_t | NumGlyphs = LastGlyph - FirstGlyph |
cudaFont::~cudaFont | ( | ) |
Destructor.
|
protected |
|
static |
Create new CUDA font overlay object using baked fonts.
font | The name of the TTF font to use. |
size | The desired height of the font, in pixels. |
|
static |
Create new CUDA font overlay object using baked fonts.
font | A list of font names that are acceptable to use. If the first font isn't found on the system, then the next font from the list will be tried. |
size | The desired height of the font, in pixels. |
|
static |
Create new CUDA font overlay object using baked fonts.
size | The desired height of the font, in pixels. |
|
inline |
Return the size of the font (height in pixels)
|
protected |
|
inline |
Render text overlay onto image.
|
inline |
Render text overlay onto image.
bool cudaFont::OverlayText | ( | void * | image, |
imageFormat | format, | ||
uint32_t | width, | ||
uint32_t | height, | ||
const char * | str, | ||
int | x, | ||
int | y, | ||
const float4 & | color = make_float4(0, 0, 0, 255) , |
||
const float4 & | background = make_float4(0, 0, 0, 0) , |
||
int | backgroundPadding = 5 |
||
) |
Render text overlay onto image.
bool cudaFont::OverlayText | ( | void * | image, |
imageFormat | format, | ||
uint32_t | width, | ||
uint32_t | height, | ||
const std::vector< std::pair< std::string, int2 > > & | text, | ||
const float4 & | color = make_float4(0, 0, 0, 255) , |
||
const float4 & | background = make_float4(0, 0, 0, 0) , |
||
int | backgroundPadding = 5 |
||
) |
Render text overlay onto image.
int4 cudaFont::TextExtents | ( | const char * | str, |
int | x = 0 , |
||
int | y = 0 |
||
) |
Return the bounding rectangle of the given text string.
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
float adaptFontSize | ( | uint32_t | dimension | ) |
Determine an appropriate font size given a particular dimension to use (typically an image's width).
Then the font won't be radically unsized.
dimension | The dimension's size to fit against (i.e. image width) |