OpenCV for Unity 2.6.3
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Loading...
Searching...
No Matches
OpenCVForUnity.TextModule.Text Class Reference

Static Public Member Functions

static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression, float minProbabilityDiff)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta, float minArea)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb, int thresholdDelta)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (ERFilter_Callback cb)
 Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM2 (ERFilter_Callback cb, float minProbability)
 Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM2 (ERFilter_Callback cb)
 Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12].
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression, float minProbabilityDiff)
 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.
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability, bool nonMaxSuppression)
 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.
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea, float minProbability)
 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.
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea, float maxArea)
 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.
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta, float minArea)
 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.
 
static ERFilter createERFilterNM1 (string filename, int thresholdDelta)
 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.
 
static ERFilter createERFilterNM1 (string filename)
 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.
 
static ERFilter createERFilterNM2 (string filename, float minProbability)
 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.
 
static ERFilter createERFilterNM2 (string filename)
 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.
 
static ERFilter_Callback loadClassifierNM1 (string filename)
 Allow to implicitly load the default classifier when creating an ERFilter object.
 
static ERFilter_Callback loadClassifierNM2 (string filename)
 Allow to implicitly load the default classifier when creating an ERFilter object.
 
static void computeNMChannels (Mat _src, List< Mat > _channels, int _mode)
 Compute the different channels to be processed independently in the N&M algorithm [Neumann12].
 
static void computeNMChannels (Mat _src, List< Mat > _channels)
 Compute the different channels to be processed independently in the N&M algorithm [Neumann12].
 
static void erGrouping (Mat image, Mat channel, List< MatOfPoint > regions, MatOfRect groups_rects, int method, string filename, float minProbablity)
 Find groups of Extremal Regions that are organized as text blocks.
 
static void erGrouping (Mat image, Mat channel, List< MatOfPoint > regions, MatOfRect groups_rects, int method, string filename)
 Find groups of Extremal Regions that are organized as text blocks.
 
static void erGrouping (Mat image, Mat channel, List< MatOfPoint > regions, MatOfRect groups_rects, int method)
 Find groups of Extremal Regions that are organized as text blocks.
 
static void erGrouping (Mat image, Mat channel, List< MatOfPoint > regions, MatOfRect groups_rects)
 Find groups of Extremal Regions that are organized as text blocks.
 
static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, List< MatOfPoint > regions)
 Converts MSER contours (vector<Point>) to ERStat regions.
 
static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, string filename, float minProbability)
 Extracts text regions from image.
 
static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, string filename)
 Extracts text regions from image.
 
static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method)
 Extracts text regions from image.
 
