Skip to content

text_OCRHMMDecoder

textclassOpenCV 5.0.0
import { text_OCRHMMDecoder } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASStext_OCRHMMDecoder
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits text_BaseOCR.

OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models.

Note: - (C++) An example on using OCRHMMDecoder recognition combined with scene text detection can be found at the webcam_demo sample: https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp

Constructors and members

static create1

HMM Decoding algorithm (only Viterbi for the moment) Creates an instance of the OCRHMMDecoder class. Loads and initializes HMMDecoder from the specified path

create1(filename: EmbindString, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat, mode: number, classifier: number): text_OCRHMMDecoder | null;
3 available overloads
create1(filename: EmbindString, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat): text_OCRHMMDecoder | null;
create1(filename: EmbindString, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat, mode: number): text_OCRHMMDecoder | null;
create1(filename: EmbindString, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat, mode: number, classifier: number): text_OCRHMMDecoder | null;
filename

filename argument (EmbindString).

vocabulary

vocabulary argument (EmbindString).

transition_probabilities_table

transition probabilities table argument (Mat).

emission_probabilities_table

emission probabilities table argument (Mat).

mode

mode argument (number).

classifier

classifier argument (number).

Returns

The text_OCRHMMDecoder | null result.

static create

Creates an instance of the OCRHMMDecoder class. Initializes HMMDecoder.

create(classifier: text_OCRHMMDecoder_ClassifierCallback | null, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat, mode: number): text_OCRHMMDecoder | null;
2 available overloads
create(classifier: text_OCRHMMDecoder_ClassifierCallback | null, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat): text_OCRHMMDecoder | null;
create(classifier: text_OCRHMMDecoder_ClassifierCallback | null, vocabulary: EmbindString, transition_probabilities_table: Mat, emission_probabilities_table: Mat, mode: number): text_OCRHMMDecoder | null;
classifier

The character classifier with built in feature extractor.

vocabulary

The language vocabulary (chars when ascii english text). vocabulary.size() must be equal to the number of classes of the classifier.

transition_probabilities_table

Table with transition probabilities between character pairs. cols == rows == vocabulary.size().

emission_probabilities_table

Table with observation emission probabilities. cols == rows == vocabulary.size().

mode

HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (http://en.wikipedia.org/wiki/Viterbi_algorithm).

Returns

The text_OCRHMMDecoder | null result.

clone

Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.

clone(): this;
Returns

The this result.

run

aliases for scripting

run(image: Mat, min_confidence: number, component_level: number): string;
2 available overloads
run(image: Mat, min_confidence: number): string;
run(image: Mat, min_confidence: number, component_level: number): string;
image

image argument (Mat).

min_confidence

min confidence argument (number).

component_level

component level argument (number).

Returns

The string result.

run1

aliases for scripting

run1(image: Mat, mask: Mat, min_confidence: number, component_level: number): string;
2 available overloads
run1(image: Mat, mask: Mat, min_confidence: number): string;
run1(image: Mat, mask: Mat, min_confidence: number, component_level: number): string;
image

image argument (Mat).

mask

mask argument (Mat).

min_confidence

min confidence argument (number).

component_level

component level argument (number).

Returns

The string result.

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.