Skip to content

text_detectTextSWT

textfunctionOpenCV 5.0.0
import { text_detectTextSWT } from '@banou/opencv-wasm'

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

ARGUMENTSinput, result, dark_on_light, draw
FUNCTIONtext_detectTextSWT
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Applies the Stroke Width Transform operator followed by filtering of connected components of similar Stroke Widths to return letter candidates. It also chain them by proximity and size, saving the result in chainBBs.

text_detectTextSWT(input: Mat, result: RectVector, dark_on_light: boolean, draw: Mat, chainBBs: Mat): void;
3 available overloads
text_detectTextSWT(input: Mat, result: RectVector, dark_on_light: boolean): void;
text_detectTextSWT(input: Mat, result: RectVector, dark_on_light: boolean, draw: Mat): void;
text_detectTextSWT(input: Mat, result: RectVector, dark_on_light: boolean, draw: Mat, chainBBs: Mat): void;
input

the input image with 3 channels.

result

Output destination, filled by the native operation. a vector of resulting bounding boxes where probability of finding text is high

dark_on_light

a boolean value signifying whether the text is darker or lighter than the background, it is observed to reverse the gradient obtained from Scharr operator, and significantly affect the result.

draw

Output destination, filled by the native operation. an optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes.

chainBBs

Output destination, filled by the native operation. an optional parameter which chains the letter candidates according to heuristics in the paper and returns all possible regions where text is likely to occur.

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.