-
- All Known Implementing Classes:
DefaultScannedImage
public interface ScannedImage
The resulting object from an image being scanned.- Since:
- April 25, 2019
-
-
Method Summary
Modifier and Type Method Description void
addLine(int y, java.util.List<ImageLetter> databaseCharacterList)
Adds a line containingImageLetter
s.java.awt.image.BufferedImage
getBinarizedImage()
Gets the binarized image before any preprocessingit.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<ImageLetter>>
getGrid()
Returns the raw, mutable grid ofImageLetter
s internally used with the key of the mpa being the exact Y position of the line.java.util.Optional<java.util.List<ImageLetter>>
getGridLineAtIndex(int index)
Gets the line at the stored index.java.util.List<ImageLetter>
getLine(int y)
Gets the line at the given index value.int
getLineCount()
gets the amount of lines in the image.it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<java.util.List<ImageLetter>>
getLineEntry(int y)
Gets both the line Y and values at the given index value.java.io.File
getOriginalFile()
Gets the originalFile
scanned by the OCR.java.awt.image.BufferedImage
getOriginalImage()
Gets the original image scanned by the OCR.java.lang.String
getPrettyString()
Gets the string of a scanned imagejava.util.Optional<ImageLetter>
letterAt(int index)
Gets the letter at the given index of the actualgetPrettyString()
position, meaning newlines are not returned.ScannedImage
stripLeadingSpaces()
Removes all common leading spaces, just like howOCRUtils.removeLeadingSpaces(String)
removes empty spaces, but with actualImageLetter
objects.
-
-
-
Method Detail
-
getPrettyString
java.lang.String getPrettyString()
Gets the string of a scanned image- Returns:
- The string of a scanned image
-
stripLeadingSpaces
ScannedImage stripLeadingSpaces()
Removes all common leading spaces, just like howOCRUtils.removeLeadingSpaces(String)
removes empty spaces, but with actualImageLetter
objects.- Returns:
- The current
ScannedImage
-
letterAt
java.util.Optional<ImageLetter> letterAt(int index)
Gets the letter at the given index of the actualgetPrettyString()
position, meaning newlines are not returned.- Parameters:
index
- The character index- Returns:
- The ImageLetter at the given position, if found
-
getGridLineAtIndex
java.util.Optional<java.util.List<ImageLetter>> getGridLineAtIndex(int index) throws java.lang.IndexOutOfBoundsException
Gets the line at the stored index. This is NOT by the y value.- Parameters:
index
- The index of the row- Returns:
- The row
- Throws:
java.lang.IndexOutOfBoundsException
-
getLineCount
int getLineCount()
gets the amount of lines in the image.- Returns:
- The amount of lines in the image
-
getGrid
it.unimi.dsi.fastutil.ints.Int2ObjectMap<java.util.List<ImageLetter>> getGrid()
Returns the raw, mutable grid ofImageLetter
s internally used with the key of the mpa being the exact Y position of the line.- Returns:
- The raw, mutable grid of values
-
addLine
void addLine(int y, java.util.List<ImageLetter> databaseCharacterList)
Adds a line containingImageLetter
s.- Parameters:
y
- The exact Y position of the linedatabaseCharacterList
- A list ofImageLetter
s as the line
-
getLine
java.util.List<ImageLetter> getLine(int y)
Gets the line at the given index value.- Parameters:
y
- The index of the line- Returns:
- The line at the given index value
-
getLineEntry
it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<java.util.List<ImageLetter>> getLineEntry(int y)
Gets both the line Y and values at the given index value.- Parameters:
y
- The index of the line- Returns:
- The line at the given Y index value
-
getBinarizedImage
java.awt.image.BufferedImage getBinarizedImage()
Gets the binarized image before any preprocessing- Returns:
- The binarized image, which may be null if pulled from caches
-
getOriginalImage
java.awt.image.BufferedImage getOriginalImage()
Gets the original image scanned by the OCR.- Returns:
- The original image, which may be null if pulled from caches
-
getOriginalFile
java.io.File getOriginalFile()
Gets the originalFile
scanned by the OCR.- Returns:
- The original File, which may be null if pulled from caches
-
-