dnn_TextRecognitionModel
import { dnn_TextRecognitionModel } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits dnn_Model.
This class represents high-level API for text recognition networks.
TextRecognitionModel allows to set params for preprocessing input image. TextRecognitionModel creates net from file with trained weights and config, sets preprocessing input, runs forward pass and return recognition result. For TextRecognitionModel, CRNN-CTC is supported.
Constructors and members
static new
Create text recognition model from network represented in one of the supported formats Call setDecodeType() and setVocabulary() after constructor to initialize the decoding method
new(model: EmbindString, config: EmbindString): dnn_TextRecognitionModel;2 available overloads
new(network: dnn_Net): dnn_TextRecognitionModel;new(model: EmbindString, config: EmbindString): dnn_TextRecognitionModel;networkNet object
modelBinary file contains trained weights
configText file contains network configuration
The dnn_TextRecognitionModel result.
static from1
Create an owned dnn_TextRecognitionModel instance with the supplied configuration.
This class represents high-level API for text recognition networks.
from1(_0: EmbindString): dnn_TextRecognitionModel | null;_00 argument (EmbindString).
The dnn_TextRecognitionModel | 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;The this result.
setDecodeType
Set the decoding method of translating the network output into string
setDecodeType(decodeType: EmbindString): dnn_TextRecognitionModel;decodeTypeThe decoding method of translating the network output into string, currently supported type:
"CTC-greedy"greedy decoding for the output of CTC-based methods"CTC-prefix-beam-search"Prefix beam search decoding for the output of CTC-based methods
The dnn_TextRecognitionModel result.
getDecodeType
Get the decoding method
getDecodeType(): string;the decoding method
setDecodeOptsCTCPrefixBeamSearch
Set the decoding method options for "CTC-prefix-beam-search" decode usage
setDecodeOptsCTCPrefixBeamSearch(beamSize: number, vocPruneSize: number): dnn_TextRecognitionModel;2 available overloads
setDecodeOptsCTCPrefixBeamSearch(beamSize: number): dnn_TextRecognitionModel;setDecodeOptsCTCPrefixBeamSearch(beamSize: number, vocPruneSize: number): dnn_TextRecognitionModel;beamSizeBeam size for search
vocPruneSizeParameter to optimize big vocabulary search, only take top
vocPruneSizetokens in each search step,vocPruneSize<= 0 stands for disable this prune.
The dnn_TextRecognitionModel result.
setVocabulary
Set the vocabulary for recognition.
setVocabulary(vocabulary: StringVector): dnn_TextRecognitionModel;vocabularythe associated vocabulary of the network.
The dnn_TextRecognitionModel result.
getVocabulary
Get the vocabulary for recognition.
getVocabulary(): StringVector;vocabulary the associated vocabulary Release returned native handles with using or delete(), including handles nested in results.
recognize
Given the input frame, create input blob, run net and return recognition result
recognize(frame: Mat): string;frameThe input image
The text recognition result
recognize1
Given the input frame, create input blob, run net and return recognition result
recognize1(frame: Mat, roiRects: MatVector, results: StringVector): void;frameThe input image
roiRectsList of text detection regions of interest (cv::Rect, CV_32SC4). ROIs is be cropped as the network inputs
resultsOutput destination, filled by the native operation. A set of text recognition results.
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.