Class OCRBeamSearchDecoder


  • public class OCRBeamSearchDecoder
    extends BaseOCR
    OCRBeamSearchDecoder class provides an interface for OCR using Beam Search algorithm. Note:
    • (C++) An example on using OCRBeamSearchDecoder recognition combined with scene text detection can be found at the demo sample: <https://github.com/opencv/opencv_contrib/blob/master/modules/text/samples/word_recognition.cpp>
    • Constructor Detail

      • OCRBeamSearchDecoder

        protected OCRBeamSearchDecoder​(long addr)
    • Method Detail

      • run

        public String run​(Mat image,
                          int min_confidence,
                          int component_level)
        Recognize text using Beam Search. Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.
        Parameters:
        image - Input binary image CV_8UC1 with a single text line (or word). text elements found (e.g. words). recognition of individual text elements found (e.g. words). for the recognition of individual text elements found (e.g. words).
        component_level - Only OCR_LEVEL_WORD is supported.
        min_confidence - automatically generated
        Returns:
        automatically generated
      • run

        public String run​(Mat image,
                          int min_confidence)
        Recognize text using Beam Search. Takes image on input and returns recognized text in the output_text parameter. Optionally provides also the Rects for individual text elements found (e.g. words), and the list of those text elements with their confidence values.
        Parameters:
        image - Input binary image CV_8UC1 with a single text line (or word). text elements found (e.g. words). recognition of individual text elements found (e.g. words). for the recognition of individual text elements found (e.g. words).
        min_confidence - automatically generated
        Returns:
        automatically generated
      • run

        public String run​(Mat image,
                          Mat mask,
                          int min_confidence,
                          int component_level)
      • run

        public String run​(Mat image,
                          Mat mask,
                          int min_confidence)
      • create

        public static OCRBeamSearchDecoder create​(OCRBeamSearchDecoder_ClassifierCallback classifier,
                                                  String vocabulary,
                                                  Mat transition_probabilities_table,
                                                  Mat emission_probabilities_table,
                                                  int mode,
                                                  int beam_size)
        Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
        Parameters:
        classifier - The character classifier with built in feature extractor.
        vocabulary - The language vocabulary (chars when ASCII English text). vocabulary.size() must be equal to the number of classes of the classifier.
        transition_probabilities_table - Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
        emission_probabilities_table - Table with observation emission probabilities. cols == rows == vocabulary.size().
        mode - HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
        beam_size - Size of the beam in Beam Search algorithm.
        Returns:
        automatically generated
      • create

        public static OCRBeamSearchDecoder create​(OCRBeamSearchDecoder_ClassifierCallback classifier,
                                                  String vocabulary,
                                                  Mat transition_probabilities_table,
                                                  Mat emission_probabilities_table,
                                                  int mode)
        Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
        Parameters:
        classifier - The character classifier with built in feature extractor.
        vocabulary - The language vocabulary (chars when ASCII English text). vocabulary.size() must be equal to the number of classes of the classifier.
        transition_probabilities_table - Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
        emission_probabilities_table - Table with observation emission probabilities. cols == rows == vocabulary.size().
        mode - HMM Decoding algorithm. Only OCR_DECODER_VITERBI is available for the moment (<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
        Returns:
        automatically generated
      • create

        public static OCRBeamSearchDecoder create​(OCRBeamSearchDecoder_ClassifierCallback classifier,
                                                  String vocabulary,
                                                  Mat transition_probabilities_table,
                                                  Mat emission_probabilities_table)
        Creates an instance of the OCRBeamSearchDecoder class. Initializes HMMDecoder.
        Parameters:
        classifier - The character classifier with built in feature extractor.
        vocabulary - The language vocabulary (chars when ASCII English text). vocabulary.size() must be equal to the number of classes of the classifier.
        transition_probabilities_table - Table with transition probabilities between character pairs. cols == rows == vocabulary.size().
        emission_probabilities_table - Table with observation emission probabilities. cols == rows == vocabulary.size(). (<http://en.wikipedia.org/wiki/Viterbi_algorithm>).
        Returns:
        automatically generated