Calculates the width and height of a text string
[siz, baseLine] = cv.getTextSize(text)
[...] = cv.getTextSize(..., 'OptionName', optionValue, ...)
Input
Output
- siz Size of a box that contains the specified text
[w,h]
.
- baseLine y-coordinate of the baseline relative to the bottom-most
text point. The baseline is the line on which the bottoms of characters
such as 'a' and 'b' are aligned. Characters such as 'y' and 'g' hang below
the baseline.
Options
- FontFace Font to use. One of the following:
- HersheySimplex (default)
- HersheyPlain
- HersheyDuplex
- HersheyComplex
- HersheyTriplex
- HersheyComplexSmall
- HersheyScriptSimplex
- HersheyScriptComplex
- FontStyle Font style. One of:
- FontScale Font scale factor that is multiplied by the font-specific
base size. default 1.0
- Thickness Thickness of lines used to render the text. default 1
The function cv.getTextSize calculates and returns the size of a box that
contains the specified text.
Example
Refer to the draw_text_demo.m
sample. The code renders some text, the
tight box surrounding it, and the baseline.