com.qoppa.ocr
Class OCRBridge

java.lang.Object
  extended by com.qoppa.ocr.OCRBridge

public class OCRBridge
extends Object

This class provides method to configure and use the Tesseract OCR engine. The OCR engine is implemented in native code, so this class provides methods to load the JNI libraries and tell the engine where data files are located.

Author:
Qoppa Software

Constructor Summary
OCRBridge()
           
 
Method Summary
static String getTesseractDataPath()
          Gets the path to the Tesseract language data
static void initialize(String tesseractLibraryPath, String tesseractDataPath)
          Initializes the Tesseract bridge with the path to the native libraries and the path to the language data files.
static boolean isInitialized()
          Determines whether the OCRBridge is initialized.
static boolean isLoaded()
          Determines whether the OCRBridge is successfully loaded.
static void setTesseractDataPath(String tesseractDataPath)
          Set the path to the Tesseract language data
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OCRBridge

public OCRBridge()
Method Detail

initialize

public static void initialize(String tesseractLibraryPath,
                              String tesseractDataPath)
                       throws OCRException,
                              IOException
Initializes the Tesseract bridge with the path to the native libraries and the path to the language data files. This method must be called before performing OCR. Once the Tesseract bridge is initialized, this method will throw an OCRException if the method is called again.

Parameters:
tesseractLibraryPath - the path to the native Tesseract libraries
tesseractDataPath - the path to the Tesseract language data files
Throws:
OCRException
IOException

isLoaded

public static boolean isLoaded()
Determines whether the OCRBridge is successfully loaded.

Returns:
true if successfully loaded, false otherwise

isInitialized

public static boolean isInitialized()
Determines whether the OCRBridge is initialized.

Returns:
true if initialized, false otherwise

getTesseractDataPath

public static String getTesseractDataPath()
Gets the path to the Tesseract language data

Returns:
this component's name

setTesseractDataPath

public static void setTesseractDataPath(String tesseractDataPath)
Set the path to the Tesseract language data

Parameters:
tesseractDataPath - path to the Tesseract language data