Hi, I am sorry but I can’t publish whole code for now. Here are the basic methods I am using:
takePicture = async camera => {
this.setState({
loading: true
});
try {
const data = await camera.takePictureAsync(PICTURE_OPTIONS);
if (!data.uri) {
throw “OTHER”;
}
this.setState(
{
image: data.uri
},
() => {
console.log(“Image URI : “+data.uri);
this.processImage(data.uri, {
height: data.height,
width: data.width
});
}
);
} catch (e) {
console.warn(e);
this.reset(e);
}
};
processImage = async (uri, imageProperties) => {
// var string = uri;
// var result = string.replace(“file:///”, “/”);
console.log(“data.uri : processImage called : “+uri);
const visionResp = await RNTextDetector.detectFromUri(uri);
console.log(visionResp);
if (!(visionResp && visionResp.length > 0)) {
throw “UNMATCHED”;
}
this.setState({
visionResp: this.mapVisionRespToScreen(visionResp, imageProperties)
});
};
Here, the problem is I am not getting any response with this line: “await RNTextDetector.detectFromUri(uri);”
Moreover, when I checked logcat in Android Studio it is giving me below mentioned error everytime when ‘RNTextDetector.detectFromUri(uri)’ called.
com.google.firebase.ml.common.FirebaseMLException: Waiting for the text recognition model to be downloaded. Please wait.
System.err: at com.google.android.gms.internal.firebase_ml.zziz.zzc(Unknown Source)
System.err: at com.google.android.gms.internal.firebase_ml.zziz.zza(Unknown Source)
System.err: at com.google.android.gms.internal.firebase_ml.zzhl.call(Unknown Source)
System.err: at com.google.android.gms.internal.firebase_ml.zzhg.zza(Unknown Source)
System.err: at com.google.android.gms.internal.firebase_ml.zzhh.run(Unknown Source)
System.err: at android.os.Handler.handleCallback(Handler.java:739)
System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
System.err: at android.os.Looper.loop(Looper.java:148)
System.err: at android.os.HandlerThread.run(HandlerThread.java:61)
SoLoader: About to load: libimagepipeline.so
SoLoader: libimagepipeline.so not found on /data/data/com.compoundinterestdemo/lib-main
SoLoader: Result 0 for libimagepipeline.so in source com.facebook.soloader.ApkSoSource[root = /data/data/com.compoundinterestdemo/lib-main flags = 1]
SoLoader: Extraction logs: null
SoLoader: Loaded: libimagepipeline.so
It process something in background when detectFromUri method calls and after sometimes it throws above error.