I want to scan small QR-code(1cm x 1cm) I am trying to scan by Using this same code. It's detecting the large size qr-code perfectly but not detecting the small size qr-code. Is there have any way by which I can solve this issue?
The smartphone camera has to read each and every data module to be able to decode a QR Code And you know that quality of the camera varies widely across different smartphones. Some of them are very good and can scan even very small QR Codes. But others simply can’t so try with some other device to check you have issue in code or with device
Related
We have integrated me.dm7.barcodescanner:zxing into our app and use the ZXingScannerView to scan QR-codes on some physical devices. Our issue is that the performance is extremely different on different phones. Some of them register the QR-code immediately while some might get it after a while and some never registers them.
I'm guessing the different specifics of the actual camera is the underlying cause.
Many phones which won't scan the QR-code will however scan the code fine if you use the native camera App. My guess is that we don't get auto-focus and such when we import the camera into the ZXingScannerView which makes the QR-code more blurry and hard to detect.
Has anyone else had this issue and what did you do to resolve it?
I noticed a strange issue with Google's ML Kit Barcode scanner. I try to scan a QR code which has a green background, and it does not recognize the QR code at all. However if I crop the same QR code and remove the green background then it scans perfectly well. I don't put any code examples of my implementation here as the official example has the exact same issue.
Here is my image. I don't even know how to research this problem as I totally don't understand what green background can do.
Well, after spending some time on trying to solve this problem with various image processing techniques etc. I found out that the solution is rather simple and was always there right in front of me.
So while building the image analyzer, there is a configuration function to set Target Resolution setTargetResolution(#NonNull Size resolution), which if not set explicitly is defaulting to 640x480, which is probably ok for general use cases related to image analyzer (otherwise I wonder why Google should pick this resolution as a default). And it's also OK for normal QR codes, but for problematic QRs like this it seems to mess thing up, so ML kit needs a higher resolution images for processing.
So just changing this default 640x480 to 1920x1440 immediately solved the issue, and the QR code without borders started to be scanned immediately and with very good performance. I tried other, smaller resolutions as well, tried on different high and low end devices with good and bad cameras, and came to this resolution, which seems to perform the best.
So currently me Image Analyzer builder looks like this, and it works just fine
private val analyzerUseCase = ImageAnalysis.Builder()
.setTargetResolution(Size(1440, 1920))
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()
I've been experimenting with barcodedetector and associated Vision APIs for a week or so and - unfortunately - the conclusion is that they are unreliable. I've tested them with ~10 devices: Samsung and Nexus tablets/phones with Android 4.4 to 6.01.
The common problem was that I could not decode certain QR codes - other apps based on zxing library as well as iPhone had no problems decoding them. The problematic QR codes had one of the following 'flaws': somewhat distorted timing (due to scaling), no quiet zone, or their bitmap data had a bottom/left origin (i.e. image was mirrored).
Also troubling is that the associated APIs (e.g. CameraSource) appear to be buggy. Fortunately, the barcode reader sample comes with open source version so it can be fixed if necessary. The most obvious bug is the way camera resolutions are matched to view sizes without taking into account current orientation. You can clearly see the side effects in the sample - camera preview never fills the containing activity area, especially in the landscape orientation.
Has anyone run into similar problems? Are there any workarounds for the show stoppers - i.e. decoding qr codes?
Thanks.
I write an application for Motorola Xoom tablet with Android 3.1 for my master thesis that can scan multiple QR Codes in real time with it's camera and that displays additional information in the display over recognised QR Codes.
The recognition is done with the ZXing android app (http://code.google.com/p/zxing/), I basically just changed the code of the ZXing app so that it can recognise multiple QR Codes at the same time and can do this scan continually, without freezing after a successful scan like the original app does. So my app is basically the ZXing app with continous scanning of multiple QR Codes.
But I'm facing a problem:
The recognition rate of QR Codes with the built in camera is not
very good. The ZXing app uses the pictures that it gets from the
camera preview. But these pictures do not have a very good quality.
Is there any possibility to make the camera preview making better
quality pictures?
P.S. I also tried to make real snapshots with camera.takePicture()
to get a better quality, but it takes too long to take the picture
so the real time experience for the user is lost.
Any help is highly appreciated!
Thanks.
Well, the question would be... why is the image quality that bad? Do the image have low resolution? Is the preview out of focus? I've worked with the ZXing Android app before and I know that it has a mechanism to keep the camera auto focusing the live scene.
If the auto focus mechanism is undergoing, then you are possibly decoding some images that might be out of focus. Rationaly, it would make sense to decode only when the camera is in focus, but that would delay the decoding process, since it would have to wait for the focusing to do the image processing phase. However, I wouldn't be too much worried about this for several reasons: 1) the auto focus is very quick, so there will be very few blurry images (if there are any at all), 2) the camera keeps focus for a sufficient amount of time that would allow for a couple decodings, 3) QRCodes typically do not require perfect images to be detected and decoded - they were designed that way.
If this is a problem for you, then disable the continous auto-focus and set the parameter to anything that suits you.
If the problem comes from low resolution frames, well increase it..., but QRCodes were also designed to be identified even in small resolutions. Also, keep in mind the increasing the resolution will also increase decoding time...
In my application I am using Zxing library for decoding barcodes. "Motorola Xoom" and "Samsung " are the target devices. The company for which I am developing this application uses Code 39 barcodes for their products.
Zxing decodes short barcodes fine, but when I try to decode lengthy "Code 39" barcodes it keeps on trying but produces no result. For image clearance I increased the scanning rectangle area which proved successful for Samsung but for Motorola it is not. Is there any way by which I can make it work for Motorola? Any feedback will be highly appreciated.
Often the problem is a difference in minimum focal distance. That is, if the Motorola device can't focus as closely, then widening the rectangle may make the user hold the barcode so close as to be too close to focus. I would look at this first.
Otherwise you're looking at improving the image processing for this case. The challenge is that the app does simple thresholding, which works well in common cases. It falls down when you have dense 1D barcodes whose bar width nears 1 pixel. Because each pixel is either black or white you lose proportionally a lot of detail about exactly where the bars are.
If that's really the issue you could look at rewriting your app to use a full-resolution capture from the camera, instead of preview. In normal cases, more resolution doesn't help; in these cases it might. You would not be able to have a continuous-scan app this way.
I am one of the Barcode Scanner devs, and maintain a (for-pay) enhanced version called Barcode Scanner+. It has a different image processing algorithm that finds boundaries at sub-pixel resolution, which works better for codes like these. You may want to see how it does -- and if that works well, at least that tells you the kind of approach that works better. I can't send you that code but can describe what it does, if you want to investigate that sort of image processing.