Module NewOCR

Class TrainedCharacterData

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

    public class TrainedCharacterData
    extends Character
    This is an object meant for storing the data for characters in the training stage.
    Since:
    April 25, 2019
    • Constructor Detail

      • TrainedCharacterData

        public TrainedCharacterData​(char letter)
        Creates a TrainedCharacterData from a character letter with a modifier of 0.
        Parameters:
        letter - The known character letter
      • TrainedCharacterData

        public TrainedCharacterData​(char letter,
                                    int modifier)
        Creates a TrainedCharacterData from a character value with a given modifier value.
        Parameters:
        letter - The known character value
        modifier - The modifier for the character
    • Method Detail

      • getSegmentPercentages

        public double[] getSegmentPercentages()
        Gets the calculated array of the percentages for each section. The array is always 16 elements with everything being <= 1.
        Returns:
        An array of percentages
      • getSizeRatio

        public double getSizeRatio()
        Gets the width/height size ratio.
        Returns:
        The width/height size ratio
      • getWidthAverage

        public double getWidthAverage()
        Gets the average width for everything trained with this object.
        Returns:
        The average width. Will return 0 if finishRecalculations() has not been invoked.
      • getHeightAverage

        public double getHeightAverage()
        Gets the average height for everything trained with this object.
        Returns:
        The average height. Will return 0 if finishRecalculations() has not been invoked.
      • getMinCenter

        public double getMinCenter()
        Gets the minimum center value of all the training data used.
        Returns:
        The minimum center value of all the training data used
      • getMaxCenter

        public double getMaxCenter()
        Gets the maximum center value of all the training data used.
        Returns:
        The maximum center value of all the training data used
      • recalculateTo

        public void recalculateTo​(double width,
                                  double height)
        Adds the given width and height variables to the internal list to be put into calculations upon invoking finishRecalculations().
        Parameters:
        width - The width of the character
        height - The height of the character
      • undoLastRecalculations

        public void undoLastRecalculations​(int amount)
        Removed the last x entries added by recalculateTo(SearchCharacter).
        Parameters:
        amount - The amount of entries to remove
      • recalculateCenter

        public void recalculateCenter​(double center)
        If the given value is less than the minimum center, it's the new minimum center, and if it's bigger than the maximum center, it will be the new maximum center. (Retrievable via and {@link #getMinCenter()}).
        Parameters:
        center - The value to add as center
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class Character