Class TesseractOCR
- java.lang.Object
-
- science.aist.imaging.tesseract.imageprocessing.opticalcharacterrecognition.tesseract.TesseractOCR
-
- All Implemented Interfaces:
AutoCloseable
,Function<ImageWrapper<short[][][]>,OCRResult>
public class TesseractOCR extends Object implements Function<ImageWrapper<short[][][]>,OCRResult>, AutoCloseable
OCR Implementation using Tesseract
- Since:
- 1.0
- Author:
- Andreas Pointner
-
-
Constructor Summary
Constructors Constructor Description TesseractOCR(String pathToTessData)
Constructor to initialize api.TesseractOCR(String pathToTessData, String tessLanguage)
Constructor to initialize api.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OCRResult
apply(ImageWrapper<short[][][]> ji)
Performs OCR on given Java Image and returns found text.void
close()
Close function to End api.void
setMode(OCRMode m)
Set the Mode type (how to perform the image)void
setWhitespaceCharacters(String characters)
Set whitelist characters, this help the ocr to know which letters are expected
-
-
-
Constructor Detail
-
TesseractOCR
public TesseractOCR(String pathToTessData)
Constructor to initialize api.- Parameters:
pathToTessData
- relative to this path there has to be stored the tessdata folder with the correct language files in it. pathToTessData/tessdata/deu.traineddata
-
TesseractOCR
public TesseractOCR(String pathToTessData, String tessLanguage)
Constructor to initialize api.- Parameters:
pathToTessData
- relative to this path there has to be stored the tessdata folder with the correct language files in it. pathToTessData/tessdata/deu.traineddatatessLanguage
- the language with which tesseract should be initialized
-
-
Method Detail
-
apply
public OCRResult apply(ImageWrapper<short[][][]> ji)
Performs OCR on given Java Image and returns found text.- Specified by:
apply
in interfaceFunction<ImageWrapper<short[][][]>,OCRResult>
- Parameters:
ji
- java image- Returns:
- the text which was found
-
setWhitespaceCharacters
public void setWhitespaceCharacters(String characters)
Set whitelist characters, this help the ocr to know which letters are expected- Parameters:
characters
- whitelist characters
-
setMode
public void setMode(OCRMode m)
Set the Mode type (how to perform the image)- Parameters:
m
- mode
-
close
public void close()
Close function to End api.- Specified by:
close
in interfaceAutoCloseable
-
-