com.java4less.ocr.tess3
Class OCRFacade

java.lang.Object
  extended by com.java4less.ocr.tess3.OCRFacade

public class OCRFacade
extends java.lang.Object

Facade class for running OCR on an image file


Constructor Summary
OCRFacade()
           
 
Method Summary
 java.lang.String recognizeFile(java.lang.String fileName, java.lang.String language)
          recognizes text image file
 java.lang.String recognizeImage(byte[] data, java.lang.String format, java.lang.String language)
          recognizes text image file
 void setTessDataDir(java.lang.String tessDataDir)
          directory where the subdirectory TessData is located.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCRFacade

public OCRFacade()
Method Detail

recognizeFile

public java.lang.String recognizeFile(java.lang.String fileName,
                                      java.lang.String language)
                               throws java.lang.Exception
recognizes text image file

Parameters:
fileName - image file
language - values: eng (english), fra (french), deu (german), spa (spanish), ita (italian) and nld (for dutch). You can download the language files from here http://code.google.com/p/tesseract-ocr/downloads/list
Returns:
content of the file as text. Pages will be separated by an empty line containing the form feed \f character
Throws:
java.lang.Exception

recognizeImage

public java.lang.String recognizeImage(byte[] data,
                                       java.lang.String format,
                                       java.lang.String language)
                                throws java.lang.Exception
recognizes text image file

Parameters:
data - image bytes
format - format of the image (tif, gif, png or jpg)
language - eng (english), fra (french), deu (german), spa (spanish), ita (italian) and nld (for dutch). You can download the language files from here http://code.google.com/p/tesseract-ocr/downloads/list
Returns:
content of the image as text. Pages will be separated by an empty line containing the form feed \f character
Throws:
java.lang.Exception

setTessDataDir

public void setTessDataDir(java.lang.String tessDataDir)
directory where the subdirectory TessData is located. Default is the working directory

Parameters:
tessDataDir -