-
- All Known Implementing Classes:
OCRActions
public interface Actions
A class to provide general actions for the OCR.- Since:
- April 25, 2019
-
-
Method Summary
Modifier and Type Method Description java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter)
Actually matches theSearchCharacter
object to a real character from the database.java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs)
Actually matches theSearchCharacter
object to a real character from the database.java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data)
Actually matches theSearchCharacter
object to a real character from the database.java.util.Optional<ImageLetter>
getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.java.util.OptionalDouble
getFontSize(ImageLetter imageLetter)
Gets the estimated font size for the givenImageLetter
.void
getLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)
Gets theSearchCharacter
characters found in the givenSearchImage
.java.util.List<CharacterLine>
getLettersDuringTraining(SearchImage searchImage)
Gets theSearchCharacter
s found in training.java.util.List<IntPair>
getLineBoundsForTraining(SearchImage image)
Gets the top and bottom line bounds found from the value 2D array.OCROptions
getOptions()
Gets theOCROptions
theActions
is using.
-
-
-
Method Detail
-
getLetters
void getLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)
Gets theSearchCharacter
characters found in the givenSearchImage
. This works by dividing it up into lines, then horizontally. Each individual section then has vertical padding removed. Any 'characters' that are 2x2 pixels or less are discarded. More information on this method can be found on page 55 of this paper.- Parameters:
searchImage
- The image to scansearchCharacters
- The list that will have all of theSearchCharacter
s added to
-
getLettersDuringTraining
java.util.List<CharacterLine> getLettersDuringTraining(SearchImage searchImage)
Gets theSearchCharacter
s found in training. This is different because it assumes that there are whole lines to help group characters.- Parameters:
searchImage
- The training image to scan- Returns:
- A collection of a list contianing the characters in a line
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter)
Actually matches theSearchCharacter
object to a real character from the database.- Parameters:
searchCharacter
- The inputSearchCharacter
to match to- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter
- The inputSearchCharacter
to match tolineBounds
- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data)
Actually matches theSearchCharacter
object to a real character from the database.- Parameters:
searchCharacter
- The inputSearchCharacter
to match todata
- The potential trainedTrainedCharacterData
to use- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter
- The inputSearchCharacter
to match todata
- The potential trainedTrainedCharacterData
to uselineBounds
- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs)
Actually matches theSearchCharacter
object to a real character from the database.- Parameters:
searchCharacter
- The inputSearchCharacter
to match todiffs
- The potentialImageLetter
s- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs, IntPair lineBounds)
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter
- The inputSearchCharacter
to match todiffs
- The potentialImageLetter
slineBounds
- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getFontSize
java.util.OptionalDouble getFontSize(ImageLetter imageLetter)
Gets the estimated font size for the givenImageLetter
.- Parameters:
imageLetter
- TheImageLetter
to get the font size of- Returns:
- The font size in pixels
-
getLineBoundsForTraining
java.util.List<IntPair> getLineBoundsForTraining(SearchImage image)
Gets the top and bottom line bounds found from the value 2D array. This is used for getting characters for training data.- Parameters:
image
- The image to get the line bounds from- Returns:
- A list of the absolute top and bottom line values
-
getOptions
OCROptions getOptions()
Gets theOCROptions
theActions
is using.- Returns:
- The
OCROptions
being used
-
-