cordova-plugin-tesseract icon indicating copy to clipboard operation
cordova-plugin-tesseract copied to clipboard

Update Installation/Setup Process of Plugin

Open zindelluib opened this issue 8 years ago • 6 comments

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

zindelluib avatar Dec 02 '16 18:12 zindelluib

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

one-geek avatar Dec 21 '16 15:12 one-geek

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

zindelluib avatar Dec 22 '16 04:12 zindelluib

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 :(

one-geek avatar Dec 22 '16 18:12 one-geek

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

filimo avatar Jan 13 '17 08:01 filimo

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 avatar Feb 13 '17 20:02 marko1943

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

marko1943 avatar Feb 14 '17 19:02 marko1943