Package org.hildan.ocr
Class TextDetector
-
- All Implemented Interfaces:
public final class TextDetectorDetects text based on the given textColorFilter. The filter should match the color of the text.
-
-
Constructor Summary
Constructors Constructor Description TextDetector(Color textColor)Creates a new TextDetector using a ColorSimilarityFilter with the given textColor as reference. TextDetector(ColorFilter textColorFilter, Boolean trimSubImagesVertically)
-
Method Summary
Modifier and Type Method Description final DoublesimilarityScore(BufferedImage img1, BufferedImage img2)Returns the proportion of the images that match, as a score between 0.0 and 1.0. final List<BufferedImage>splitTextElements(BufferedImage image)Splits the given image into text elements. final List<ImagePart>splitTextAndSpaces(BufferedImage image)Splits the given image into parts of text and spaces. -
-
Constructor Detail
-
TextDetector
TextDetector(Color textColor)
Creates a new TextDetector using a ColorSimilarityFilter with the given textColor as reference.
-
TextDetector
TextDetector(ColorFilter textColorFilter, Boolean trimSubImagesVertically)
-
-
Method Detail
-
similarityScore
final Double similarityScore(BufferedImage img1, BufferedImage img2)
Returns the proportion of the images that match, as a score between 0.0 and 1.0. A pixel is considered a match if it either represents text on both images or empty space on both images.
-
splitTextElements
final List<BufferedImage> splitTextElements(BufferedImage image)
Splits the given image into text elements.
-
splitTextAndSpaces
final List<ImagePart> splitTextAndSpaces(BufferedImage image)
Splits the given image into parts of text and spaces.
-
-
-
-