OpenCV 4.10.0-dev
Open Source Computer Vision
|
#include <opencv2/freetype.hpp>
Public Member Functions | |
virtual Size | getTextSize (const String &text, int fontHeight, int thickness, int *baseLine)=0 |
Calculates the width and height of a text string. | |
virtual void | loadFontData (char *pBuf, size_t bufSize, int idx)=0 |
Load font data. | |
virtual void | loadFontData (String fontFileName, int idx)=0 |
Load font data. | |
virtual void | putText (InputOutputArray img, const String &text, Point org, int fontHeight, Scalar color, int thickness, int line_type, bool bottomLeftOrigin)=0 |
Draws a text string. | |
virtual void | setSplitNumber (int num)=0 |
Set Split Number from Bezier-curve to line. | |
Public Member Functions inherited from cv::Algorithm | |
Algorithm () | |
virtual | ~Algorithm () |
virtual void | clear () |
Clears the algorithm state. | |
virtual bool | empty () const |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. | |
virtual String | getDefaultName () const |
virtual void | read (const FileNode &fn) |
Reads algorithm parameters from a file storage. | |
virtual void | save (const String &filename) const |
void | write (const Ptr< FileStorage > &fs, const String &name=String()) const |
virtual void | write (FileStorage &fs) const |
Stores algorithm parameters in a file storage. | |
void | write (FileStorage &fs, const String &name) const |
Additional Inherited Members | |
Static Public Member Functions inherited from cv::Algorithm | |
template<typename _Tp > | |
static Ptr< _Tp > | load (const String &filename, const String &objname=String()) |
Loads algorithm from the file. | |
template<typename _Tp > | |
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String()) |
Loads algorithm from a String. | |
template<typename _Tp > | |
static Ptr< _Tp > | read (const FileNode &fn) |
Reads algorithm from the file node. | |
Protected Member Functions inherited from cv::Algorithm | |
void | writeFormat (FileStorage &fs) const |
|
pure virtual |
Calculates the width and height of a text string.
The function getTextSize calculates and returns the approximate size of a box that contains the specified text. That is, the following code renders some text, the tight box surrounding it, and the baseline: :
text | Input text string. | |
fontHeight | Drawing font size by pixel unit. | |
thickness | Thickness of lines used to render the text. See putText for details. | |
[out] | baseLine | y-coordinate of the baseline relative to the bottom-most text point. |
|
pure virtual |
Load font data.
The function loadFontData loads font data from memory. The data is not copied, the user needs to make sure the data lives at least as long as FreeType2. After the FreeType2 object is destroyed, the buffer can be safely deallocated.
pBuf | pointer to buffer containing font data |
bufSize | size of buffer |
idx | face_index to select a font faces in a single file. |
|
pure virtual |
Load font data.
The function loadFontData loads font data from file.
fontFileName | FontFile Name |
idx | face_index to select a font faces in a single file. |
|
pure virtual |
Draws a text string.
The function putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by "Tofu" or non-drawn.
img | Image. (Only 8UC1/8UC3/8UC4 2D mat is supported.) |
text | Text string to be drawn. |
org | Bottom-left/Top-left corner of the text string in the image. |
fontHeight | Drawing font size by pixel unit. |
color | Text color. |
thickness | Thickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness. |
line_type | Line type. See the line for details. |
bottomLeftOrigin | When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner. |
|
pure virtual |
Set Split Number from Bezier-curve to line.
The function setSplitNumber set the number of split points from bezier-curve to line. If you want to draw large glyph, large is better. If you want to draw small glyph, small is better.
num | number of split points from bezier-curve to line |