static void detectRegions (Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects)
 Extracts text regions from image.
 
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierNM (string filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierCNN (string filename)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifier (string filename, int classifier)
 Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
 
static Mat createOCRHMMTransitionsTable (string vocabulary, List< string > lexicon)
 Utility function to create a tailored language model transitions table from a given list of words (lexicon).
 
static OCRBeamSearchDecoder_ClassifierCallback loadOCRBeamSearchClassifierCNN (string filename)
 Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.
 
static void detectTextSWT (Mat input, MatOfRect result, bool dark_on_light, Mat draw, Mat 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.
 
static void detectTextSWT (Mat input, MatOfRect result, bool dark_on_light, Mat draw)
 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.
 
static void detectTextSWT (Mat input, MatOfRect result, bool dark_on_light)
 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.
 

Static Public Attributes

const int ERFILTER_NM_RGBLGrad = 0
 
const int ERFILTER_NM_IHSGrad = 1
 
const int OCR_LEVEL_WORD = 0
 
const int OCR_LEVEL_TEXTLINE = 1
 
const int OCR_KNN_CLASSIFIER = 0
 
const int OCR_CNN_CLASSIFIER = 1
 
const int OCR_DECODER_VITERBI = 0
 
const int ERGROUPING_ORIENTATION_HORIZ = 0
 
const int ERGROUPING_ORIENTATION_ANY = 1
 
const int OEM_TESSERACT_ONLY = 0
 
const int OEM_CUBE_ONLY = 1
 
const int OEM_TESSERACT_CUBE_COMBINED = 2
 
const int OEM_DEFAULT = 3
 
const int PSM_OSD_ONLY = 0
 
const int PSM_AUTO_OSD = 1
 
const int PSM_AUTO_ONLY = 2
 
const int PSM_AUTO = 3
 
const int PSM_SINGLE_COLUMN = 4
 
const int PSM_SINGLE_BLOCK_VERT_TEXT = 5
 
const int PSM_SINGLE_BLOCK = 6
 
const int PSM_SINGLE_LINE = 7
 
const int PSM_SINGLE_WORD = 8
 
const int PSM_CIRCLE_WORD = 9
 
const int PSM_SINGLE_CHAR = 10
 

Member Function Documentation

◆ computeNMChannels() [1/2]

static void OpenCVForUnity.TextModule.Text.computeNMChannels ( Mat _src,
List< Mat > _channels )
static

Compute the different channels to be processed independently in the N&M algorithm [Neumann12].

Parameters
_srcSource image. Must be RGB CV_8UC3.
_channelsOutput vector<Mat> where computed channels are stored.
_modeMode of operation. Currently the only available options are: *ERFILTER_NM_RGBLGrad** (used by default) and ERFILTER_NM_IHSGrad.

In N&M algorithm, the combination of intensity (I), hue (H), saturation (S), and gradient magnitude channels (Grad) are used in order to obtain high localization recall. This implementation also provides an alternative combination of red (R), green (G), blue (B), lightness (L), and gradient magnitude (Grad).

◆ computeNMChannels() [2/2]

static void OpenCVForUnity.TextModule.Text.computeNMChannels ( Mat _src,
List< Mat > _channels,
int _mode )
static

Compute the different channels to be processed independently in the N&M algorithm [Neumann12].

Parameters
_srcSource image. Must be RGB CV_8UC3.
_channelsOutput vector<Mat> where computed channels are stored.
_modeMode of operation. Currently the only available options are: *ERFILTER_NM_RGBLGrad** (used by default) and ERFILTER_NM_IHSGrad.

In N&M algorithm, the combination of intensity (I), hue (H), saturation (S), and gradient magnitude channels (Grad) are used in order to obtain high localization recall. This implementation also provides an alternative combination of red (R), green (G), blue (B), lightness (L), and gradient magnitude (Grad).

◆ createERFilterNM1() [1/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb)
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [2/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [3/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta,
float minArea )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [4/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [5/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [6/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
bool nonMaxSuppression )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [7/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
bool nonMaxSuppression,
float minProbabilityDiff )
static

Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml
thresholdDelta: Threshold step in subsequent thresholds when extracting the component tree
minArea: The minimum area (% of image size) allowed for retreived ER's
maxArea: The maximum area (% of image size) allowed for retreived ER's
minProbability: The minimum probability P(er|character) allowed for retreived ER's
nonMaxSuppression: Whenever non-maximum suppression is done over the branch probabilities
minProbabilityDiff: The minimum probability difference between local maxima and local minima ERs

The component tree of the image is extracted by a threshold increased step by step from 0 to 255, incrementally computable descriptors (aspect_ratio, compactness, number of holes, and number of horizontal crossings) are computed for each ER and used as features for a classifier which estimates the class-conditional probability P(er|character). The value of P(er|character) is tracked using the inclusion relation of ER across all thresholds and only the ERs which correspond to local maximum of the probability P(er|character) are selected (if the local maximum of the probability is above a global limit pmin and the difference between local maximum and local minimum is greater than minProbabilityDiff).

◆ createERFilterNM1() [8/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename)
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [9/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [10/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta,
float minArea )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [11/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta,
float minArea,
float maxArea )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [12/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [13/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
bool nonMaxSuppression )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM1() [14/14]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM1 ( string filename,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
bool nonMaxSuppression,
float minProbabilityDiff )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM2() [1/4]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM2 ( ERFilter_Callback cb)
static

Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM2, e.g. from file in samples/cpp/trained_classifierNM2.xml
minProbability: The minimum probability P(er|character) allowed for retreived ER's

In the second stage, the ERs that passed the first stage are classified into character and non-character classes using more informative but also more computationally expensive features. The classifier uses all the features calculated in the first stage and the following additional features: hole area ratio, convex hull ratio, and number of outer inflexion points.

◆ createERFilterNM2() [2/4]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM2 ( ERFilter_Callback cb,
float minProbability )
static

Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12].

Parameters
cb: Callback with the classifier. Default classifier can be implicitly load with function loadClassifierNM2, e.g. from file in samples/cpp/trained_classifierNM2.xml
minProbability: The minimum probability P(er|character) allowed for retreived ER's

In the second stage, the ERs that passed the first stage are classified into character and non-character classes using more informative but also more computationally expensive features. The classifier uses all the features calculated in the first stage and the following additional features: hole area ratio, convex hull ratio, and number of outer inflexion points.

◆ createERFilterNM2() [3/4]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM2 ( string filename)
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createERFilterNM2() [4/4]

static ERFilter OpenCVForUnity.TextModule.Text.createERFilterNM2 ( string filename,
float minProbability )
static

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.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ createOCRHMMTransitionsTable()

static Mat OpenCVForUnity.TextModule.Text.createOCRHMMTransitionsTable ( string vocabulary,
List< string > lexicon )
static

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

◆ detectRegions() [1/5]

static void OpenCVForUnity.TextModule.Text.detectRegions ( Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
List< MatOfPoint > regions )
static

Converts MSER contours (vector<Point>) to ERStat regions.

Parameters
imageSource image CV_8UC1 from which the MSERs where extracted.
contoursInput vector with all the contours (vector<Point>).
regionsOutput where the ERStat regions are stored.

It takes as input the contours provided by the OpenCV MSER feature detector and returns as output two vectors of ERStats. This is because MSER() output contains both MSER+ and MSER- regions in a single vector<Point>, the function separates them in two different vectors (this is as if the ERStats where extracted from two different channels).

An example of MSERsToERStats in use can be found in the text detection webcam_demo: <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/webcam_demo.cpp&gt;

◆ detectRegions() [2/5]

static void OpenCVForUnity.TextModule.Text.detectRegions ( Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects )
static

Extracts text regions from image.

Parameters
imageSource image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]
er_filter2Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]
groups_rectsOutput list of rectangle blocks with text
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbabilityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ detectRegions() [3/5]

static void OpenCVForUnity.TextModule.Text.detectRegions ( Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method )
static

Extracts text regions from image.

Parameters
imageSource image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]
er_filter2Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]
groups_rectsOutput list of rectangle blocks with text
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbabilityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ detectRegions() [4/5]

static void OpenCVForUnity.TextModule.Text.detectRegions ( Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method,
string filename )
static

Extracts text regions from image.

Parameters
imageSource image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]
er_filter2Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]
groups_rectsOutput list of rectangle blocks with text
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbabilityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ detectRegions() [5/5]

