OpenCV  4.10.0
Open Source Computer Vision
Loading...
Searching...
No Matches
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 [204]. : 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  OCRHolisticWordRecognizer
 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. More...
 
class  OCRTesseract
 OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++. More...
 
class  TextDetector
 An abstract class providing interface for text detection algorithms. More...
 
class  TextDetectorCNN
 TextDetectorCNN class provides the functionallity of text bounding box detection. This class is representing to find bounding boxes of text words given an input image. This class uses OpenCV dnn module to load pre-trained model described in [165]. The original repository with the modified SSD Caffe version: https://github.com/MhLiao/TextBoxes. Model can be downloaded from DropBox. Modified .prototxt file with the model description can be found in opencv_contrib/modules/text/samples/textbox.prototxt. More...
 

Enumerations

enum  {
  ERFILTER_NM_RGBLGrad ,
  ERFILTER_NM_IHSGrad
}
 computeNMChannels operation modes More...
 
enum  {
  OCR_LEVEL_WORD ,
  OCR_LEVEL_TEXTLINE
}
 
enum  classifier_type {
  OCR_KNN_CLASSIFIER = 0 ,
  OCR_CNN_CLASSIFIER = 1
}
 
enum  decoder_mode { OCR_DECODER_VITERBI = 0 }
 
enum  erGrouping_Modes {
  ERGROUPING_ORIENTATION_HORIZ ,
  ERGROUPING_ORIENTATION_ANY
}
 text::erGrouping operation modes More...
 
enum  ocr_engine_mode {
  OEM_TESSERACT_ONLY ,
  OEM_CUBE_ONLY ,
  OEM_TESSERACT_CUBE_COMBINED ,
  OEM_DEFAULT
}
 Tesseract.OcrEngineMode Enumeration. More...
 
enum  page_seg_mode {
  PSM_OSD_ONLY ,
  PSM_AUTO_OSD ,
  PSM_AUTO_ONLY ,
  PSM_AUTO ,
  PSM_SINGLE_COLUMN ,
  PSM_SINGLE_BLOCK_VERT_TEXT ,
  PSM_SINGLE_BLOCK ,
  PSM_SINGLE_LINE ,
  PSM_SINGLE_WORD ,
  PSM_CIRCLE_WORD ,
  PSM_SINGLE_CHAR
}
 Tesseract.PageSegMode Enumeration. 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 [204].
 
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 [204].
 
Ptr< ERFiltercreateERFilterNM1 (const String &filename, 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)
 Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm from the provided path e.g. /path/to/cpp/trained_classifierNM1.xml.
 
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 [204].
 
Ptr< ERFiltercreateERFilterNM2 (const String &filename, float minProbability=(float) 0.3)
 Reads an Extremal Region Filter for the 2nd stage classifier of N&M algorithm from the provided path e.g. /path/to/cpp/trained_classifierNM2.xml.
 
Mat createOCRHMMTransitionsTable (const String &vocabulary, std::vector< cv::String > &lexicon)
 
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).
 
void detectRegions (InputArray image, const Ptr< ERFilter > &er_filter1, const Ptr< ERFilter > &er_filter2, std::vector< Rect > &groups_rects, int method=ERGROUPING_ORIENTATION_HORIZ, const String &filename=String(), float minProbability=(float) 0.5)
 Extracts text regions from image.
 
void detectRegions (InputArray image, const Ptr< ERFilter > &er_filter1, const Ptr< ERFilter > &er_filter2, std::vector< std::vector< Point > > &regions)
 
void detectTextSWT (InputArray input, std::vector< cv::Rect > &result, bool dark_on_light, OutputArray &draw=noArray(), OutputArray &chainBBs=noArray())
 Applies the Stroke Width Transform operator followed by filtering of connected components of similar Stroke Widths to return letter candidates. It also chain them by proximity and size, saving the result in chainBBs.
 
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)
 
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.
 
Ptr< ERFilter::CallbackloadClassifierNM1 (const String &filename)
 Allow to implicitly load the default classifier when creating an ERFilter object.
 
Ptr< ERFilter::CallbackloadClassifierNM2 (const String &filename)
 Allow to implicitly load the default classifier when creating an ERFilter object.
 
Ptr< OCRBeamSearchDecoder::ClassifierCallbackloadOCRBeamSearchClassifierCNN (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.
 
Ptr< OCRHMMDecoder::ClassifierCallbackloadOCRHMMClassifier (const String &filename, int classifier)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
Ptr< OCRHMMDecoder::ClassifierCallbackloadOCRHMMClassifierCNN (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
Ptr< OCRHMMDecoder::ClassifierCallbackloadOCRHMMClassifierNM (const String &filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
void MSERsToERStats (InputArray image, std::vector< std::vector< Point > > &contours, std::vector< std::vector< ERStat > > &regions)
 Converts MSER contours (vector<Point>) to ERStat regions.
 

Function Documentation

◆ detectTextSWT()

void cv::text::detectTextSWT ( InputArray  input,
std::vector< cv::Rect > &  result,
bool  dark_on_light,
OutputArray draw = noArray(),
OutputArray chainBBs = noArray() 
)
Python:
cv.text.detectTextSWT(input, dark_on_light[, draw[, chainBBs]]) -> result, draw, chainBBs

Applies the Stroke Width Transform operator followed by filtering of connected components of similar Stroke Widths to return letter candidates. It also chain them by proximity and size, saving the result in chainBBs.

Parameters
inputthe input image with 3 channels.
resulta vector of resulting bounding boxes where probability of finding text is high
dark_on_lighta boolean value signifying whether the text is darker or lighter than the background, it is observed to reverse the gradient obtained from Scharr operator, and significantly affect the result.
drawan optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes.
chainBBsan optional parameter which chains the letter candidates according to heuristics in the paper and returns all possible regions where text is likely to occur.