Comments (11)
It is already possible to configure the initial size (https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/common/detector/WhiteRectangleDetector.java#L53), and that's the right answer if you are using exceptionally large images, or just know more about how big the barcode is.
from zxing.
That is true if I am instantiating my own Detector. But DataMatrixReader instantiates its own Detector, and I don't see any way that I could tell it to use a different one. (Except by making my own Reader implementation, which would involve duplicating a lot of code.)
from zxing.
OK what about a patch to set it to a max(INIT_SIZE, some % of image size) ?
On Mon, Feb 10, 2014 at 9:23 PM, tgibson11 [email protected] wrote:
That is true if I am instantiating my own Detector. But DataMatrixReader
instantiates its own Detector, and I don't see any way that I could tell it
to use a different one.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-34684016
.
from zxing.
Shall I make this change and submit a pull request?
from zxing.
Sure open a PR. Just try running the tests first. The only issue to watch
out for is whether the change tends to make images fail that passed before.
On Mon, Feb 10, 2014 at 9:34 PM, tgibson11 [email protected] wrote:
Shall I make this change and submit a pull request?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-34685222
.
from zxing.
This turned out to be more complicated than I first thought.
My original idea is requires the assumption that a rectangle X% of the image size is still contained inside the barcode. At least I think that is true, but you can correct me if I'm wrong. This might not be true if there is a small barcode in the center of a large image. There is also the arbitrariness of choosing a percentage.
I thought of a different approach that seems to work.
The current WhiteRectangleDetector expands the rectangle until all sides are white, which as you know might be a white area completely inside the barcode.
I propose to first expand the rectangle until each side contains at least one black point, then proceed as before.
An important assumption is that all sides of the initial rectangle are inside the barcode. I think that assumption was already being made, but it was difficult for me to be sure.
You can see my proposed changes here: https://github.com/tgibson11/zxing.
Let me know what you think.
from zxing.
Yes there is no way to know a priori where or how big the barcode is. I
think the idea is to make a guess that is likely to strike a happy medium
between working, and being fast, on images of a type that are likely to be
used.
Your assumption sounds correct and I don't see a problem with it. Of
course, you may hit the side of the image instead of something black.
Your changes don't look too hairy. If they work for your use case, and
don't cause additional images to fail the unit tests, let's commit.
On Wed, Feb 12, 2014 at 5:36 PM, tgibson11 [email protected] wrote:
This turned out to be more complicated than I first thought.
My original idea is requires the assumption that a rectangle X% of the
image size is still contained inside the barcode. At least I think that is
true, but you can correct me if I'm wrong. This might not be true if there
is a small barcode in the center of a large image. There is also the
arbitrariness of choosing a percentage.I thought of a different approach that seems to work.
The current WhiteRectangleDetector expands the rectangle until all sides
are white, which as you know might be a white area completely inside the
barcode.I propose to first expand the rectangle until each side contains at least
one black point, then proceed as before.An important assumption is that all sides of the initial rectangle are
inside the barcode. I think that assumption was already being made, but it
was difficult for me to be sure.You can see my proposed changes here: https://github.com/tgibson11/zxing.
Let me know what you think.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/49#issuecomment-34893978
.
from zxing.
Hi,
I have a similar problem with the following image
The initial rectangle is not white only, so the rectangle expand correctly at the beginning. Unfortunately, it stops at the red zone on the image below because there is a white rectangle inside the datamatrix.
Is there a way to avoid this false area detection ?
Regards
Julien
from zxing.
The idea proposed here would probably fix this. The current heuristic is "OK" but does fall down in corner cases like this.
from zxing.
Maybe I misunderstood the idea proposed by tgibson, but I don't think it will change the white rectangle problem inside the datamatrix. Once a black point is found on each border, if this "starting rectangle " is inside a bigger white rectangle, it will expand up to the white rectangle but not further.
from zxing.
Hm, yeah you may have a point there. The current process is really a simplistic heuristic that happens to work quite well for images from a camera, which are not nearly so clean or axis aligned. There's a "PURE_BARCODE" mode that's intended for this particular type of image, and that ought to work -- try http://zxing.org/w/decode?u=https%3A%2F%2Fcloud.githubusercontent.com%2Fassets%2F145699%2F16151321%2Fac423ca8-349c-11e6-8035-90bfd2a3c242.png
from zxing.
Related Issues (20)
- Allow gen-delims and sub-delims HOT 8
- > That decodes as you expect with this library. The result is `https://qr.sbw.media/[0Li9` I think you're talking about something else, like an app and how it renders URLs. HOT 1
- pdf417 encode error java.lang.ArrayIndexOutOfBoundsException when using CHARACTER_SET ISO-8859-15 HOT 1
- Detector can't detector qrcode
- PDF417 reader early returns with multiple codes on a page HOT 2
- The QR code has black squares. HOT 1
- Don't decode QR_CODE. HOT 2
- scan record miss
- Why zxing can not decode this qrcode image? HOT 1
- Letters in Croatian ćčšžšđ HOT 1
- H
- Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=11664; index=11664
- MultiFormatReader unable to decode simple data matrix code (C#) HOT 1
- Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=11664; index=11664
- Page not responding : https://zxing.github.io/zxing/core/index.html HOT 2
- Open scue code
- Zxing is not working with PDF417 for south african driving licenses HOT 2
- issue about scanning
- com.google.zxing.client.android.encode.QRCodeEncoder.encodeFromStreamExtra HOT 3
- How to get zxingorg 3.5.3-SNAPSHOT entity package HOT 6
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 zxing.