Comments (11)
Hello.
As I think, what is really counterintuitive - if code outside of frame rect will be recognized.
Btw, I see another soulution, make real recognition area a bit larger than viewfinder frame.
I'll implement something like this in next version.
from code-scanner.
Seems like the problem isn't in frame or scanning area. It is in ZXing library itself. Because when you scan from small distance from screen, phone's camera sees different subpixels (RGB) and the library can't decode such images well.
Example in attached screenshot.
from code-scanner.
Hello.
As I think, what is really counterintuitive - if code outside of frame rect will be recognized.
Btw, I see another soulution, make real recognition area a bit larger than viewfinder frame.
I'll implement something like this in next version.
The solution you mentioned is what I was proposing in the original post albeit it could have a different approach to do it. Apologies if I wasn't clear enough on that. I am willing to discuss and do the implementation if you agree with the solution we arrive at
from code-scanner.
I've already implemented this, and it got no result even with 20% larger area (on Galaxy S7). See my last comment. I'll get Pxel 2 XL in a couple of weeks and test library.
Anyways, completely ignore the frame is bad idea.
Or, the promlem can be in preview image size. I never tested library at 2:1 screens before.
from code-scanner.
Just some more info
I have not been able to reproduce this issue on Samsung Galaxy S8 which I believe also has the same screen aspect ratio. The issue seems to just be for Pixel 2 and Pixel 2 XL Devices. (AFAIK based on my testing)
Edit:
I tested on S7 Edge Running Nougat and didn't encounter this issue. Let me get a screenshot of how far the Pixel 2 has to be before recognizing.
from code-scanner.
So, this problem should be investigated deeper. I'll kep this issue open.
What parameters of scanner view are you using? (full screen or not, viewfinder aspect ration, etc)
Portrait or landscape orientation?
from code-scanner.
Just off the top of my head, do you think it would improve the reliability of the decoder if we did a high contrast filter on the frame before decoding it? Edit: Now that I think about it, they could be doing that in the Zxing library internally as well
Edit: My Config (Orientation Portrait), Full Screen, Aspect Ratio 1:1
codeScanner = CodeScanner(it, codeScannerView)
codeScanner?.isFlashEnabled = false
codeScanner?.isAutoFocusEnabled = true
codeScanner?.setFormats(CodeScanner.ALL_FORMATS)
codeScanner?.setDecodeCallback(this@QRFragment)
codeScanner?.setErrorCallback(this@QRFragment)
codeScanner?.setScanMode(ScanMode.CONTINUOUS)
from code-scanner.
I was able to resolve this issue by reapplying your threshold changes and also utilizing a smaller frameSize (was added in my previous PR). Now it scans perfectly for me. I've made it so that the threshold is configurable and is 0 by default (existing behavior) and opened a PR so you can take a look at the code
from code-scanner.
So I investigated this issue some more. I thought I had resolved the issue with the changes mentioned above but then on a different monitor, it did not work (most likely due to the subpixels issue you mentioned briefly above)
The next thing I tried was changing the LuminanceSource from PlanarYUV to RGB and that actually ended up resolving that issue. I will test on various devices and monitors/screens to ensure it works consistently and then make a PR.
One thing to note. I think that not all devices actually support RGB mode for the Camera so I am currently converting the cropped frame ONLY to RGB and creating a RGBLuminanceSource
from code-scanner.
Hm, I don't think that such conversions is the best way to resolve this issue.
And it's really wired how changing color format helps recognition.
from code-scanner.
Seems like the promlem is in subpixel and/or noise. For now, this can't be fixed in my library. However, I'll keep by library up to date with ZXing.
from code-scanner.
Related Issues (20)
- Does the codescanner have a function to take in uri?
- Orientation change issue
- Crash on google play pre-launch & also on production on clients devices
- How to enable and disable flash light with flash icon? HOT 7
- Android 33 Library does not work
- Library is not working HOT 2
- Flash blink while set ScanMode.SINGLE
- Is there any way to speed up?
- How can we add text below frame ? HOT 1
- NFC Functionality Stops Working When QR Code Scanning Preview is Started on Android 13 HOT 1
- Blank screen on xiaomi redmi A2 HOT 5
- Flash not working in Android 11 HOT 3
- QR scan starts lagging HOT 1
- Scan returns wrong data HOT 1
- Lagging when navigate to fragment with CodeScanner
- Camera is dark due to FPSrate
- flash light is not working in some devices HOT 1
- Library not working
- Library not working with most QR codes
- Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=11664; index=11664
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-scanner.