Packagecom.distriqt.extension.ocr
Classpublic final class OCR
InheritanceOCR Inheritance flash.events.EventDispatcher

This class represents the Optical Character Recognition (OCR) extension.

This extension uses the "Tesseract Open Source OCR" Engine.

In order to use this extension you must have access to some training data packaged in your application in a tessdata folder for the language(s) you are planning on using.

Training data is available here: https://github.com/tesseract-ocr/tessdata

Creating training data is outside the scope of this extension however it is possible with the tools available as part of the Tesseract Open Source project.



Public Properties
 PropertyDefined By
  implementation : String
[read-only] The implementation currently in use.
OCR
  isSupported : Boolean
[static] [read-only] Whether the current device supports the extensions functionality
OCR
  nativeVersion : String
[read-only] The native version string of the native extension.
OCR
  service : OCR
[static] [read-only] The singleton instance of the OCR class.
OCR
  version : String
[read-only] The version of this extension.
OCR
Public Methods
 MethodDefined By
  
OCR()
Constructor You should not call this directly, but instead use the singleton access
OCR
  
dispose():void
Disposes the extension and releases any allocated resources.
OCR
  
init(key:String):void
Deprecated: You no longer need to use an application key
[static] Initialises the extension class for use with the provided key.
OCR
  
recognise(image:BitmapData, options:OCROptions = null):Boolean
This function forms the main entry point for OCR functionality.
OCR
Public Constants
 ConstantDefined By
  EXT_CONTEXT_ID : String = com.distriqt.OCR
[static]
OCR
  VERSION : String = 4.1.0
[static]
OCR
Property Detail
implementationproperty
implementation:String  [read-only]

The implementation currently in use. This should be one of the following depending on the platform in use and the functionality supported by this extension:


Implementation
    public function get implementation():String
isSupportedproperty 
isSupported:Boolean  [read-only]

Whether the current device supports the extensions functionality


Implementation
    public static function get isSupported():Boolean
nativeVersionproperty 
nativeVersion:String  [read-only]

The native version string of the native extension.


Implementation
    public function get nativeVersion():String
serviceproperty 
service:OCR  [read-only]

The singleton instance of the OCR class.


Implementation
    public static function get service():OCR

Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
versionproperty 
version:String  [read-only]

The version of this extension.

This should be of the format, MAJOR.MINOR.BUILD


Implementation
    public function get version():String
Constructor Detail
OCR()Constructor
public function OCR()

Constructor You should not call this directly, but instead use the singleton access

Method Detail
dispose()method
public function dispose():void

Disposes the extension and releases any allocated resources. Once this function has been called, a call to init is neccesary again before any of the extensions functionality will work.

init()method 
public static function init(key:String):void
Deprecated: You no longer need to use an application key

Initialises the extension class for use with the provided key.

Parameters

key:String


Throws
Error — If there was a problem creating or accessing the extension, or if the key is invalid
recognise()method 
public function recognise(image:BitmapData, options:OCROptions = null):Boolean

This function forms the main entry point for OCR functionality. To use this function you load the BitmapData representation of the image you wish to scan and setup any options (such as language and whitelist characters).

If the recognition process was started successfully this function will return true. If this returns false then there was a problem with the initialisation of the extension or the algorithm, (check you have included the correct language data folder).

If recognition starts successfully, you can expect an OCREvent.RECOGNISE event to be dispatched when the algorithm completes

Parameters

image:BitmapDataBitmapData representation of the image to scan
 
options:OCROptions (default = null) — OCR Algorithm options

Returns
Booleantrue if the recognition process was started successfully and false otherwise.
Constant Detail
EXT_CONTEXT_IDConstant
public static const EXT_CONTEXT_ID:String = com.distriqt.OCR

VERSIONConstant 
public static const VERSION:String = 4.1.0