Closed BoHellgren closed 4 years ago
I just tried with my Galasy S8 to scan https://www.google.com and text seems recognized
I have no S4 to try, my suspect is the parameter rotation: ImageRotation.rotation90
Have you tried setting other values? I have a Nexus 6 and with it i have to set rotation0 to make it working.
I think i have to get real rotation detected using MediaQuery.of(context).orientation or OrientationBuilder https://flutter.io/docs/cookbook/design/orientation
That was my first thought, but..
If I scan the same word (it doesn't mean anything, it is just a sequence of letters for testing)
TOLEM
with rotation270 I get
LOTEW
which is what you could expect if you turn TOLEM upside-down and scan it from right to left.
With rotation0 and rotation180 I get no result at all.
So it is not a rotation problem.
http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail Virus-free. www.avg.com http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Den mån 4 feb. 2019 kl 12:49 skrev lewix notifications@github.com:
I just tried with my Galasy S8 to scan https://www.google.com and text seems reconignized [image: image] https://user-images.githubusercontent.com/7371215/52206482-afad4480-287a-11e9-800a-31963a533ee5.png
I have no S4 to try, my suspect is the parameter rotation: ImageRotation.rotation90
Have you tried setting other values? I have a Nexus 6 and with it i have to set rotation0 to make it working.
I think i have to get real rotation detected using MediaQuery.of(context).orientation or OrientationBuilder https://flutter.io/docs/cookbook/design/orientation
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lewixlabs/mlkit_ocr_realtime/issues/1#issuecomment-460220799, or mute the thread https://github.com/notifications/unsubscribe-auth/ARvUpThyuH-HJg_s5QNRQbBYcbqHxVGwks5vKB5igaJpZM4ag-o0 .
Hi @BoHellgren , i suspect it's a flutter firebase_ml_vision bug. If you agree, you can post your issue on github flutter page. I posted a similar issue time ago me too, here https://github.com/flutter/flutter/issues/19000
Let me know
The scanning works if I do a flipHorizontally with the following code, and then use the flipped image in FirebaseVisionImage.fromBytes. Why this is only needed for some phones I cannot explain.
int height = theImage.height; int width = theImage.width; int len = theImage.planes[0].bytes.length;
Uint8List flippedImage = Uint8List(len);
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
flippedImage[i * width + j] = theImage.planes[0].bytes[i * width + (width - j) - 1];
}
}
Reversing the order of bytes for some devices only? This suggests me 2 reasons:
I noticed one of the contributors of flutter_ml_vision plugin has published a demo of image recognition. Here you can find the code. I would like to integrate his code in my project, maybe can you try you too?
@BoHellgren, flutter plugin has been updated in these days. https://pub.dartlang.org/packages/firebase_ml_vision After updaing this plugin, I noticed my code work in my old Nexus 6 too (before it didn't work). Can you make a test?
@lewixlabs firebase_ml_vision: ^0.5.0+1 does not seem to make any difference for me.
https://github.com/flutter/plugins/pull/1225#issuecomment-465371008 Maybe this will help
When I try your app on a Samsung Galaxy S4, the scan result is the real text mirrored from right to left.
If I scan the letters TOLEM the resulting visionText is M3JOT
I tried (a bit desperate) reversing the order of the bytes in the fromBytes input, but then the scan result was LOTEW
The camera was in the portrait orientation.
If I knew how to make a mirror image of a Uint8List image, I could live with this. But I don't...