NeutrinosPlatform / cordova-plugin-mobile-ocr

A cordova plugin that can accept image URI or Base64 data and returns the text present in the image as string without need for network. You can also try :- https://github.com/NeutrinosPlatform/cordova-plugin-ml-text
MIT License
49 stars 30 forks source link

Could not set up the detector #26

Open ChaminThilakarathne opened 4 years ago

ChaminThilakarathne commented 4 years ago

I have used two devices which are Samsung Galaxy J Max and Huawei Honor 6X for testing my app, Plugin working smoothly on Huawei device and Samsung device shows the error "Could not set up the detector" how can i fix this ? can i add bellow pakages separately com.google.android.gms.vision.Frame; com.google.android.gms.vision.text.Text; com.google.android.gms.vision.text.TextBlock; com.google.android.gms.vision.text.TextRecognizer;

ChaminThilakarathne commented 4 years ago

this is the logcat of Samsung android device image

ChrisTomAlx commented 4 years ago

Hey @Chamiyalt Usually the two culprits are network and internal storage space. Make sure these two are accounted for. If that is not causing the problem, try clearing the app data from settings and see if that works

Also could you send this image as text so I can copy - paste - search.

Cheers, Chris Neutrinos

ChaminThilakarathne commented 4 years ago
Preparing logs for uploading
D/ActivityManager(  749): bindService callerProcessName:android, calleePkgName: com.google.android.gms, action: android.accounts.AccountAuthenticator
D/ActivityManager(  749): caller:android.app.ActivityThread$ApplicationThread@1b1d5da8, r.packageName :com.google.android.gms
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.auth.account.data.service.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@3230b3dc, r.packageName :com.google.android.gms
W/ChimeraUtils( 1598): Non Chimera context
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: null
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@39f4e26b, r.packageName :com.google.android.gms
W/ChimeraUtils( 1598): Non Chimera context
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.clearcut.service.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@347d3a47, r.packageName :com.google.android.gms
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@2f058012, r.packageName :com.google.android.gms
D/ActivityManager(  749): bindService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms, action: com.google.android.gms.auth.account.workaccount.START
D/ActivityManager(  749): caller:android.app.ApplicationThreadProxy@2cb78b5e, r.packageName :com.google.android.gms
I/PlayCommon(12868): [1696] aixp.c(185): Connecting to server: https://play.googleapis.com/play/log?format=raw&proto_v2=true
I/System.out(12868): (HTTPLog)-Static: isSBSettingEnabled false
D/ActivityManager(  749):  getDeferredInfo final delay 1980
W/System.err( 1525): remove failed: ENOENT (No such file or directory) : /storage/emulated/0/SHAREit/download/videos/.caches/78530cfdd35de28fe358de0ec424c7f3_55c0ca894b3da8b6b109fb83727896e9
W/AS.Task.Scheduler( 1525): 12:11:33.153[825] task execute failed: retry = true, error = com.ushareit.net.http.TransmitException: [ code = 1, msg = java.net.ConnectException: Failed to connect to /192.168.43.203:2999], task
= [id = http://cdn.ushareit.com/sz2/t_v/181010/vls0f_240p.mp4, length = 0/466807, retry = 20, cancelled = false], url = http://192.168.43.203:2999/cloudcache?type=cachefile&id=vls0f&size=466807&filetype=raw&ignoresize=true,
ChaminThilakarathne commented 4 years ago

https://stackoverflow.com/a/39313255/7596996 can you tell is it the problem?

ChrisTomAlx commented 4 years ago

Let me take a look. Thanks for sharing the logs

Cheers, Chris Neutrinos

ChrisTomAlx commented 4 years ago

These logs don't look like they are linked to ocr. Also this log is different from the original image you sent. Here is something you could try. In the samsung device, create a vanilla cordova app and use the ocr plugin directly with the camera plugin and see if it works fine.

Cheers, Chris Neutrinos

ChaminThilakarathne commented 4 years ago

Problem is happened in thread that u have created , i think thread come in to waiting state during the downloading of google packages then processor give the chance to next priority thread then it shows the exception,i will get the those packages out of the tread it was worked smoothly. thanks a lot for your support.

ChrisTomAlx commented 4 years ago

So the ocr runs on a separate thread, I did not want to block the UI and hence ran it on a different thread. Would it be better if the ocr ran on the UI thread or the user of the plugin had an option to choose between UI thread or new thread?

Would love your suggestion as you seem to be one of the few who have run into this issue and solved it.

Cheers, Chris Neutrinos

ChaminThilakarathne commented 4 years ago

better to has option to choose between UI thread or new thread, with crystal clear documentation 👯‍♂

ChaminThilakarathne commented 4 years ago

apart from i assume some of devices are allowed to download google packages in separate thread that you are using but some of the devices which have less performance is allocated less time to tread that u are using because of tread can't download google packages correctly.

haghighi251 commented 3 years ago

Hi, I have the same error. I published my problem here: https://stackoverflow.com/questions/65470328/cordova-textocr-convert-image-to-text

ChrisTomAlx commented 3 years ago

@haghighi251 did you try eveerything mentioned in the comments ? Also you might want to use https://github.com/NeutrinosPlatform/cordova-plugin-ml-text instead of this plugin.

Cheers, Chris Neutrinos

haghighi251 commented 3 years ago

@ChrisTomAlx as far as I know yes, But I'm not sure about treading. Do download google packages have a connection with my pc devices? I make an empty application with the ocr plugin and Cordova camera plugin and then added the android platform and then I made apk file. But I have that problem yet. I'm using windows 10 with Cordova version 10 and android platform version 9. I tested ad some different devices such as android 8-10, But it didn't worked. And one thing more, ml text plugin didn't work and had the same problem.

ChrisTomAlx commented 3 years ago

Does your phone have a stable internet connection when installing the application?

Cheers, Chris Neutrinos

haghighi251 commented 3 years ago

@ChrisTomAlx Yes, It does have.