public class opencv_text extends opencv_text
| Modifier and Type | Class and Description |
|---|---|
static class |
opencv_text.BaseOCR |
static class |
opencv_text.DoubleVector |
static class |
opencv_text.ERFilter
\brief Base class for 1st and 2nd stages of Neumann and Matas scene text detection algorithm [Neumann12].
|
static class |
opencv_text.ERStat
\addtogroup text_detect
\{
|
static class |
opencv_text.ERStatVector |
static class |
opencv_text.ERStatVectorVector |
static class |
opencv_text.IntDeque |
static class |
opencv_text.OCRBeamSearchDecoder
\brief OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm.
|
static class |
opencv_text.OCRHMMDecoder
\brief OCRHMMDecoder class provides an interface for OCR using Hidden Markov Models.
|
static class |
opencv_text.OCRTesseract
\brief OCRTesseract class provides an interface with the tesseract-ocr API (v3.02.02) in C++.
|
static class |
opencv_text.StdStringVector |
| Modifier and Type | Field and Description |
|---|---|
static int |
ERFILTER_NM_IHSGrad
enum cv::text::
|
static int |
ERFILTER_NM_RGBLGrad
enum cv::text::
|
static int |
ERGROUPING_ORIENTATION_ANY
enum cv::text::erGrouping_Modes
|
static int |
ERGROUPING_ORIENTATION_HORIZ
enum cv::text::erGrouping_Modes
|
static int |
OCR_DECODER_VITERBI
enum cv::text::decoder_mode
|
static int |
OCR_LEVEL_TEXTLINE
enum cv::text::
|
static int |
OCR_LEVEL_WORD
enum cv::text::
|
| Constructor and Description |
|---|
opencv_text() |
mappublic static final int ERFILTER_NM_RGBLGrad
public static final int ERFILTER_NM_IHSGrad
public static final int ERGROUPING_ORIENTATION_HORIZ
public static final int ERGROUPING_ORIENTATION_ANY
public static final int OCR_LEVEL_WORD
public static final int OCR_LEVEL_TEXTLINE
public static final int OCR_DECODER_VITERBI
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter createERFilterNM1(@opencv_core.Ptr opencv_text.ERFilter.Callback cb, int thresholdDelta, float minArea, float maxArea, float minProbability, @Cast(value="bool") boolean nonMaxSuppression, float minProbabilityDiff)
cb - : Callback with the classifier. Default classifier can be implicitly load with function
loadClassifierNM1, e.g. from file in samples/cpp/trained_classifierNM1.xmlthresholdDelta - : Threshold step in subsequent thresholds when extracting the component treeminArea - : The minimum area (% of image size) allowed for retreived ER'sminArea - : The maximum area (% of image size) allowed for retreived ER'sminProbability - : The minimum probability P(er|character) allowed for retreived ER'snonMaxSuppression - : Whenever non-maximum suppression is done over the branch probabilitiesminProbability - : 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).
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter createERFilterNM1(@opencv_core.Ptr opencv_text.ERFilter.Callback cb)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter createERFilterNM2(@opencv_core.Ptr opencv_text.ERFilter.Callback cb, float minProbability)
cb - : Callback with the classifier. Default classifier can be implicitly load with function
loadClassifierNM2, e.g. from file in samples/cpp/trained_classifierNM2.xmlminProbability - : 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.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter createERFilterNM2(@opencv_core.Ptr opencv_text.ERFilter.Callback cb)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter.Callback loadClassifierNM1(@opencv_core.Str BytePointer filename)
filename - The XML or YAML file with the classifier model (e.g. trained_classifierNM1.xml)
returns a pointer to ERFilter::Callback.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter.Callback loadClassifierNM1(@opencv_core.Str String filename)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter.Callback loadClassifierNM2(@opencv_core.Str BytePointer filename)
filename - The XML or YAML file with the classifier model (e.g. trained_classifierNM2.xml)
returns a pointer to ERFilter::Callback.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.ERFilter.Callback loadClassifierNM2(@opencv_core.Str String filename)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.Mat _src, @ByVal opencv_core.MatVector _channels, int _mode)
_src - Source image. Must be RGB CV_8UC3.
_channels - Output vector\_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).
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.Mat _src, @ByVal opencv_core.MatVector _channels)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.Mat _src, @ByVal opencv_core.UMatVector _channels, int _mode)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.Mat _src, @ByVal opencv_core.UMatVector _channels)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.UMat _src, @ByVal opencv_core.MatVector _channels, int _mode)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.UMat _src, @ByVal opencv_core.MatVector _channels)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.UMat _src, @ByVal opencv_core.UMatVector _channels, int _mode)
@Namespace(value="cv::text") public static void computeNMChannels(@ByVal opencv_core.UMat _src, @ByVal opencv_core.UMatVector _channels)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat img, @ByVal opencv_core.MatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects, int method, @StdString BytePointer filename, float minProbablity)
img - Original RGB or Greyscale image from wich the regions were extracted.
channels - Vector of single channel images CV_8UC1 from wich the regions were extracted.
regions - Vector of ER's retreived from the ERFilter algorithm from each channel.
groups - The output of the algorithm is stored in this parameter as set of lists of indexes to
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.@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat img, @ByVal opencv_core.MatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat img, @ByVal opencv_core.UMatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects, int method, @StdString String filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat img, @ByVal opencv_core.UMatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat img, @ByVal opencv_core.MatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects, int method, @StdString BytePointer filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat img, @ByVal opencv_core.MatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat img, @ByVal opencv_core.UMatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects, int method, @StdString String filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat img, @ByVal opencv_core.UMatVector channels, @ByRef opencv_text.ERStatVectorVector regions, @Cast(value="std::vector<std::vector<cv::Vec2i> >*") @ByRef opencv_core.PointVectorVector groups, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat image, @ByVal opencv_core.Mat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects, int method, @opencv_core.Str BytePointer filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat image, @ByVal opencv_core.Mat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.Mat image, @ByVal opencv_core.Mat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects, int method, @opencv_core.Str String filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat image, @ByVal opencv_core.UMat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects, int method, @opencv_core.Str BytePointer filename, float minProbablity)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat image, @ByVal opencv_core.UMat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects)
@Namespace(value="cv::text") public static void erGrouping(@ByVal opencv_core.UMat image, @ByVal opencv_core.UMat channel, @ByVal opencv_core.PointVectorVector regions, @ByRef opencv_core.RectVector groups_rects, int method, @opencv_core.Str String filename, float minProbablity)
@Namespace(value="cv::text") public static void MSERsToERStats(@ByVal opencv_core.Mat image, @ByRef opencv_core.PointVectorVector contours, @ByRef opencv_text.ERStatVectorVector regions)
image - Source image CV_8UC1 from which the MSERs where extracted.
contours - Intput vector with all the contours (vector\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\
An example of MSERsToERStats in use can be found in the text detection webcam_demo:
@Namespace(value="cv::text") public static void MSERsToERStats(@ByVal opencv_core.UMat image, @ByRef opencv_core.PointVectorVector contours, @ByRef opencv_text.ERStatVectorVector regions)
@Namespace(value="cv::text") public static void detectRegions(@ByVal opencv_core.Mat image, @opencv_core.Ptr opencv_text.ERFilter er_filter1, @opencv_core.Ptr opencv_text.ERFilter er_filter2, @ByRef opencv_core.PointVectorVector regions)
@Namespace(value="cv::text") public static void detectRegions(@ByVal opencv_core.UMat image, @opencv_core.Ptr opencv_text.ERFilter er_filter1, @opencv_core.Ptr opencv_text.ERFilter er_filter2, @ByRef opencv_core.PointVectorVector regions)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRHMMDecoder.ClassifierCallback loadOCRHMMClassifierNM(@opencv_core.Str BytePointer filename)
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.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRHMMDecoder.ClassifierCallback loadOCRHMMClassifierNM(@opencv_core.Str String filename)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRHMMDecoder.ClassifierCallback loadOCRHMMClassifierCNN(@opencv_core.Str BytePointer filename)
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.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRHMMDecoder.ClassifierCallback loadOCRHMMClassifierCNN(@opencv_core.Str String filename)
@Namespace(value="cv::text") public static void createOCRHMMTransitionsTable(@StdString BytePointer vocabulary, @ByRef opencv_text.StdStringVector lexicon, @ByVal opencv_core.Mat transition_probabilities_table)
/** \brief Utility function to create a tailored language model transitions table from a given list of words (lexicon).
vocabulary - The language vocabulary (chars when ascii english text).lexicon - The list of words that are expected to be found in a particular image.transition_probabilities_table - Output 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
- (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) :
@Namespace(value="cv::text") public static void createOCRHMMTransitionsTable(@StdString String vocabulary, @ByRef opencv_text.StdStringVector lexicon, @ByVal opencv_core.Mat transition_probabilities_table)
@Namespace(value="cv::text") public static void createOCRHMMTransitionsTable(@StdString BytePointer vocabulary, @ByRef opencv_text.StdStringVector lexicon, @ByVal opencv_core.UMat transition_probabilities_table)
@Namespace(value="cv::text") public static void createOCRHMMTransitionsTable(@StdString String vocabulary, @ByRef opencv_text.StdStringVector lexicon, @ByVal opencv_core.UMat transition_probabilities_table)
@Namespace(value="cv::text") @ByVal public static opencv_core.Mat createOCRHMMTransitionsTable(@opencv_core.Str BytePointer vocabulary, @ByRef opencv_core.StringVector lexicon)
@Namespace(value="cv::text") @ByVal public static opencv_core.Mat createOCRHMMTransitionsTable(@opencv_core.Str String vocabulary, @ByRef opencv_core.StringVector lexicon)
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRBeamSearchDecoder.ClassifierCallback loadOCRBeamSearchClassifierCNN(@opencv_core.Str BytePointer filename)
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.
@Namespace(value="cv::text") @opencv_core.Ptr public static opencv_text.OCRBeamSearchDecoder.ClassifierCallback loadOCRBeamSearchClassifierCNN(@opencv_core.Str String filename)
Copyright © 2017. All rights reserved.