OpenCV  3.2.0
Open Source Computer Vision
Classes | Functions
Drawing UTF-8 strings with freetype/harfbuzz


class  cv::freetype::FreeType2


Ptr< FreeType2cv::freetype::createFreeType2 ()
 Create FreeType2 Instance. More...
virtual void cv::freetype::FreeType2::loadFontData (String fontFileName, int id)=0
 Load font data. More...
virtual void cv::freetype::FreeType2::putText (InputOutputArray img, const String &text, Point org, int fontHeight, Scalar color, int thickness, int line_type, bool bottomLeftOrigin)=0
 Draws a text string. More...
virtual void cv::freetype::FreeType2::setSplitNumber (int num)=0
 Set Split Number from Bezier-curve to line. More...

Detailed Description

This modules is to draw UTF-8 strings with freetype/harfbuzz.

  1. Install freetype2 and harfbuzz in your system.
  2. Create FreeType2 instance with createFreeType2() function.
  3. Load font file with loadFontData() function.
  4. Draw text with putText() function.

Function Documentation

§ createFreeType2()

Ptr<FreeType2> cv::freetype::createFreeType2 ( )

Create FreeType2 Instance.

The function createFreeType2 create instance to draw UTF-8 strings.

§ loadFontData()

virtual void cv::freetype::FreeType2::loadFontData ( String  fontFileName,
int  id 
pure virtual

Load font data.

The function loadFontData loads font data.

fontFileNameFontFile Name
idface_index to select a font faces in a single file.

§ putText()

virtual void cv::freetype::FreeType2::putText ( InputOutputArray  img,
const String text,
Point  org,
int  fontHeight,
Scalar  color,
int  thickness,
int  line_type,
bool  bottomLeftOrigin 
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.

textText string to be drawn.
orgBottom-left/Top-left corner of the text string in the image.
fontHeightDrawing font size by pixel unit.
colorText color.
thicknessThickness of the lines used to draw a text when negative, the glyph is filled. Otherwise, the glyph is drawn with this thickness.
line_typeLine type. See the line for details.
bottomLeftOriginWhen true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

§ setSplitNumber()

virtual void cv::freetype::FreeType2::setSplitNumber ( int  num)
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.

numnumber of split points from bezier-curve to line