Skip to content

putText

Image processingfunctionOpenCV 5.0.0
import { putText } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSimg, text, org, fontFace
FUNCTIONputText
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Draws a text string.

The function cv::putText renders the specified text string in the image. Symbols that cannot be rendered using the specified font are replaced by question marks. See #getTextSize for a text rendering code example.

The fontScale parameter is a scale factor that is multiplied by the base font size:

  • When scale > 1, the text is magnified.
  • When 0 < scale < 1, the text is minimized.
  • When scale < 0, the text is mirrored or reversed.
putText(img: Mat, text: EmbindString, org: Point, fontFace: number, fontScale: number, color: Scalar, thickness: number, lineType: number, bottomLeftOrigin: boolean): void;
4 available overloads
putText(img: Mat, text: EmbindString, org: Point, fontFace: number, fontScale: number, color: Scalar): void;
putText(img: Mat, text: EmbindString, org: Point, fontFace: number, fontScale: number, color: Scalar, thickness: number): void;
putText(img: Mat, text: EmbindString, org: Point, fontFace: number, fontScale: number, color: Scalar, thickness: number, lineType: number): void;
putText(img: Mat, text: EmbindString, org: Point, fontFace: number, fontScale: number, color: Scalar, thickness: number, lineType: number, bottomLeftOrigin: boolean): void;
img

Input/output value, modified by the native operation. Image.

text

Text string to be drawn.

org

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

fontFace

Font type, see #HersheyFonts.

fontScale

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

color

Text color.

thickness

Thickness of the lines used to draw a text.

lineType

Line type. See #LineTypes

bottomLeftOrigin

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

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.