gustavomazzoni / cordova-plugin-tesseract

Cordova Plugin for OCR process using Tesseract
77 stars 34 forks source link

Update Installation/Setup Process of Plugin #14

Open zindelluib opened 7 years ago

zindelluib commented 7 years ago

Can you update the installation/setup process directions in the ReadMe sir @gustavomazzoni . I hope you can have a new instruction of using this plugin with the "LATEST" ionic version

one-geek commented 7 years ago

Work for me:

1) Download or clone the cordova-plugin-tesseract and install it $ git clone https://github.com/gustavomazzoni/cordova-plugin-tesseract $ ionic plugin add path-to-your/cordova-plugin-tesseract

2) Refresh platform folders $ ionic platform rm android $ ionic platform add android

// Follow all gustavomazzoni steps, but 2.3 2.3 Edit your-project/platforms/android/build.gradle file and add 'tess-two' like this

Original Recommantion at original tess-two github (https://github.com/rmtheis/tess-two) is

dependencies {
// SUB-PROJECT DEPENDENCIES END
compile 'com.rmtheis:tess-two:6.1.1'
}

instead of ...

dependencies {
// SUB-PROJECT DEPENDENCIES END
compile project(':tess-two')
}

2.4 Forget this shity step

// If it build, everything good :) $ ionic build android

// Then, dont forget the code

    $scope.testScanOCR = function() {

        var language = 'eng'; //fra

        TesseractPlugin.loadLanguage(language, function(response) {
            console.log('language', response);
        }, function(reason) {
            console.log('Error on loading OCR file for your language. ' + reason);
        });

        cordovaService.takePicture().then(function (imageData) {
            if (!imageData){
                return;
            }

            $timeout(function() {
                TesseractPlugin.recognizeText(imageData, language, function(recognizedText) {
                    alert(recognizedText);
                }, function(reason) {
                    console.log('Error on recognizing text from image. ' + reason);
                });
            }, 200);

        });
    }

2.5 $ ionic run android

zindelluib commented 7 years ago

thank you @guerson . I just want to ask you sir. Do you have a simple working app using this plugin? Can I have a copy of it.It will be very helpful to me if you can give . I will put your name as a credit for your help in our project

one-geek commented 7 years ago

No i dont have this kind of project.

But, after I testing "cordova-plugin-tesseract with tess-two" for android and "cordova-plugin-tesseract with CocoaPods" with IOS. I can assure you that your are not missing anything Good about this plugin. It is not so good. I'm looking for something more powerfull like the native app on Play Store : OCR textScanner, Text Fairy, etc.

But sadly, their are not Cordova apps :(

filimo commented 7 years ago

@zindelluib I've made test app for android. You can try it(https://github.com/filimo/tesseract-ocr-cordova.git).

marko1943 commented 7 years ago

It builds succesfully following what guerson said, just check the latest tess-two project you're including on their official doc https://github.com/rmtheis/tess-two

At the time of writting this, you have to

    // SUB-PROJECT DEPENDENCIES END
    compile 'com.rmtheis:tess-two:6.2.0'

by the way, tesseract is not bad, you just have to train it

marko1943 commented 7 years ago

Also, you can skip the steps of downloading tess-two library and editing anything:

  1. Just grab and install the plugin.
  2. Insert tess-two as sub-project dependency (as above)

Good to go