## Class Text

• java.lang.Object
• org.opencv.text.Text

• public class Text
extends java.lang.Object
• ### Field Summary

Fields
Modifier and Type Field Description
static int ERFILTER_NM_IHSGrad
static int ERFILTER_NM_RGBLGrad
static int ERGROUPING_ORIENTATION_ANY
static int ERGROUPING_ORIENTATION_HORIZ
static int OCR_CNN_CLASSIFIER
static int OCR_DECODER_VITERBI
static int OCR_KNN_CLASSIFIER
static int OCR_LEVEL_TEXTLINE
static int OCR_LEVEL_WORD
static int OEM_CUBE_ONLY
static int OEM_DEFAULT
static int OEM_TESSERACT_CUBE_COMBINED
static int OEM_TESSERACT_ONLY
static int PSM_AUTO
static int PSM_AUTO_ONLY
static int PSM_AUTO_OSD
static int PSM_CIRCLE_WORD
static int PSM_OSD_ONLY
static int PSM_SINGLE_BLOCK
static int PSM_SINGLE_BLOCK_VERT_TEXT
static int PSM_SINGLE_CHAR
static int PSM_SINGLE_COLUMN
static int PSM_SINGLE_LINE
static int PSM_SINGLE_WORD
• ### Constructor Summary

Constructors
Constructor Description
Text()
• ### Method Summary

