-
Notifications
You must be signed in to change notification settings - Fork 58
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
QR code in large image is not scanned #74
Comments
I think one way to potentially address this issue would be to resize the image before attempting to scan it with readBarcodeImagePathString(). This could involve resizing the image to a specific width and height. By adjusting the size of the image in this way, it might be possible to improve the performance of readBarcodeImagePathString() when scanning QR codes from images taken at an angle. |
I hadn't noticed that the image was huge (3,096 x 3,553), and you were right! The QR code above was read successfully after it was shrunk to 1/10 its original size. However, it was not read if the size was 1/5 (620 x 711). It is not that big. If it is difficult to support larger images on the package side, I'll improve my app myself to resize an image depending on the size. |
I'll definitely keep your feedback in mind and will research this issue further. If there are any updates or solutions, I'll be sure to let you know. In the meantime, if you are able to find a workaround by resizing the images in your app, that would be greatly appreciated. |
Proposal for improvement Currently, I can check if scanning has failed with |
I wanted to let you know that i've now implemented image resizing in the plugin side. It's now possible to set the maxSize parameter in the DecodeParams object, which will resize the image to fit within the specified dimensions while maintaining the aspect ratio. The default value for maxSize is 512, but you can set it to any value you like. This should help to improve performance and reduce memory usage in situations where large images are being processed. |
Great, thanks! But I can't build my app with the new version 1.0.0-beta.3 of the package. Error log
I have |
Could you check version 1.0.0-beta.6? |
The build issue is gone. Thank you!
It's getting better, but scanning of the original size still fails sadly... Could you check it with the QR code image I pasted earlier please? |
I was able to resolve this problem by increasing the maximum image size from 512 to 768. |
Thanks again! The original image is now read correctly. In fact, the image I pasted earlier is not the real original. It was too big with large black space, so I uploaded a trimmed one. I shouldn't have done so, my apologies. Below is the actual unedited image: The QR code in this image is not read successfully, so the change in the default flutter_zxing/lib/src/utils/image_converter.dart Lines 74 to 78 in b8f002b
This resizing doesn't look wrong. I'm wondering why... |
The image size is 3,096 (width) x 5,504 (height), whereas an album app on my phone shows its width is 5,504. It may be related, but I doubt |
I think the coarseness (so-called moiré pattern?) is only because I took a photo of a QR code shown on a PC monitor, and don't think there are many cases where the image quality becomes so bad by a resize. But it can still happen, like when someone sends an image of a QR code taken from a TV screen and the receiver wants to read it. @khoren93 |
Just came across this by chance and it seems you are not aware of the |
readBarcodeImagePathString()
fails to scan a QR code in an image taken from slightly off to the side, whileReaderWidget
can successfully scan the same QR from the same position. Do you have any idea why there is such a difference?To reproduce it, please try scanning the QR code below with
ReaderWidget
andreadBarcodeImagePathString()
(or it may be reproduced with other similar methods likereadBarcodeImagePath()
. I'm not sure about it as I haven't used them.)The text was updated successfully, but these errors were encountered: