- java.lang.Object
-
- com.uddernetworks.newocr.character.Character
-
- com.uddernetworks.newocr.character.TrainedCharacterData
-
-
Constructor Summary
Constructors Constructor Description TrainedCharacterData(char letter)
Creates aTrainedCharacterData
from a character letter with a modifier of 0.TrainedCharacterData(char letter, int modifier)
Creates aTrainedCharacterData
from a character value with a given modifier value.
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
void
finishRecalculations()
Calculates everything based on the data inserted byrecalculateTo(double, double)
andrecalculateTo(SearchCharacter)
by averaging the width and heights provided, and averaging the percentages retrieved fromSearchCharacter
s.double
getHeightAverage()
Gets the average height for everything trained with this object.double
getMaxCenter()
Gets the maximum center value of all the training data used.double
getMinCenter()
Gets the minimum center value of all the training data used.double[]
getSegmentPercentages()
Gets the calculated array of the percentages for each section.double
getSizeRatio()
Gets the width/height size ratio.double
getWidthAverage()
Gets the average width for everything trained with this object.int
hashCode()
boolean
isEmpty()
Gets if anything has been recalcuated/prepared to be recalculated to the character, e.g.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.void
recalculateTo(double width, double height)
Adds the given width and height variables to the internal list to be put into calculations upon invokingfinishRecalculations()
.void
recalculateTo(SearchCharacter searchCharacter)
Does the same thing asrecalculateTo(double, double)
but with aSearchCharacter
, and it includes its percentages as well.void
undoLastRecalculations(int amount)
Removed the last x entries added byrecalculateTo(SearchCharacter)
.-
Methods inherited from class com.uddernetworks.newocr.character.Character
compareTo, getHeight, getLetter, getModifier, getWidth, getX, getY, isInBounds, isInXBounds, isInYBounds, isOverlappingX, isOverlappingY, setHeight, setLetter, setModifier, setWidth, setX, setY, toString
-
-
-
-
Constructor Detail
-
TrainedCharacterData
public TrainedCharacterData(char letter)
Creates aTrainedCharacterData
from a character letter with a modifier of 0.- Parameters:
letter
- The known character letter
-
TrainedCharacterData
public TrainedCharacterData(char letter, int modifier)
Creates aTrainedCharacterData
from a character value with a given modifier value.- Parameters:
letter
- The known character valuemodifier
- 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
-
isEmpty
public boolean isEmpty()
Gets if anything has been recalcuated/prepared to be recalculated to the character, e.g. by usingrecalculateTo(double, double)
orrecalculateTo(SearchCharacter)
.- Returns:
- If anything has been recalculated
-
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 invokingfinishRecalculations()
.- Parameters:
width
- The width of the characterheight
- The height of the character
-
recalculateTo
public void recalculateTo(SearchCharacter searchCharacter)
Does the same thing asrecalculateTo(double, double)
but with aSearchCharacter
, and it includes its percentages as well.- Parameters:
searchCharacter
- TheSearchCharacter
to be recalculated to
-
undoLastRecalculations
public void undoLastRecalculations(int amount)
Removed the last x entries added byrecalculateTo(SearchCharacter)
.- Parameters:
amount
- The amount of entries to remove
-
finishRecalculations
public void finishRecalculations()
Calculates everything based on the data inserted byrecalculateTo(double, double)
andrecalculateTo(SearchCharacter)
by averaging the width and heights provided, and averaging the percentages retrieved fromSearchCharacter
s.
-
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 viaand {@link #getMinCenter()}
).- Parameters:
center
- The value to add as center
-
-