DavidStrausz / cordova-plugin-live-ocr

A cordova plugin which provides live ocr scanning capabilities for Android and iOS using Tesseract
19 stars 8 forks source link
android android-ocr cordova-plugin ionic ios tesseract

Cordova plugin for live OCR recognition using native Tesseract library - For Android and iOS

Installation:

Integration in Ionic 2 project

Create a Native Wrapper:

@Plugin({ pluginName: 'LiveOcrPlugin', plugin: 'cordova-plugin-live-ocr', pluginRef: 'LiveOcrPlugin', repo: 'https://github.com/DavidStrausz/cordova-plugin-live-ocr', platforms: ['Android', 'iOS'] }) export class LiveOcrPlugin { @Cordova() static recognizeText(successCallback, errorCallback): Promise { return; }

@Cordova() static loadLanguage(language, successCallback, errorCallback): any { } }


### Usage in project  
* `loadLanguage()` is only required in android case, iOS version has a tessdata file integrated  
```typescript
import {LiveOcrPlugin} from 'path/to/native/wrapper/LiveOcrPlugin';
this.platform.ready().then(() => {
    //load language file for android (it is included for ios)
        LiveOcrPlugin.loadLanguage(
    'eng', 
    (success) => {
        //success callback
    },
    (error) => {
        //error callback
    });

    //start recognition process
    LiveOcrPlugin.recognizeText(
    (success) => {
        //success callback
    },
    (error) => {
        //error callback
    });
});

Important Notes:


iOS:

DEV-requirements:

How to modify and build:

Modify and build:


Android:

Basic changes can be done in these two files located in cordova-plugin-live-ocr/src/android:

Changes which regard the camera view or the tesseract library can be done as follows:

Tess-two library:
Camera view:

Finally:


TODO:

Possibly resolved: