Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data file not found #39

Open
yuliantosb opened this issue Jul 6, 2018 · 13 comments
Open

Data file not found #39

yuliantosb opened this issue Jul 6, 2018 · 13 comments

Comments

@yuliantosb
Copy link

Hello @gustavomazzoni
there is an error on my application, the error like this, I try to figure it out, but I surrender, I have no idea what should I do, please help me

D/SystemWebChromeClient: file:///android_asset/www/js/percobaan.js: Line 28 : Error on recognizing text from image. Data file not found at /storage/emulated/0/OCRFolder/tessdata/en.traineddata
I/chromium: [INFO:CONSOLE(28)] "Error on recognizing text from image. Data file not found at /storage/emulated/0/OCRFolder/tessdata/en.traineddata", source: file:///android_asset/www/js/percobaan.js (28)
D/CordovaActivity: Paused the activity.
D/CordovaActivity: Stopped the activity.
E/chromium: [ERROR:gl_context_virtual.cc(39)] Trying to make virtual context current without decoder.

here's my code

function cameraTakePicture() { 
   navigator.camera.getPicture(onSuccess, onFail, {  
      quality: 50, 
      destinationType: Camera.DestinationType.DATA_URL
   });  
   
   function onSuccess(imageData) { 
   	
		imageData = "data:image/jpeg;base64," + imageData;

		TesseractPlugin.recognizeText(imageData, 'en', function(recognizedText) {
		  $scope.text = recognizedText;
		  console.log(recognizedText);
		}, function(reason) {
		  console.log('Error on recognizing text from image. ' + reason);
		});
   }  
   
   function onFail(message) { 
      alert('Failed because: ' + message); 
   } 
}

@yuliantosb
Copy link
Author

yuliantosb commented Jul 6, 2018

Hi, I got another issue, the error like this

Failed to read bitmap please help me, I'm begging you :(

@ghost
Copy link

ghost commented Oct 5, 2018

@yuliantosb Change "en" to "eng" and you should be fine :)

@futurestar001
Copy link

Even if "en" is changed to "eng", it still returned "Failed to read bitmap", any solution?

@nicksanchezc137
Copy link

@futurestar001 what are your camera options? It should be
destinationType: Camera.DestinationType.DATA_URL

@futurestar001
Copy link

@nicksanchezc137 Really works~Thanks so much! I even tried to dip into the lib, you saved me much effort, appreciate!

@futurestar001
Copy link

@nicksanchezc137 I tried to dip into the lib to replace tesseract 3.0.4 with tesseract 4, but got no libs in cordova-plugin-tesseract, so I'm very confused that TesseractPlugin.java import many libs, but how do the code and libs connect each other and make the plugin work?
I got some clue that dependencies should be updated to support tesseract 4, and two-tess library is depended, but I am still not clear about it. Have you done some research about tesseract 4 integration before or do you have some idea on how to support tesseract 4 in the plugin? If so, could you give some guidance or give a direction?
Looking forward to your reply. Thanks so much in advance!

@ihsanberahim
Copy link

ihsanberahim commented May 21, 2019

@futurestar001 You are lucky. I try today and still face same error Failed to read bitmap.

Here is my env

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.4.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 8 other plugins)

System:

   Android SDK Tools : 26.1.1 (/Users/ihsanberahim/Library/Android/sdk)
   ios-deploy        : 1.9.4
   NodeJS            : v8.16.0 (/usr/local/Cellar/node@8/8.16.0/bin/node)
   npm               : 6.9.0
   OS                : macOS Mojave
   Xcode             : Xcode 10.2.1 Build version 10E1001

Can you share your env.

@giorgiobeggiora
Copy link

same problem here :(

@tryhardest
Copy link

Same here. Bitmap.getconfig() crash. @giorgiobeggiora @ihsanberahim did you guys solve it?

@ihsanberahim
Copy link

@tryhardest i use different solution. i not using this plugin at the end.

@giorgiobeggiora
Copy link

@ihsanberahim are you using another plugin? Can you tell us the solution you're using? Thanks in advance.

@ihsanberahim
Copy link

ihsanberahim commented Jan 31, 2020

i use capacitor instead of cordova. So, i integrate firebase ML Text Recognition native library directly. MLKit support offline and online at the same time. It is easy like several hours learning and several hour implementation.

https://twitter.com/ihsanberahim/status/1136777938429288449?s=21

@JuneTwooo
Copy link

JuneTwooo commented Jan 31, 2020

Better use https://github.com/NeutrinosPlatform/cordova-plugin-mobile-ocr/

It's 100% offline and had a better OCR recognition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants