-
- All Known Implementing Classes:
OCRActions
public interface ActionsA 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 theSearchCharacterobject to a real character from the database.java.util.Optional<ImageLetter>getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)Actually matches theSearchCharacterobject 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 theSearchCharacterobject 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 theSearchCharacterobject 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 theSearchCharacterobject to a real character from the database.java.util.Optional<ImageLetter>getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)Actually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.java.util.OptionalDoublegetFontSize(ImageLetter imageLetter)Gets the estimated font size for the givenImageLetter.voidgetLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)Gets theSearchCharactercharacters found in the givenSearchImage.java.util.List<CharacterLine>getLettersDuringTraining(SearchImage searchImage)Gets theSearchCharacters found in training.java.util.List<IntPair>getLineBoundsForTraining(SearchImage image)Gets the top and bottom line bounds found from the value 2D array.OCROptionsgetOptions()Gets theOCROptionstheActionsis using.
-
-
-
Method Detail
-
getLetters
void getLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)
Gets theSearchCharactercharacters 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 theSearchCharacters added to
-
getLettersDuringTraining
java.util.List<CharacterLine> getLettersDuringTraining(SearchImage searchImage)
Gets theSearchCharacters 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 theSearchCharacterobject to a real character from the database.- Parameters:
searchCharacter- The inputSearchCharacterto match to- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)
Actually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter- The inputSearchCharacterto match tolineBounds- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data)
Actually matches theSearchCharacterobject to a real character from the database.- Parameters:
searchCharacter- The inputSearchCharacterto match todata- The potential trainedTrainedCharacterDatato use- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)
Actually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter- The inputSearchCharacterto match todata- The potential trainedTrainedCharacterDatato uselineBounds- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs)
Actually matches theSearchCharacterobject to a real character from the database.- Parameters:
searchCharacter- The inputSearchCharacterto match todiffs- The potentialImageLetters- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside 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 theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Parameters:
searchCharacter- The inputSearchCharacterto match todiffs- The potentialImageLetterslineBounds- The line bounds (Key/value is top/bottom Y values respectively) for improved accuracy- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getFontSize
java.util.OptionalDouble getFontSize(ImageLetter imageLetter)
Gets the estimated font size for the givenImageLetter.- Parameters:
imageLetter- TheImageLetterto 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 theOCROptionstheActionsis using.- Returns:
- The
OCROptionsbeing used
-
-