OCR With Tess4j

Tess4j is a JNA-based wrapper for Tesseract OCR DLL, the library provides optical character recognition (OCR) support for:

  • TIFF, JPEG, GIF, PNG, and BMP image formats
  • Multi-page TIFF images
  • PDF document format

How To Run The Sample

Step 1 :Download the maven  project from here

Step 2 : Run the Example

Add VM Argument

64 bit

-Djna.library.path=${workspace_loc:/ocr-tess4j-example}/dlls/x64

32 bit

-Djna.library.path=${workspace_loc:/ocr-tess4j-example}/dlls/x86

ocr6

  Step 3 : Output

ocr4 ocr5

Advertisements

9 thoughts on “OCR With Tess4j

  1. Is the same application works in unix OS. We need the same extraction of content from scanned PDF but the server is in Unix Solaris. Please let me know whether it works for that.
    In the above example I see the dlls, so i think it only works for Windows.

    Thanks in advance.

  2. Hi , i need your help in getting the toast message text from the image

    I got the output except toast message text .

  3. I am getting error,

    log4j:WARN No appenders could be found for logger (net.sf.ghost4j.Ghostscript).
    log4j:WARN Please initialize the log4j system properly.
    Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘libtesseract302’: The specified module could not be found.

    at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
    at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
    at com.sun.jna.Library$Handler.(Library.java:123)
    at com.sun.jna.Native.loadLibrary(Native.java:255)
    at com.sun.jna.Native.loadLibrary(Native.java:241)
    at net.sourceforge.tess4j.TessAPI.(Unknown Source)
    at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
    at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
    at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
    at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
    at com.nadeem.app.ocr.TesseractExample.main(TesseractExample.java:16)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s