Module NewOCR

Class SearchCharacter

  • All Implemented Interfaces:
    java.lang.Comparable<Character>

    public class SearchCharacter
    extends CoordinateCharacter
    An object meant to store characters directly scanned from an image and that is being searched for/mutated.
    Since:
    April 25, 2019
    • Constructor Detail

      • SearchCharacter

        public SearchCharacter​(java.util.List<IntPair> coordinates)
        Creates a SearchCharacter from a list of coordinates used by the character.
        Parameters:
        coordinates - Coordinates used by the character
      • SearchCharacter

        public SearchCharacter​(java.util.List<IntPair> coordinates,
                               int xOffset,
                               int yOffset)
        Creates a SearchCharacter from a list of coordinates used by the character.
        Parameters:
        coordinates - Coordinates used by the character
        xOffset - The X offset of the coordinates
        yOffset - The Y offset of the coordinates
    • Method Detail

      • applySections

        public void applySections()
        Creates sections and invokes addSegment(IntPair) for each one. This is vital for the use of this object.
      • addSegment

        public void addSegment​(IntPair entry)
        Adds a data segment to be calculated in the future. The segments may be fetched via getSegments().
        Parameters:
        entry - The data segment in the format of [total black, size of segment]
      • getSegments

        public java.util.List<IntPair> getSegments()
        Gets the raw segments added via addSegment(IntPair) where the Entry format is [total black, size of segment].
        Returns:
        The raw segments
      • getSegmentPercentages

        public double[] getSegmentPercentages()
        Gets the raw segment percentages all <= 1. This will return an empty array until applySections() and analyzeSlices() have been invoked.
        Returns:
        The raw array of segment percentages with a length of 17
      • getTrainingMeta

        public java.util.OptionalDouble getTrainingMeta​(java.lang.String name)
        Gets the training meta with the given name. This contains data such as separation of the dots of an i, data on the holes of a %, etc.
        Parameters:
        name - The name of the training data
        Returns:
        The value of the training data
      • setTrainingMeta

        public void setTrainingMeta​(java.lang.String name,
                                    double data)
        Sets the training data with a given name.
        Parameters:
        name - The name of the data
        data - The data to set
      • getCenterOffset

        public double getCenterOffset()
        Gets the amount away a character is from the center of the line. This isn't useful for detecting single characters.
        Returns:
        The offset of the character
      • setCenterOffset

        public void setCenterOffset​(double centerOffset)
        Sets the amount away a character is from the center of the line. This isn't useful for detecting single characters.
        Parameters:
        centerOffset - The offset of the character to set