- java.lang.Object
-
- com.uddernetworks.newocr.recognition.OCRActions
-
-
Constructor Summary
Constructors Constructor Description OCRActions(DatabaseManager databaseManager, OCROptions options)OCRActions(SimilarityManager similarityManager, DatabaseManager databaseManager, OCROptions options)
-
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.
-
-
-
Constructor Detail
-
OCRActions
public OCRActions(DatabaseManager databaseManager, OCROptions options)
Creates a newOCRActionswith aDatabaseManagerandOCROptions. TheOCRActions(SimilarityManager, DatabaseManager, OCROptions)constructor is preferred, as without theSimilarityManagerthere is less-accurate character fetching.- Parameters:
databaseManager- TheDatabaseManagerto useoptions- TheOCROptionsto use
-
OCRActions
public OCRActions(SimilarityManager similarityManager, DatabaseManager databaseManager, OCROptions options)
- Parameters:
similarityManager- TheSimilarityManagerto usedatabaseManager- TheDatabaseManagerto useoptions- TheOCROptionsto use
-
-
Method Detail
-
getLetters
public void getLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)
Description copied from interface:ActionsGets 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.- Specified by:
getLettersin interfaceActions- Parameters:
searchImage- The image to scansearchCharacters- The list that will have all of theSearchCharacters added to
-
getLettersDuringTraining
public java.util.List<CharacterLine> getLettersDuringTraining(SearchImage searchImage)
Description copied from interface:ActionsGets theSearchCharacters found in training. This is different because it assumes that there are whole lines to help group characters.- Specified by:
getLettersDuringTrainingin interfaceActions- Parameters:
searchImage- The training image to scan- Returns:
- A collection of a list contianing the characters in a line
-
getCharacterFor
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database.- Specified by:
getCharacterForin interfaceActions- Parameters:
searchCharacter- The inputSearchCharacterto match to- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterForin interfaceActions- 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
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database.- Specified by:
getCharacterForin interfaceActions- Parameters:
searchCharacter- The inputSearchCharacterto match todata- The potential trainedTrainedCharacterDatato use- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterForin interfaceActions- 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
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database.- Specified by:
getCharacterForin interfaceActions- Parameters:
searchCharacter- The inputSearchCharacterto match todiffs- The potentialImageLetters- Returns:
- The
ImageLetterobject with theDatabaseCharacterinside it containing the found character
-
getCharacterFor
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs, IntPair lineBounds)
Description copied from interface:ActionsActually matches theSearchCharacterobject to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterForin interfaceActions- 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
public java.util.OptionalDouble getFontSize(ImageLetter imageLetter)
Description copied from interface:ActionsGets the estimated font size for the givenImageLetter.- Specified by:
getFontSizein interfaceActions- Parameters:
imageLetter- TheImageLetterto get the font size of- Returns:
- The font size in pixels
-
getLineBoundsForTraining
public java.util.List<IntPair> getLineBoundsForTraining(SearchImage image)
Description copied from interface:ActionsGets the top and bottom line bounds found from the value 2D array. This is used for getting characters for training data.- Specified by:
getLineBoundsForTrainingin interfaceActions- Parameters:
image- The image to get the line bounds from- Returns:
- A list of the absolute top and bottom line values
-
getOptions
public OCROptions getOptions()
Description copied from interface:ActionsGets theOCROptionstheActionsis using.- Specified by:
getOptionsin interfaceActions- Returns:
- The
OCROptionsbeing used
-
-