com.aspose.ocr.core.publicapi
Class OcrEngine

java.lang.Object
  extended by com.aspose.ocr.core.publicapi.OcrEngine

public final class OcrEngine
extends Object

Main OCR class. Users will use instance of this class most of the time.


Constructor Summary
OcrEngine(String resourcesFilePath, int[] netNumbers, String xmlEtalonFileName, String fontCollectionFileName)
          Initializes a new instance of the OcrEngine class.
OcrEngine(String xmlFilesPath, String xmlEtalonFilePath, String fontCollectionPath)
          Initializes a new instance of the OcrEngine class.
OcrEngine(String xmlFilesPath, String xmlEtalonFilePath, String fontCollectionPath, int[] netNumbers)
          Initializes a new instance of the OcrEngine class.
 
Method Summary
 OCRConfig getConfig()
          Gets configuration.
 LanguageContainer getLanguages()
          Gets container recognition languages.
 IRecognizedText getText()
          Gets recognized text.
 boolean process()
          Runs the recognition process.
 void setConfig(OCRConfig value)
          Sets configuration.
 void setImage(File file)
          Sets the picture to recognize the text from.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OcrEngine

public OcrEngine(String resourcesFilePath,
                 int[] netNumbers,
                 String xmlEtalonFileName,
                 String fontCollectionFileName)
Initializes a new instance of the OcrEngine class.

Parameters:
resourcesFilePath - zip file containing networks xml files, xml etalon file and font collection file
netNumbers - numbers of the networks in list
xmlEtalonFileName - etalon file name
fontCollectionFileName - font collection file name

OcrEngine

public OcrEngine(String xmlFilesPath,
                 String xmlEtalonFilePath,
                 String fontCollectionPath,
                 int[] netNumbers)
Initializes a new instance of the OcrEngine class.

Parameters:
xmlFilesPath - path to folder containing xml files of networks
netNumbers - numbers of the networks in list
xmlEtalonFilePath - etalon file name
fontCollectionPath - path to font collection file

OcrEngine

public OcrEngine(String xmlFilesPath,
                 String xmlEtalonFilePath,
                 String fontCollectionPath)
Initializes a new instance of the OcrEngine class.

Parameters:
xmlFilesPath - path to folder containing xml files of networks
xmlEtalonFilePath - etalon file name
fontCollectionPath - path to font collection file
Method Detail

getConfig

public OCRConfig getConfig()
Gets configuration.


setConfig

public void setConfig(OCRConfig value)
Sets configuration.


setImage

public void setImage(File file)
Sets the picture to recognize the text from. This property must be set before recognition or specified as one of arguments during Process call.


getText

public IRecognizedText getText()
Gets recognized text. This property is only available after recognition is complete, otherwise exception will be raised.

Returns:
IRecognizedText instance containing text result

getLanguages

public LanguageContainer getLanguages()
Gets container recognition languages. Enables user to define a list of languages to use for recognition. You may add several languages here. This property must be set before recognition or specified as one of arguments during Process call. Recognition of multiple languages. The text is recognized by words. Each recognized word has a specific language. There is priority of recognition languages. Language that was added earlier to the collection has a higher priority. If the word is identical in several languages, a language that was earlier added to the collection will be selected.

Returns:
LanguageContainer instance

process

public boolean process()
                throws ApplicationException
Runs the recognition process. OcrEngine must be configured before running this method, otherwise Exception will be thrown. Once this method is called, you may get recognized text from Text property. Before calling the method, add at least one language to Languages and set image.

Returns:
true if the text result is obtained
Throws:
ApplicationException


Copyright © 2011 Aspose. All Rights Reserved.