Scene Text Recognition#
Detailed Description#
Classes#
Name |
Description |
|---|---|
|
|
OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm. View details |
|
|
OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models. View details |
OCRHolisticWordRecognizer class provides the functionallity of segmented wordspotting. Given a predefined vocabulary , a DictNet is employed to select the most probable word given an input image. View details |
|
|
OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++. View details |
Enumerations#
enum cv::text {
cv::OCR_LEVEL_WORD,
cv::OCR_LEVEL_TEXTLINE
}
enum cv::text::decoder_mode {
cv::text::OCR_DECODER_VITERBI = 0
}Tesseract.OcrEngineMode Enumeration. View details
enum cv::text::page_seg_mode {
cv::text::PSM_OSD_ONLY,
cv::text::PSM_AUTO_OSD,
cv::text::PSM_AUTO_ONLY,
cv::text::PSM_AUTO,
cv::text::PSM_SINGLE_COLUMN,
cv::text::PSM_SINGLE_BLOCK_VERT_TEXT,
cv::text::PSM_SINGLE_BLOCK,
cv::text::PSM_SINGLE_LINE,
cv::text::PSM_SINGLE_WORD,
cv::text::PSM_CIRCLE_WORD,
cv::text::PSM_SINGLE_CHAR
}Tesseract.PageSegMode Enumeration. View details
Enumeration Type Documentation#
enum#
#include <opencv2/text/ocr.hpp>
Enumerator:
|
|
classifier_type#
enum cv::text::classifier_type
#include <opencv2/text/ocr.hpp>
Enumerator:
|
|
decoder_mode#
#include <opencv2/text/ocr.hpp>
Enumerator:
|
ocr_engine_mode#
enum cv::text::ocr_engine_mode
#include <opencv2/text/ocr.hpp>
Tesseract.OcrEngineMode Enumeration.
Enumerator:
|
|
|
|
page_seg_mode#
#include <opencv2/text/ocr.hpp>
Tesseract.PageSegMode Enumeration.
Enumerator:
|
|
|
|
|
|
|
|
|
|
|
Function Documentation#
createOCRHMMTransitionsTable()#
Mat cv::text::createOCRHMMTransitionsTable(
const String & vocabulary,
std::vector< cv::String > & lexicon )
#include <opencv2/text/ocr.hpp>
Python:
cv.text.createOCRHMMTransitionsTable(vocabulary, lexicon) -> retval
createOCRHMMTransitionsTable()#
void cv::text::createOCRHMMTransitionsTable(
std::string & vocabulary,
std::vector< std::string > & lexicon,
OutputArray transition_probabilities_table )
#include <opencv2/text/ocr.hpp>
Python:
cv.text.createOCRHMMTransitionsTable(vocabulary, lexicon) -> retval
Utility function to create a tailored language model transitions table from a given list of words (lexicon).
The function calculate frequency statistics of character pairs from the given lexicon and fills the output transition_probabilities_table with them. The transition_probabilities_table can be used as input in the OCRHMMDecoder::create() and OCRBeamSearchDecoder::create() methods.
Note
(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) : opencv/opencv_contrib
Parameters
vocabulary— The language vocabulary (chars when ASCII English text).lexicon— The list of words that are expected to be found in a particular image.transition_probabilities_table— Output table with transition probabilities between character pairs. cols == rows == vocabulary.size().
loadOCRBeamSearchClassifierCNN()#
Ptr< OCRBeamSearchDecoder::ClassifierCallback > cv::text::loadOCRBeamSearchClassifierCNN(const String & filename)
#include <opencv2/text/ocr.hpp>
Python:
cv.text.loadOCRBeamSearchClassifierCNN(filename) -> retval
Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.
The CNN default classifier is based in the scene text recognition method proposed by Adam Coates & Andrew NG in [Coates11a]. The character classifier consists in a Single Layer Convolutional Neural Network and a linear classifier. It is applied to the input image in a sliding window fashion, providing a set of recognitions at each window location.
Parameters
filename— The XML or YAML file with the classifier model (e.g. OCRBeamSearch_CNN_model_data.xml.gz)
loadOCRHMMClassifier()#
Ptr< OCRHMMDecoder::ClassifierCallback > cv::text::loadOCRHMMClassifier(
const String & filename,
int classifier )
#include <opencv2/text/ocr.hpp>
Python:
cv.text.loadOCRHMMClassifier(filename, classifier) -> retval
Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
Parameters
filename— The XML or YAML file with the classifier model (e.g. OCRBeamSearch_CNN_model_data.xml.gz)classifier— Can be one of classifier_type enum values.
loadOCRHMMClassifierCNN()#
Ptr< OCRHMMDecoder::ClassifierCallback > cv::text::loadOCRHMMClassifierCNN(const String & filename)
#include <opencv2/text/ocr.hpp>
Python:
cv.text.loadOCRHMMClassifierCNN(filename) -> retval
Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
The CNN default classifier is based in the scene text recognition method proposed by Adam Coates & Andrew NG in [Coates11a]. The character classifier consists in a Single Layer Convolutional Neural Network and a linear classifier. It is applied to the input image in a sliding window fashion, providing a set of recognitions at each window location.
Deprecated
use loadOCRHMMClassifier instead
Parameters
filename— The XML or YAML file with the classifier model (e.g. OCRBeamSearch_CNN_model_data.xml.gz)
loadOCRHMMClassifierNM()#
Ptr< OCRHMMDecoder::ClassifierCallback > cv::text::loadOCRHMMClassifierNM(const String & filename)
#include <opencv2/text/ocr.hpp>
Python:
cv.text.loadOCRHMMClassifierNM(filename) -> retval
Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
The KNN default classifier is based in the scene text recognition method proposed by Lukás Neumann & Jiri Matas in [Neumann11b]. Basically, the region (contour) in the input image is normalized to a fixed size, while retaining the centroid and aspect ratio, in order to extract a feature vector based on gradient orientations along the chain-code of its perimeter. Then, the region is classified using a KNN model trained with synthetic data of rendered characters with different standard font types.
Deprecated
loadOCRHMMClassifier instead
Parameters
filename— The XML or YAML file with the classifier model (e.g. OCRHMM_knn_model_data.xml)