Package | com.distriqt.extension.ocr |
Class | public final class OCR |
Inheritance | OCR 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.
Property | Defined 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 |
Method | Defined 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 |
Constant | Defined By | ||
---|---|---|---|
EXT_CONTEXT_ID : String = com.distriqt.OCR [static] | OCR | ||
VERSION : String = 4.1.0 [static] | OCR |
implementation | property |
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:
Android
iOS
default
unknown
public function get implementation():String
isSupported | property |
isSupported:Boolean
[read-only] Whether the current device supports the extensions functionality
public static function get isSupported():Boolean
nativeVersion | property |
nativeVersion:String
[read-only]
The native version string of the native extension.
public function get nativeVersion():String
service | property |
service:OCR
[read-only] The singleton instance of the OCR class.
public static function get service():OCR
Error — If there was a problem creating or accessing the extension, or if the key is invalid
|
version | property |
version:String
[read-only]
The version of this extension.
This should be of the format, MAJOR.MINOR.BUILD
public function get version():String
OCR | () | Constructor |
public function OCR()
Constructor You should not call this directly, but instead use the singleton access
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
Initialises the extension class for use with the provided key.
Parameters
key:String |
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:BitmapData — BitmapData representation of the image to scan
| |
options:OCROptions (default = null ) — OCR Algorithm options
|
Boolean — true if the recognition process was started
successfully and false otherwise.
|
EXT_CONTEXT_ID | Constant |
public static const EXT_CONTEXT_ID:String = com.distriqt.OCR
VERSION | Constant |
public static const VERSION:String = 4.1.0