text_detectTextSWT
import { text_detectTextSWT } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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;inputthe input image with 3 channels.
resultOutput destination, filled by the native operation. a vector of resulting bounding boxes where probability of finding text is high
dark_on_lighta 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.
drawOutput destination, filled by the native operation. an optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes.
chainBBsOutput 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.