- 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 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.
-
-
-
Constructor Detail
-
OCRActions
public OCRActions(DatabaseManager databaseManager, OCROptions options)
Creates a newOCRActions
with aDatabaseManager
andOCROptions
. TheOCRActions(SimilarityManager, DatabaseManager, OCROptions)
constructor is preferred, as without theSimilarityManager
there is less-accurate character fetching.- Parameters:
databaseManager
- TheDatabaseManager
to useoptions
- TheOCROptions
to use
-
OCRActions
public OCRActions(SimilarityManager similarityManager, DatabaseManager databaseManager, OCROptions options)
- Parameters:
similarityManager
- TheSimilarityManager
to usedatabaseManager
- TheDatabaseManager
to useoptions
- TheOCROptions
to use
-
-
Method Detail
-
getLetters
public void getLetters(SearchImage searchImage, java.util.List<SearchCharacter> searchCharacters)
Description copied from interface:Actions
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.- Specified by:
getLetters
in interfaceActions
- Parameters:
searchImage
- The image to scansearchCharacters
- The list that will have all of theSearchCharacter
s added to
-
getLettersDuringTraining
public java.util.List<CharacterLine> getLettersDuringTraining(SearchImage searchImage)
Description copied from interface:Actions
Gets theSearchCharacter
s found in training. This is different because it assumes that there are whole lines to help group characters.- Specified by:
getLettersDuringTraining
in 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:Actions
Actually matches theSearchCharacter
object to a real character from the database.- Specified by:
getCharacterFor
in interfaceActions
- Parameters:
searchCharacter
- The inputSearchCharacter
to match to- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside it containing the found character
-
getCharacterFor
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, IntPair lineBounds)
Description copied from interface:Actions
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterFor
in interfaceActions
- 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
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data)
Description copied from interface:Actions
Actually matches theSearchCharacter
object to a real character from the database.- Specified by:
getCharacterFor
in interfaceActions
- 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
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, java.util.List<TrainedCharacterData> data, IntPair lineBounds)
Description copied from interface:Actions
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterFor
in interfaceActions
- 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
public java.util.Optional<ImageLetter> getCharacterFor(SearchCharacter searchCharacter, it.unimi.dsi.fastutil.objects.Object2DoubleMap<ImageLetter> diffs)
Description copied from interface:Actions
Actually matches theSearchCharacter
object to a real character from the database.- Specified by:
getCharacterFor
in interfaceActions
- Parameters:
searchCharacter
- The inputSearchCharacter
to match todiffs
- The potentialImageLetter
s- Returns:
- The
ImageLetter
object with theDatabaseCharacter
inside 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:Actions
Actually matches theSearchCharacter
object to a real character from the database with line bounds for improved accuracy.- Specified by:
getCharacterFor
in interfaceActions
- 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
public java.util.OptionalDouble getFontSize(ImageLetter imageLetter)
Description copied from interface:Actions
Gets the estimated font size for the givenImageLetter
.- Specified by:
getFontSize
in interfaceActions
- Parameters:
imageLetter
- TheImageLetter
to get the font size of- Returns:
- The font size in pixels
-
getLineBoundsForTraining
public java.util.List<IntPair> getLineBoundsForTraining(SearchImage image)
Description copied from interface:Actions
Gets the top and bottom line bounds found from the value 2D array. This is used for getting characters for training data.- Specified by:
getLineBoundsForTraining
in 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:Actions
Gets theOCROptions
theActions
is using.- Specified by:
getOptions
in interfaceActions
- Returns:
- The
OCROptions
being used
-
-