static void OpenCVForUnity.TextModule.Text.detectRegions ( Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method,
string filename,
float minProbability )
static

Extracts text regions from image.

Parameters
imageSource image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1Extremal Region Filter for the 1st stage classifier of N&M algorithm [Neumann12]
er_filter2Extremal Region Filter for the 2nd stage classifier of N&M algorithm [Neumann12]
groups_rectsOutput list of rectangle blocks with text
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbabilityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ detectTextSWT() [1/3]

static void OpenCVForUnity.TextModule.Text.detectTextSWT ( Mat input,
MatOfRect result,
bool dark_on_light )
static

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.

◆ detectTextSWT() [2/3]

static void OpenCVForUnity.TextModule.Text.detectTextSWT ( Mat input,
MatOfRect result,
bool dark_on_light,
Mat draw )
static

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.

◆ detectTextSWT() [3/3]

static void OpenCVForUnity.TextModule.Text.detectTextSWT ( Mat input,
MatOfRect result,
bool dark_on_light,
Mat draw,
Mat chainBBs )
static

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.

◆ erGrouping() [1/4]

static void OpenCVForUnity.TextModule.Text.erGrouping ( Mat image,
Mat channel,
List< MatOfPoint > regions,
MatOfRect groups_rects )
static

Find groups of Extremal Regions that are organized as text blocks.

