Package org.opencv.text
Class Text
- java.lang.Object
- 
- org.opencv.text.Text
 
- 
 public class Text extends java.lang.Object
- 
- 
Field SummaryFields Modifier and Type Field Description static intERFILTER_NM_IHSGradstatic intERFILTER_NM_RGBLGradstatic intERGROUPING_ORIENTATION_ANYstatic intERGROUPING_ORIENTATION_HORIZstatic intOCR_CNN_CLASSIFIERstatic intOCR_DECODER_VITERBIstatic intOCR_KNN_CLASSIFIERstatic intOCR_LEVEL_TEXTLINEstatic intOCR_LEVEL_WORDstatic intOEM_CUBE_ONLYstatic intOEM_DEFAULTstatic intOEM_TESSERACT_CUBE_COMBINEDstatic intOEM_TESSERACT_ONLYstatic intPSM_AUTOstatic intPSM_AUTO_ONLYstatic intPSM_AUTO_OSDstatic intPSM_CIRCLE_WORDstatic intPSM_OSD_ONLYstatic intPSM_SINGLE_BLOCKstatic intPSM_SINGLE_BLOCK_VERT_TEXTstatic intPSM_SINGLE_CHARstatic intPSM_SINGLE_COLUMNstatic intPSM_SINGLE_LINEstatic intPSM_SINGLE_WORD
 - 
Constructor SummaryConstructors Constructor Description Text()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcomputeNMChannels(Mat _src, java.util.List<Mat> _channels)Compute the different channels to be processed independently in the N&M algorithm CITE: Neumann12.static voidcomputeNMChannels(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM1(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 ERFiltercreateERFilterNM2(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 ERFiltercreateERFilterNM2(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 MatcreateOCRHMMTransitionsTable(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 voiddetectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, java.util.List<MatOfPoint> regions)Converts MSER contours (vector<Point>) to ERStat regions.static voiddetectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects)Extracts text regions from image.static voiddetectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method)Extracts text regions from image.static voiddetectRegions(Mat image, ERFilter er_filter1, ERFilter er_filter2, MatOfRect groups_rects, int method, java.lang.String filename)Extracts text regions from image.static voiddetectRegions(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 voiderGrouping(Mat image, Mat channel, java.util.List<MatOfPoint> regions, MatOfRect groups_rects)Find groups of Extremal Regions that are organized as text blocks.static voiderGrouping(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 voiderGrouping(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 voiderGrouping(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.
 
- 
- 
- 
Field Detail- 
ERFILTER_NM_RGBLGradpublic static final int ERFILTER_NM_RGBLGrad - See Also:
- Constant Field Values
 
 - 
ERFILTER_NM_IHSGradpublic static final int ERFILTER_NM_IHSGrad - See Also:
- Constant Field Values
 
 - 
OCR_LEVEL_WORDpublic static final int OCR_LEVEL_WORD - See Also:
- Constant Field Values
 
 - 
OCR_LEVEL_TEXTLINEpublic static final int OCR_LEVEL_TEXTLINE - See Also:
- Constant Field Values
 
 - 
OCR_KNN_CLASSIFIERpublic static final int OCR_KNN_CLASSIFIER - See Also:
- Constant Field Values
 
 - 
OCR_CNN_CLASSIFIERpublic static final int OCR_CNN_CLASSIFIER - See Also:
- Constant Field Values
 
 - 
OCR_DECODER_VITERBIpublic static final int OCR_DECODER_VITERBI - See Also:
- Constant Field Values
 
 - 
ERGROUPING_ORIENTATION_HORIZpublic static final int ERGROUPING_ORIENTATION_HORIZ - See Also:
- Constant Field Values
 
 - 
ERGROUPING_ORIENTATION_ANYpublic static final int ERGROUPING_ORIENTATION_ANY - See Also:
- Constant Field Values
 
 - 
OEM_TESSERACT_ONLYpublic static final int OEM_TESSERACT_ONLY - See Also:
- Constant Field Values
 
 - 
OEM_CUBE_ONLYpublic static final int OEM_CUBE_ONLY - See Also:
- Constant Field Values
 
 - 
OEM_TESSERACT_CUBE_COMBINEDpublic static final int OEM_TESSERACT_CUBE_COMBINED - See Also:
- Constant Field Values
 
 - 
OEM_DEFAULTpublic static final int OEM_DEFAULT - See Also:
- Constant Field Values
 
 - 
PSM_OSD_ONLYpublic static final int PSM_OSD_ONLY - See Also:
- Constant Field Values
 
 - 
PSM_AUTO_OSDpublic static final int PSM_AUTO_OSD - See Also:
- Constant Field Values
 
 - 
PSM_AUTO_ONLYpublic static final int PSM_AUTO_ONLY - See Also:
- Constant Field Values
 
 - 
PSM_AUTOpublic static final int PSM_AUTO - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_COLUMNpublic static final int PSM_SINGLE_COLUMN - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_BLOCK_VERT_TEXTpublic static final int PSM_SINGLE_BLOCK_VERT_TEXT - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_BLOCKpublic static final int PSM_SINGLE_BLOCK - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_LINEpublic static final int PSM_SINGLE_LINE - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_WORDpublic static final int PSM_SINGLE_WORD - See Also:
- Constant Field Values
 
 - 
PSM_CIRCLE_WORDpublic static final int PSM_CIRCLE_WORD - See Also:
- Constant Field Values
 
 - 
PSM_SINGLE_CHARpublic static final int PSM_SINGLE_CHAR - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM1public 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
 
 - 
createERFilterNM2public 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
 
 - 
createERFilterNM2public 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
 
 - 
computeNMChannelspublic 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).
 
 - 
computeNMChannelspublic 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).
 
 - 
erGroupingpublic 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
 
 - 
erGroupingpublic 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
 
 - 
erGroupingpublic 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
 
 - 
erGroupingpublic 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
 
 - 
detectRegionspublic 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
 
 - 
detectRegionspublic 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.
 
 - 
detectRegionspublic 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.
 
 - 
detectRegionspublic 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.
 
 - 
detectRegionspublic 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
 
 - 
createOCRHMMTransitionsTablepublic 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
 
 
- 
 
-