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?
    – Nicolas Raoul
    Commented May 29, 2017 at 14:10

2 Answers 2


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


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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.