OpenCV  3.1.0-dev
Open Source Computer Vision
Classes | Enumerations | Functions
cv::text Namespace Reference

Classes

class  BaseOCR
 
class  ERFilter
 Base class for 1st and 2nd stages of Neumann and Matas scene text detection algorithm [Neumann12]. : More...
 
struct  ERStat
 The ERStat structure represents a class-specific Extremal Region (ER). More...
 
class  OCRBeamSearchDecoder
 OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm. More...
 
class  OCRHMMDecoder
 OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models. More...
 
class  OCRTesseract
 OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++. More...
 

Enumerations

enum  {
  ERFILTER_NM_RGBLGrad,
  ERFILTER_NM_IHSGrad
}
 computeNMChannels operation modes More...
 
enum  {
  OCR_LEVEL_WORD,
  OCR_LEVEL_TEXTLINE
}
 
enum  decoder_mode { OCR_DECODER_VITERBI = 0 }
 
enum  erGrouping_Modes {
  ERGROUPING_ORIENTATION_HORIZ,
  ERGROUPING_ORIENTATION_ANY
}
 text::erGrouping operation modes More...
 

Functions

void computeNMChannels (InputArray _src, OutputArrayOfArrays _channels, int _mode=ERFILTER_NM_RGBLGrad)
 Compute the different channels to be processed independently in the N&M algorithm [Neumann12]. More...
 
Ptr< ERFiltercreateERFilterNM1 (const Ptr< ERFilter::Callback > &cb, int thresholdDelta=1, float minArea=(float) 0.00025, float maxArea=(float) 0.13, float minProbability=(float) 0.4, bool nonMaxSuppression=true, float minProbabilityDiff=(float) 0.1)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]. More...
 
Ptr< ERFiltercreateERFilterNM2 (const Ptr< ERFilter::Callback > &cb, float minProbability=(float) 0.3)
 Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]. More...
 
void createOCRHMMTransitionsTable (std::string &vocabulary, std::vector< std::string > &lexicon, OutputArray transition_probabilities_table)
 Utility function to create a tailored language model transitions table from a given list of words (lexicon). More...
 
Mat createOCRHMMTransitionsTable (const String &vocabulary, std::vector< cv::String > &lexicon)
 
void detectRegions (InputArray image, const Ptr< ERFilter > &er_filter1, const Ptr< ERFilter > &er_filter2, std::vector< std::vector< Point > > &regions)
 
void erGrouping (InputArray img, InputArrayOfArrays channels, std::vector< std::vector< ERStat > > &regions, std::vector< std::vector< Vec2i > > &groups, std::vector< Rect > &groups_rects, int method=ERGROUPING_ORIENTATION_HORIZ, const std::string &filename=std::string(), float minProbablity=0.5)
 Find groups of Extremal Regions that are organized as text blocks. More...
 
void erGrouping (InputArray image, InputArray channel, std::vector< std::vector< Point > > regions, std::vector< Rect > &groups_rects, int method=ERGROUPING_ORIENTATION_HORIZ, const String &filename=String(), float minProbablity=(float) 0.5)
 
Ptr< ERFilter::CallbackloadClassifierNM1 (const String &filename)
 Allow to implicitly load the default classifier when creating an ERFilter object. More...
 
Ptr< ERFilter::CallbackloadClassifierNM2 (const String &filename)
 Allow to implicitly load the default classifier when creating an ERFilter object. More...
 
Ptr< OCRBeamSearchDecoder::ClassifierCallbackloadOCRBeamSearchClassifierCNN (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object. More...
 
Ptr< OCRHMMDecoder::ClassifierCallbackloadOCRHMMClassifierCNN (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object. More...
 
Ptr< OCRHMMDecoder::ClassifierCallbackloadOCRHMMClassifierNM (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object. More...
 
void MSERsToERStats (InputArray image, std::vector< std::vector< Point > > &contours, std::vector< std::vector< ERStat > > &regions)
 Converts MSER contours (vector<Point>) to ERStat regions. More...
 

Function Documentation

void cv::text::createOCRHMMTransitionsTable ( std::string &  vocabulary,
std::vector< std::string > &  lexicon,
OutputArray  transition_probabilities_table 
)

Utility function to create a tailored language model transitions table from a given list of words (lexicon).

Parameters
vocabularyThe language vocabulary (chars when ascii english text).
lexiconThe list of words that are expected to be found in a particular image.
transition_probabilities_tableOutput table with transition probabilities between character pairs. cols == rows == vocabulary.size().

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
Mat cv::text::createOCRHMMTransitionsTable ( const String vocabulary,
std::vector< cv::String > &  lexicon 
)
Ptr<OCRBeamSearchDecoder::ClassifierCallback> cv::text::loadOCRBeamSearchClassifierCNN ( const String filename)

Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.

Parameters
filenameThe XML or YAML file with the classifier model (e.g. OCRBeamSearch_CNN_model_data.xml.gz)

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.