google_ml_kit_flutter
google_ml_kit_flutter copied to clipboard
google_mlkit_text_recognition: ^0.13.1 unable to return OCR of arabic verse.
Describe your issue. If applicable, add screenshots to help explain your problem.
Future<void> recognizeArabicText(File imageFile) async {
final inputImage = InputImage.fromFile(imageFile);
final textRecognizer = TextRecognizer(script: TextRecognitionScript.latin);
try {
final recognizedTextResult = await textRecognizer.processImage(inputImage);
print('RecognizedTextResult: ${recognizedTextResult.text}');
} catch (e) {
print('Error during text recognition: $e');
} finally {
textRecognizer.close();
}
}
Future<File> getImageFileFromAssets(String path) async {
final byteData = await rootBundle.load('assets/$path');
final file = File('${(await getTemporaryDirectory()).path}/$path');
await file.create(recursive: true);
await file.writeAsBytes(byteData.buffer
.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
return file;
}
Future<void> getOCRText() async {
var assetsFile = await getImageFileFromAssets('002.png');
print('Loaded image: ${assetsFile.path}, Size: ${await assetsFile.length()} bytes');
await recognizeArabicText(assetsFile);
}
recognizedTextResult.text always return empty.
Steps to reproduce.
Future<void> recognizeArabicText(File imageFile) async {
final inputImage = InputImage.fromFile(imageFile);
final textRecognizer = TextRecognizer(script: TextRecognitionScript.latin);
try {
final recognizedTextResult = await textRecognizer.processImage(inputImage);
print('RecognizedTextResult: ${recognizedTextResult.text}');
} catch (e) {
print('Error during text recognition: $e');
} finally {
textRecognizer.close();
}
}
Future<File> getImageFileFromAssets(String path) async {
final byteData = await rootBundle.load('assets/$path');
final file = File('${(await getTemporaryDirectory()).path}/$path');
await file.create(recursive: true);
await file.writeAsBytes(byteData.buffer
.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));
return file;
}
Future<void> getOCRText() async {
var assetsFile = await getImageFileFromAssets('002.png');
print('Loaded image: ${assetsFile.path}, Size: ${await assetsFile.length()} bytes');
await recognizeArabicText(assetsFile);
}
recognizedTextResult.text always return empty.
What is the expected result?
It should return the result
Did you try our example app?
Yes
Is it reproducible in the example app?
Yes
Reproducible in which OS?
Android, iOS and Android
Flutter/Dart Version?
No response
Plugin Version?
google_mlkit_text_recognition: ^0.13.1
@bensonarafat any update on this?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
@bensonarafat any update on this?
Any solution for this? any one