Parameters
imgOriginal RGB or Greyscale image from wich the regions were extracted.
channelsVector of single channel images CV_8UC1 from wich the regions were extracted.
regionsVector of ER's retrieved from the ERFilter algorithm from each channel.
groupsThe output of the algorithm is stored in this parameter as set of lists of indexes to provided regions.
groups_rectsThe output of the algorithm are stored in this parameter as list of rectangles.
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbablityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ erGrouping() [2/4]

static void OpenCVForUnity.TextModule.Text.erGrouping ( Mat image,
Mat channel,
List< MatOfPoint > regions,
MatOfRect groups_rects,
int method )
static

Find groups of Extremal Regions that are organized as text blocks.

Parameters
imgOriginal RGB or Greyscale image from wich the regions were extracted.
channelsVector of single channel images CV_8UC1 from wich the regions were extracted.
regionsVector of ER's retrieved from the ERFilter algorithm from each channel.
groupsThe output of the algorithm is stored in this parameter as set of lists of indexes to provided regions.
groups_rectsThe output of the algorithm are stored in this parameter as list of rectangles.
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbablityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ erGrouping() [3/4]

static void OpenCVForUnity.TextModule.Text.erGrouping ( Mat image,
Mat channel,
List< MatOfPoint > regions,
MatOfRect groups_rects,
int method,
string filename )
static

Find groups of Extremal Regions that are organized as text blocks.

Parameters
imgOriginal RGB or Greyscale image from wich the regions were extracted.
channelsVector of single channel images CV_8UC1 from wich the regions were extracted.
regionsVector of ER's retrieved from the ERFilter algorithm from each channel.
groupsThe output of the algorithm is stored in this parameter as set of lists of indexes to provided regions.
groups_rectsThe output of the algorithm are stored in this parameter as list of rectangles.
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbablityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ erGrouping() [4/4]

static void OpenCVForUnity.TextModule.Text.erGrouping ( Mat image,
Mat channel,
List< MatOfPoint > regions,
MatOfRect groups_rects,
int method,
string filename,
float minProbablity )
static

Find groups of Extremal Regions that are organized as text blocks.

