Module NewOCR

Class OCROptions


  • public class OCROptions
    extends java.lang.Object
    General options used by the OCR scanning and training.
    Since:
    April 25, 2019
    • Constructor Summary

      Constructors 
      Constructor Description
      OCROptions()  
    • Constructor Detail

      • OCROptions

        public OCROptions()
    • Method Detail

      • getSpecialSpaces

        public java.util.Set<java.lang.Character> getSpecialSpaces()
        Gets the characters requiring custom trained spaces.
        Returns:
        The characters requiring custom spacing
      • setSpecialSpaces

        public OCROptions setSpecialSpaces​(java.util.Set<java.lang.Character> specialSpaces)
        Sets the characters requiring custom trained spaces.
        Parameters:
        specialSpaces - The characters requiring separate training for their trailing spaces.
        Returns:
        The current OCROptions object
      • setSpecialSpaces

        public OCROptions setSpecialSpaces​(char... specialSpaces)
        Sets the characters requiring custom trained spaces.
        Parameters:
        specialSpaces - The characters requiring separate training for their trailing spaces.
        Returns:
        The current OCROptions object
      • setMaxPercentDiffToMerge

        public OCROptions setMaxPercentDiffToMerge​(double maxPercentDiffToMerge)
        Sets the maximum percentage difference a line must be in order to merge in the very first phase of training. This is primarily for when underscores are below a line, and will need to be X% smaller than the line to merge.

        This value is by default 0.5

        Parameters:
        maxPercentDiffToMerge - The percentage to set
        Returns:
        The current OCROptions object
      • addRatioWeight

        public void addRatioWeight​(Letter letter,
                                   double weight)
        Adds a custom width/height ratio for the given Letter.
        Parameters:
        letter - The Letter to set the weight of
        weight - The weight to set
      • addRatioWeights

        public void addRatioWeights​(java.util.List<Letter> letters,
                                    double weight)
        Adds a custom width/height ratio for the each Letter i nthe given list.
        Parameters:
        letters - The Letter list to set the weight of
        weight - The weight to set
      • addRatioWeightFromRule

        public void addRatioWeightFromRule​(SimilarRule similarRule,
                                           double weight)
        Adds a custom width/height ratio for all Letters matching the given SimilarRule.
        Parameters:
        similarRule - The SimilarRule to match to letters
        weight - The weight to set
      • addRatioWeightsFromRules

        public void addRatioWeightsFromRules​(java.util.List<SimilarRule> similarRules,
                                             double weight)
        Adds a custom width/height ratio for all Letters matching all the given SimilarRules.
        Parameters:
        similarRules - The SimilarRule list to match to letters
        weight - The weight to set
      • getSizeRatioWeight

        public double getSizeRatioWeight()
        Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.
        Returns:
        The weight of the width/height ratio
      • getSizeRatioWeight

        public double getSizeRatioWeight​(Letter letter)
        Gets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.
        Parameters:
        letter - The letter to get the width/height ratio of
        Returns:
        The weight of the width/height ratio
      • setSizeRatioWeight

        public OCROptions setSizeRatioWeight​(double sizeRatioWeight)
        Sets the amount the width/height radio should be multiplied across all a character's potential matches, to increase its effects compared to the actual section similarity.
        Parameters:
        sizeRatioWeight - The weight of the width/height ratio
        Returns:
        The current OCROptions object
      • getImageReadMethod

        public ImageReadMethod getImageReadMethod()
        Gets the method that will be used to read the image for both training and scanning.
        Returns:
        The ImageReadMethod used in training and scanning.