Table of Contents

Method PutText

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

PutText(InputOutputArray, string, Point, HersheyFonts, double, Scalar, int, LineTypes, bool)

renders text string in the image

public static void PutText(InputOutputArray img, string text, Point org, HersheyFonts fontFace, double fontScale, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false)

Parameters

img InputOutputArray

Image.

text string

Text string to be drawn.

org Point

Bottom-left corner of the text string in the image.

fontFace HersheyFonts

Font type, see #HersheyFonts.

fontScale double

Font scale factor that is multiplied by the font-specific base size.

color Scalar

Text color.

thickness int

Thickness of the lines used to draw a text.

lineType LineTypes

Line type. See #LineTypes

bottomLeftOrigin bool

When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

PutText(InputOutputArray, string, Point, Scalar, FontFace, int, int, PutTextFlags, Range?)

Draws a text string using the specified TrueType font (OpenCV 5). Symbols that cannot be rendered using the specified font are replaced by question marks.

public static Point PutText(InputOutputArray img, string text, Point org, Scalar color, FontFace fontFace, int size, int weight = 0, PutTextFlags flags = PutTextFlags.AlignLeft, Range? wrap = null)

Parameters

img InputOutputArray

Image.

text string

Text string to be drawn (UTF-8 / Unicode is supported).

org Point

Bottom-left corner of the first character of the printed text (see PutTextFlags).

color Scalar

Text color.

fontFace FontFace

The font to use for the text.

size int

Font size in pixels (by default) or pts.

weight int

Font weight, 100..1000 (400 is "regular", 700 is "bold"). 0 uses the weight set via SetInstance(int[]).

flags PutTextFlags

Various flags, see PutTextFlags.

wrap Range?

Optional text wrapping range. Null uses the default behavior.

Returns

Point

The coordinates in pixels from where the text can be continued.