imutils-cpp
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Text Class Reference

The helps in writing text on images. More...

#include <text.h>

Static Public Member Functions

static void putText (cv::Mat &img, const std::string &text, cv::Point origin, int fontFace, double fontScale, cv::Scalar color, int thickness=1, int lineType=8, bool bottomLeftOrigin=false)
 Utility for drawing text with line breaks.
 
static void putCenteredText (cv::Mat &img, const std::string &text, int fontFace, double fontScale, cv::Scalar color, int thickness=1, int lineType=8)
 Utility for drawing vertically & horizontally centered text with line breaks.
 

Detailed Description

The helps in writing text on images.

Member Function Documentation

◆ putCenteredText()

static void Text::putCenteredText ( cv::Mat &  img,
const std::string &  text,
int  fontFace,
double  fontScale,
cv::Scalar  color,
int  thickness = 1,
int  lineType = 8 
)
static

Utility for drawing vertically & horizontally centered text with line breaks.

Parameters
imgImage
textText string to be drawn.
fontFaceFont type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_ITALIC to get the slanted letters.
fontScaleFont scale factor that is multiplied by the font-specific base size.
colorText color.
thicknessThickness of the lines used to draw a text.
lineTypeLine type. See the line for details. Otherwise, it is in the top-left corner.
Returns
None; image is modified in place

◆ putText()

static void Text::putText ( cv::Mat &  img,
const std::string &  text,
cv::Point  origin,
int  fontFace,
double  fontScale,
cv::Scalar  color,
int  thickness = 1,
int  lineType = 8,
bool  bottomLeftOrigin = false 
)
static

Utility for drawing text with line breaks.

Parameters
imgImage
textText string to be drawn.
originBottom-left corner of the first line of the text string in the image.
fontFaceFont type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX, FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRIPLEX, FONT_HERSHEY_COMPLEX_SMALL, FONT_HERSHEY_SCRIPT_SIMPLEX, or FONT_HERSHEY_SCRIPT_COMPLEX, where each of the font ID’s can be combined with FONT_ITALIC to get the slanted letters.
fontScaleFont scale factor that is multiplied by the font-specific base size.
colorText color.
thicknessThickness of the lines used to draw a text.
lineTypeLine type. See the line for details.
bottomLeftOriginWhen true, the image data origin is in the bottom-left corner. Otherwise, it is in the top-left corner.
Returns
None; image is modified in place

The documentation for this class was generated from the following file: