/** @brief Creates an instance of the OCRHMMDecoder class. Initializes HMMDecoder.
@param classifier The character classifier with built in feature extractor.
...
...
@@ -252,6 +265,15 @@ public:
// cols == rows == vocabulari.size()
decoder_modemode=OCR_DECODER_VITERBI);// HMM Decoding algorithm (only Viterbi for the moment)
CV_WRAPstaticPtr<OCRHMMDecoder>create(constPtr<OCRHMMDecoder::ClassifierCallback>classifier,// The character classifier with built in feature extractor
constString&vocabulary,// The language vocabulary (chars when ascii english text)
// size() must be equal to the number of classes
InputArraytransition_probabilities_table,// Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
InputArrayemission_probabilities_table,// Table with observation emission probabilities
// cols == rows == vocabulari.size()
intmode=OCR_DECODER_VITERBI);// HMM Decoding algorithm (only Viterbi for the moment)
protected:
Ptr<OCRHMMDecoder::ClassifierCallback>classifier;
...
...
@@ -272,7 +294,8 @@ based on gradient orientations along the chain-code of its perimeter. Then, the
using a KNN model trained with synthetic data of rendered characters with different standard font
* - (C++) An alternative would be to load the default generic language transition table provided in the text module samples folder (created from ispell 42869 english words list) :
/** @brief Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
@param classifier The character classifier with built in feature extractor.
...
...
@@ -401,6 +431,16 @@ public:
decoder_modemode=OCR_DECODER_VITERBI,// HMM Decoding algorithm (only Viterbi for the moment)
intbeam_size=500);// Size of the beam in Beam Search algorithm
CV_WRAPstaticPtr<OCRBeamSearchDecoder>create(constPtr<OCRBeamSearchDecoder::ClassifierCallback>classifier,// The character classifier with built in feature extractor
constString&vocabulary,// The language vocabulary (chars when ascii english text)
// size() must be equal to the number of classes
InputArraytransition_probabilities_table,// Table with transition probabilities between character pairs
// cols == rows == vocabulari.size()
InputArrayemission_probabilities_table,// Table with observation emission probabilities
// cols == rows == vocabulari.size()
intmode=OCR_DECODER_VITERBI,// HMM Decoding algorithm (only Viterbi for the moment)
intbeam_size=500);// Size of the beam in Beam Search algorithm