Parameters
imgOriginal RGB or Greyscale image from wich the regions were extracted.
channelsVector of single channel images CV_8UC1 from wich the regions were extracted.
regionsVector of ER's retrieved from the ERFilter algorithm from each channel.
groupsThe output of the algorithm is stored in this parameter as set of lists of indexes to provided regions.
groups_rectsThe output of the algorithm are stored in this parameter as list of rectangles.
methodGrouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filenameThe XML or YAML file with the classifier model (e.g. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
minProbablityThe minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.

◆ loadClassifierNM1()

static ERFilter_Callback OpenCVForUnity.TextModule.Text.loadClassifierNM1 ( string filename)
static

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

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

returns a pointer to ERFilter::Callback.

◆ loadClassifierNM2()

static ERFilter_Callback OpenCVForUnity.TextModule.Text.loadClassifierNM2 ( string filename)
static

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

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

returns a pointer to ERFilter::Callback.

◆ loadOCRBeamSearchClassifierCNN()

static OCRBeamSearchDecoder_ClassifierCallback OpenCVForUnity.TextModule.Text.loadOCRBeamSearchClassifierCNN ( string filename)
static

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.

◆ loadOCRHMMClassifier()

static OCRHMMDecoder_ClassifierCallback OpenCVForUnity.TextModule.Text.loadOCRHMMClassifier ( string filename,
int classifier )
static

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

Parameters
filenameThe XML or YAML file with the classifier model (e.g. OCRBeamSearch_CNN_model_data.xml.gz)
classifierCan be one of classifier_type enum values.

◆ loadOCRHMMClassifierCNN()

static OCRHMMDecoder_ClassifierCallback OpenCVForUnity.TextModule.Text.loadOCRHMMClassifierCNN ( string filename)
static

Allow to implicitly load the default character classifier when creating an OCRHMMDecoder 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.

Deprecated
use loadOCRHMMClassifier instead

◆ loadOCRHMMClassifierNM()

static OCRHMMDecoder_ClassifierCallback OpenCVForUnity.TextModule.Text.loadOCRHMMClassifierNM ( string filename)
static

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

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

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

Member Data Documentation

◆ ERFILTER_NM_IHSGrad

const int OpenCVForUnity.TextModule.Text.ERFILTER_NM_IHSGrad = 1
static

◆ ERFILTER_NM_RGBLGrad

const int OpenCVForUnity.TextModule.Text.ERFILTER_NM_RGBLGrad = 0
static

◆ ERGROUPING_ORIENTATION_ANY

const int OpenCVForUnity.TextModule.Text.ERGROUPING_ORIENTATION_ANY = 1
static

◆ ERGROUPING_ORIENTATION_HORIZ

const int OpenCVForUnity.TextModule.Text.ERGROUPING_ORIENTATION_HORIZ = 0
static

◆ OCR_CNN_CLASSIFIER

const int OpenCVForUnity.TextModule.Text.OCR_CNN_CLASSIFIER = 1
static

◆ OCR_DECODER_VITERBI

const int OpenCVForUnity.TextModule.Text.OCR_DECODER_VITERBI = 0
static

◆ OCR_KNN_CLASSIFIER

const int OpenCVForUnity.TextModule.Text.OCR_KNN_CLASSIFIER = 0
static

◆ OCR_LEVEL_TEXTLINE

const int OpenCVForUnity.TextModule.Text.OCR_LEVEL_TEXTLINE = 1
static

◆ OCR_LEVEL_WORD

const int OpenCVForUnity.TextModule.Text.OCR_LEVEL_WORD = 0
static

◆ OEM_CUBE_ONLY

const int OpenCVForUnity.TextModule.Text.OEM_CUBE_ONLY = 1
static

◆ OEM_DEFAULT

const int OpenCVForUnity.TextModule.Text.OEM_DEFAULT = 3
static

◆ OEM_TESSERACT_CUBE_COMBINED

const int OpenCVForUnity.TextModule.Text.OEM_TESSERACT_CUBE_COMBINED = 2
static

◆ OEM_TESSERACT_ONLY

const int OpenCVForUnity.TextModule.Text.OEM_TESSERACT_ONLY = 0
static

◆ PSM_AUTO

const int OpenCVForUnity.TextModule.Text.PSM_AUTO = 3
static

◆ PSM_AUTO_ONLY

const int OpenCVForUnity.TextModule.Text.PSM_AUTO_ONLY = 2
static

◆ PSM_AUTO_OSD

const int OpenCVForUnity.TextModule.Text.PSM_AUTO_OSD = 1
static

◆ PSM_CIRCLE_WORD

const int OpenCVForUnity.TextModule.Text.PSM_CIRCLE_WORD = 9
static

◆ PSM_OSD_ONLY

const int OpenCVForUnity.TextModule.Text.PSM_OSD_ONLY = 0
static

◆ PSM_SINGLE_BLOCK

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_BLOCK = 6
static

◆ PSM_SINGLE_BLOCK_VERT_TEXT

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_BLOCK_VERT_TEXT = 5
static

◆ PSM_SINGLE_CHAR

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_CHAR = 10
static

◆ PSM_SINGLE_COLUMN

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_COLUMN = 4
static

◆ PSM_SINGLE_LINE

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_LINE = 7
static

◆ PSM_SINGLE_WORD

const int OpenCVForUnity.TextModule.Text.PSM_SINGLE_WORD = 8
static

The documentation for this class was generated from the following file: