# Java OCR library

I'm looking for some open optical character recognition (OCR) raw libraries that I can use to create a Java application that compares them. Anywhere I search I find just applications to OCR.

• Are you OK with having to train the OCR with your data? If not, what languages do you want to OCR? For instance Japanese kanjis, or Arabic numbers. Also, what is your budget? May 29 '17 at 14:10

You can use

I have used tesseract (first option) and found that it is quite accurate (not 100% in my case). I directly used trained data for recognition. You can start with following code.

    Tesseract tess = new Tesseract();

tess.setDatapath(tessDataPath); //Path to tessdata directory

String text = tess.doOCR(new File(path)); // Path to input image

System.out.println(text)


Hope this helps.

If you are interested in a commercial solution, you can check out the LEADTOOLS OCR SDK. There is no machine training needed and it can run straight out of the box. Disclaimer: I am an employee of this company.

OCR can be performed on an image with only a few lines of code:

OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD);
ocrEngine.startup(null, null, null, null);
ocrEngine.getAutoRecognizeManager().run("C:\\in.tif", "C:\\out.pdf",
DocumentFormat.PDF, null);