All Methods
Modifier and Type Method Description
static void computeNMChannels​(Mat _src, java.util.List<Mat> _channels)
Compute the different channels to be processed independently in the N&M algorithm CITE: Neumann12.
static void computeNMChannels​(Mat _src, java.util.List<Mat> _channels, int _mode)
Compute the different channels to be processed independently in the N&M algorithm CITE: Neumann12.
static ERFilter createERFilterNM1​(java.lang.String filename)
Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM1​(java.lang.String filename, int thresholdDelta)
Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM1​(java.lang.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.
static ERFilter createERFilterNM1​(java.lang.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.
static ERFilter createERFilterNM1​(java.lang.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.
static ERFilter createERFilterNM1​(java.lang.String filename, int thresholdDelta, float minArea, float maxArea, float minProbability, boolean nonMaxSuppression)
Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM1​(java.lang.String filename, int thresholdDelta, float minArea, float maxArea, float minProbability, boolean nonMaxSuppression, float minProbabilityDiff)
Reads an Extremal Region Filter for the 1st stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM1​(ERFilter_Callback cb)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12.
static ERFilter createERFilterNM1​(ERFilter_Callback cb, int thresholdDelta)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: 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 CITE: 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 CITE: 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 CITE: Neumann12.
static ERFilter createERFilterNM1​(ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability, boolean nonMaxSuppression)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12.
static ERFilter createERFilterNM1​(ERFilter_Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability, boolean nonMaxSuppression, float minProbabilityDiff)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12.
static ERFilter createERFilterNM2​(java.lang.String filename)
Reads an Extremal Region Filter for the 2nd stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM2​(java.lang.String filename, float minProbability)
Reads an Extremal Region Filter for the 2nd stage classifier of N&M algorithm from the provided path e.g.
static ERFilter createERFilterNM2​(ERFilter_Callback cb)
Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12.
static ERFilter createERFilterNM2​(ERFilter_Callback cb, float minProbability)
Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12.
static Mat createOCRHMMTransitionsTable​(java.lang.String vocabulary, java.util.List<java.lang.String> lexicon)
Utility function to create a tailored language model transitions table from a given list of words (lexicon).
static void detectRegions​(Mat image, ERFilter er_filter1, ERFilter er_filter2, java.util.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)
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, int method, java.lang.String filename)
Extracts text regions from image.
static void detectRegions​(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, java.lang.String filename, float minProbability)
Extracts text regions from image.
static void detectTextSWT​(Mat input, MatOfRect result, boolean dark_on_light)
Applies the Stroke Width Transform operator followed by filtering of connected components of similar Stroke Widths to return letter candidates.
static void detectTextSWT​(Mat input, MatOfRect result, boolean 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.
static void detectTextSWT​(Mat input, MatOfRect result, boolean 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.
static void erGrouping​(Mat image, Mat channel, java.util.List<MatOfPoint> regions, MatOfRect groups_rects)
Find groups of Extremal Regions that are organized as text blocks.
static void erGrouping​(Mat image, Mat channel, java.util.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, java.util.List<MatOfPoint> regions, MatOfRect groups_rects, int method, java.lang.String filename)
Find groups of Extremal Regions that are organized as text blocks.
static void erGrouping​(Mat image, Mat channel, java.util.List<MatOfPoint> regions, MatOfRect groups_rects, int method, java.lang.String filename, float minProbablity)
Find groups of Extremal Regions that are organized as text blocks.
static ERFilter_Callback loadClassifierNM1​(java.lang.String filename)
Allow to implicitly load the default classifier when creating an ERFilter object.
static ERFilter_Callback loadClassifierNM2​(java.lang.String filename)
Allow to implicitly load the default classifier when creating an ERFilter object.
static OCRBeamSearchDecoder_ClassifierCallback loadOCRBeamSearchClassifierCNN​(java.lang.String filename)
Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifier​(java.lang.String filename, int classifier)
Allow to implicitly load the default character classifier when creating an OCRHMMDecoder object.
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierCNN​(java.lang.String filename)
Deprecated.
static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierNM​(java.lang.String filename)
Deprecated.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Field Detail

public static final int ERFILTER_NM_RGBLGrad
Constant Field Values

public static final int ERFILTER_NM_IHSGrad
Constant Field Values
• #### OCR_LEVEL_WORD

public static final int OCR_LEVEL_WORD
Constant Field Values
• #### OCR_LEVEL_TEXTLINE

public static final int OCR_LEVEL_TEXTLINE
Constant Field Values
• #### OCR_KNN_CLASSIFIER

public static final int OCR_KNN_CLASSIFIER
Constant Field Values
• #### OCR_CNN_CLASSIFIER

public static final int OCR_CNN_CLASSIFIER
Constant Field Values
• #### OCR_DECODER_VITERBI

public static final int OCR_DECODER_VITERBI
Constant Field Values
• #### ERGROUPING_ORIENTATION_HORIZ

public static final int ERGROUPING_ORIENTATION_HORIZ
Constant Field Values
• #### ERGROUPING_ORIENTATION_ANY

public static final int ERGROUPING_ORIENTATION_ANY
Constant Field Values
• #### OEM_TESSERACT_ONLY

public static final int OEM_TESSERACT_ONLY
Constant Field Values
• #### OEM_CUBE_ONLY

public static final int OEM_CUBE_ONLY
Constant Field Values
• #### OEM_TESSERACT_CUBE_COMBINED

public static final int OEM_TESSERACT_CUBE_COMBINED
Constant Field Values
• #### OEM_DEFAULT

public static final int OEM_DEFAULT
Constant Field Values
• #### PSM_OSD_ONLY

public static final int PSM_OSD_ONLY
Constant Field Values
• #### PSM_AUTO_OSD

public static final int PSM_AUTO_OSD
Constant Field Values
• #### PSM_AUTO_ONLY

public static final int PSM_AUTO_ONLY
Constant Field Values
• #### PSM_AUTO

public static final int PSM_AUTO
Constant Field Values
• #### PSM_SINGLE_COLUMN

public static final int PSM_SINGLE_COLUMN
Constant Field Values
• #### PSM_SINGLE_BLOCK_VERT_TEXT

public static final int PSM_SINGLE_BLOCK_VERT_TEXT
Constant Field Values
• #### PSM_SINGLE_BLOCK

public static final int PSM_SINGLE_BLOCK
Constant Field Values
• #### PSM_SINGLE_LINE

public static final int PSM_SINGLE_LINE
Constant Field Values
• #### PSM_SINGLE_WORD

public static final int PSM_SINGLE_WORD
Constant Field Values
• #### PSM_CIRCLE_WORD

public static final int PSM_CIRCLE_WORD
Constant Field Values
• #### PSM_SINGLE_CHAR

public static final int PSM_SINGLE_CHAR
Constant Field Values
• ### Constructor Detail

• #### Text

public Text()
• ### Method Detail

• #### createERFilterNM1

public static ERFilter createERFilterNM1​(ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
boolean nonMaxSuppression,
float minProbabilityDiff)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
nonMaxSuppression - automatically generated
minProbabilityDiff - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(ERFilter_Callback cb,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
boolean nonMaxSuppression)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
nonMaxSuppression - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public 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 CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public 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 CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(ERFilter_Callback cb,
int thresholdDelta,
float minArea)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(ERFilter_Callback cb,
int thresholdDelta)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
thresholdDelta - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(ERFilter_Callback cb)
Create an Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xml 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).
Parameters:
cb - automatically generated
Returns:
automatically generated
• #### createERFilterNM2

public static ERFilter createERFilterNM2​(ERFilter_Callback cb,
float minProbability)
Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM2, e.g. from file in samples/cpp/trained_classifierNM2.xml 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.
Parameters:
cb - automatically generated
minProbability - automatically generated
Returns:
automatically generated
• #### createERFilterNM2

public static ERFilter createERFilterNM2​(ERFilter_Callback cb)
Create an Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12. loadClassifierNM2, e.g. from file in samples/cpp/trained_classifierNM2.xml 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.
Parameters:
cb - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.String filename,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
boolean 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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
nonMaxSuppression - automatically generated
minProbabilityDiff - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.String filename,
int thresholdDelta,
float minArea,
float maxArea,
float minProbability,
boolean 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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
nonMaxSuppression - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
minProbability - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
maxArea - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
minArea - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.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
Parameters:
filename - automatically generated
thresholdDelta - automatically generated
Returns:
automatically generated
• #### createERFilterNM1

public static ERFilter createERFilterNM1​(java.lang.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
Parameters:
filename - automatically generated
Returns:
automatically generated
• #### createERFilterNM2

public static ERFilter createERFilterNM2​(java.lang.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
Parameters:
filename - automatically generated
minProbability - automatically generated
Returns:
automatically generated
• #### createERFilterNM2

public static ERFilter createERFilterNM2​(java.lang.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
Parameters:
filename - automatically generated
Returns:
automatically generated

public static ERFilter_Callback loadClassifierNM1​(java.lang.String filename)
Allow to implicitly load the default classifier when creating an ERFilter object.
Parameters:
filename - The XML or YAML file with the classifier model (e.g. trained_classifierNM1.xml) returns a pointer to ERFilter::Callback.
Returns:
automatically generated

public static ERFilter_Callback loadClassifierNM2​(java.lang.String filename)
Allow to implicitly load the default classifier when creating an ERFilter object.
Parameters:
filename - The XML or YAML file with the classifier model (e.g. trained_classifierNM2.xml) returns a pointer to ERFilter::Callback.
Returns:
automatically generated
• #### computeNMChannels

public static void computeNMChannels​(Mat _src,
java.util.List<Mat> _channels,
int _mode)
Compute the different channels to be processed independently in the N&M algorithm CITE: Neumann12.
Parameters:
_src - Source image. Must be RGB CV_8UC3.
_channels - Output vector<Mat> where computed channels are stored.
_mode - Mode 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

public static void computeNMChannels​(Mat _src,
java.util.List<Mat> _channels)
Compute the different channels to be processed independently in the N&M algorithm CITE: Neumann12.
Parameters:
_src - Source image. Must be RGB CV_8UC3.
_channels - Output vector<Mat> where computed channels are stored. 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).
• #### erGrouping

public static void erGrouping​(Mat image,
Mat channel,
java.util.List<MatOfPoint> regions,
MatOfRect groups_rects,
int method,
java.lang.String filename,
float minProbablity)
Find groups of Extremal Regions that are organized as text blocks.
Parameters:
regions - Vector of ER's retrieved from the ERFilter algorithm from each channel. provided regions.
groups_rects - The output of the algorithm are stored in this parameter as list of rectangles.
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filename - The 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.
minProbablity - The minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
image - automatically generated
channel - automatically generated
• #### erGrouping

public static void erGrouping​(Mat image,
Mat channel,
java.util.List<MatOfPoint> regions,
MatOfRect groups_rects,
int method,
java.lang.String filename)
Find groups of Extremal Regions that are organized as text blocks.
Parameters:
regions - Vector of ER's retrieved from the ERFilter algorithm from each channel. provided regions.
groups_rects - The output of the algorithm are stored in this parameter as list of rectangles.
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filename - The 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. method is ERGROUPING_ORIENTATION_ANY.
image - automatically generated
channel - automatically generated
• #### erGrouping

public static void erGrouping​(Mat image,
Mat channel,
java.util.List<MatOfPoint> regions,
MatOfRect groups_rects,
int method)
Find groups of Extremal Regions that are organized as text blocks.
Parameters:
regions - Vector of ER's retrieved from the ERFilter algorithm from each channel. provided regions.
groups_rects - The output of the algorithm are stored in this parameter as list of rectangles.
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY. method is ERGROUPING_ORIENTATION_ANY.
image - automatically generated
channel - automatically generated
• #### erGrouping

public static void erGrouping​(Mat image,
Mat channel,
java.util.List<MatOfPoint> regions,
MatOfRect groups_rects)
Find groups of Extremal Regions that are organized as text blocks.
Parameters:
regions - Vector of ER's retrieved from the ERFilter algorithm from each channel. provided regions.
groups_rects - The output of the algorithm are stored in this parameter as list of rectangles. ERGROUPING_ORIENTATION_ANY. samples/trained_classifier_erGrouping.xml). Only to use when grouping method is ERGROUPING_ORIENTATION_ANY. method is ERGROUPING_ORIENTATION_ANY.
image - automatically generated
channel - automatically generated
• #### detectRegions

public static void detectRegions​(Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
java.util.List<MatOfPoint> regions)
Converts MSER contours (vector<Point>) to ERStat regions.
Parameters:
image - Source image CV_8UC1 from which the MSERs where extracted.
regions - Output 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>
er_filter1 - automatically generated
er_filter2 - automatically generated
• #### detectRegions

public static void detectRegions​(Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method,
java.lang.String filename,
float minProbability)
Extracts text regions from image.
Parameters:
image - Source image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1 - Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12
er_filter2 - Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12
groups_rects - Output list of rectangle blocks with text
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filename - The 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.
minProbability - The minimum probability for accepting a group. Only to use when grouping method is ERGROUPING_ORIENTATION_ANY.
• #### detectRegions

public static void detectRegions​(Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method,
java.lang.String filename)
Extracts text regions from image.
Parameters:
image - Source image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1 - Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12
er_filter2 - Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12
groups_rects - Output list of rectangle blocks with text
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
filename - The 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.
• #### detectRegions

public static void detectRegions​(Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects,
int method)
Extracts text regions from image.
Parameters:
image - Source image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1 - Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12
er_filter2 - Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12
groups_rects - Output list of rectangle blocks with text
method - Grouping method (see text::erGrouping_Modes). Can be one of ERGROUPING_ORIENTATION_HORIZ, ERGROUPING_ORIENTATION_ANY.
• #### detectRegions

public static void detectRegions​(Mat image,
ERFilter er_filter1,
ERFilter er_filter2,
MatOfRect groups_rects)
Extracts text regions from image.
Parameters:
image - Source image where text blocks needs to be extracted from. Should be CV_8UC3 (color).
er_filter1 - Extremal Region Filter for the 1st stage classifier of N&M algorithm CITE: Neumann12
er_filter2 - Extremal Region Filter for the 2nd stage classifier of N&M algorithm CITE: Neumann12
groups_rects - Output list of rectangle blocks with text

@Deprecated
public static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierNM​(java.lang.String filename)
Deprecated.
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. 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.
Returns:
automatically generated

@Deprecated
public static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifierCNN​(java.lang.String filename)
Deprecated.
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) 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.
Returns:
automatically generated

public static OCRHMMDecoder_ClassifierCallback loadOCRHMMClassifier​(java.lang.String filename,
int classifier)
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.
Returns:
automatically generated
• #### createOCRHMMTransitionsTable

public static Mat createOCRHMMTransitionsTable​(java.lang.String vocabulary,
java.util.List<java.lang.String> lexicon)
Utility function to create a tailored language model transitions table from a given list of words (lexicon).
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. 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) : <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/OCRHMM_transitions_table.xml>
Returns:
automatically generated

public static OCRBeamSearchDecoder_ClassifierCallback loadOCRBeamSearchClassifierCNN​(java.lang.String filename)
Allow to implicitly load the default character classifier when creating an OCRBeamSearchDecoder object.
Parameters:
filename - The 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.
Returns:
automatically generated
• #### detectTextSWT

public static void detectTextSWT​(Mat input,
MatOfRect result,
boolean 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.
Parameters:
input - the input image with 3 channels.
result - a vector of resulting bounding boxes where probability of finding text is high
dark_on_light - a 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.
draw - an optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes.
chainBBs - an 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

public static void detectTextSWT​(Mat input,
MatOfRect result,
boolean 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.
Parameters:
input - the input image with 3 channels.
result - a vector of resulting bounding boxes where probability of finding text is high
dark_on_light - a 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.
draw - an optional Mat of type CV_8UC3 which visualises the detected letters using bounding boxes.
• #### detectTextSWT

public static void detectTextSWT​(Mat input,
MatOfRect result,
boolean 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.
Parameters:
input - the input image with 3 channels.
result - a vector of resulting bounding boxes where probability of finding text is high
dark_on_light - a 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.