Skip to content
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

Can't scan long GS1-128 -- title not entirely accurate #390

Open
Extarys opened this issue Nov 15, 2021 · 13 comments
Open

Can't scan long GS1-128 -- title not entirely accurate #390

Extarys opened this issue Nov 15, 2021 · 13 comments

Comments

@Extarys
Copy link

Extarys commented Nov 15, 2021

I'm having issues with scanning GS1-128 printed on labels and generated on the computer. I searched for an example online:

image

I cannot seem to make quagga to read this. Furthermore, I tried with and without locate.

I found a similar issue #170 and those 2 codes worked for me/with my settings. Are those longer GS1 codes compatible with quagga? I found an android app that read those in less than a second - but I sadly need a browser way of doing it :P

Thanks for your feedbacks

@github-actions
Copy link

Thank you for filing an issue! Please be patient. :-)

@ericblade
Copy link
Owner

That is a very long barcode. My first impression is that to find success with that, you'll probably need the highest resolution and largest patch size settings to find it with locate .. and without locate.. there's a possibility it may just be too long. Right off, I honestly don't know if there's a reason that Quagga should or should not be able to read it, but it's definitely the longest barcode I've seen. Is this something that you would be scanning in a real world situation? While I'd love to support the theoretical limits of the format, I have to say that it's probably better to tune and adjust for real world situations.

If this is what you're going to be scanning.. well, then yes, let's see what we can figure out.

@ericblade
Copy link
Owner

ericblade commented Nov 16, 2021

Quick test shows that this image works as expected, with resolution set to 1600px and patch-size large

image

Result is 01095011015300031714070410AB-123

So, yes, it can be decoded by Quagga, but the image itself is not exactly suitable. I scaled the image down to 1400 width, then centered it on a 1600x450 white background, and it reads perfectly.

It may not be exactly the correct way of doing it, but Quagga does require an amount of something that it doesn't think is barcode, preferably whitespace, around the barcode to help it along.

Some browser / not-native-node functionality to do a similar operation (rescale and surround with whitespace) could be really helpful.

@ericblade
Copy link
Owner

... note to self: adding that large image to the test suite might be a good idea to test if i've actually solved the problems in the library of working with very large resolutions. That image is 6310x1722.

@Extarys
Copy link
Author

Extarys commented Nov 16, 2021

Thanks for taking a look, I spend a stupid amount of time trying to scan it but for some reason I always had bad reading.

If this is what you're going to be scanning.. well, then yes, let's see what we can figure out.

Yes, this is real world barcodes. And thanks for saying that, 😄 Those are on food box (pork, beef, sausage, canned food, pre packaged or raw) and could tell me when the box is going to expire or when it was packaged so I can keep track of what is gonna go bad soon to avoid throwing meat away - as I hate killing an animal for nothing. This is mostly "for fun" and see if I can make the life of my supermarket easier.

Quick test shows that this image works as expected, with resolution set to 1600px and patch-size large

I took some real labels today (not pictures of them) and I'm going to continue to test qyagga2 with those instead - I believe the pixels/lines from the screen is confusing the scanner. It won't be "time saving" if I need 3 minutes scanning a single barcode and I'll look like a fool 😂 I'll keep playing with the settings.

For fun if you want - not sure if they will look weird - ask your supermarket to see a box of any packaged product.

(I can't seem to be able to upload old barcodes I had laying around, RIP)

@ericblade
Copy link
Owner

I've seen those very large barcodes, but I didn't realize they were quite so long as to their content, just thought they were huge for picking up from long distance :-D I also didn't know what encoding they were.

If you'd like to contribute images we can add to the test suite, that'd be great.

It'd be really a good thing if we could just automatically make the incoming image if larger than desired resolution automatically scaled down when fed to the locator and decoder. . . . . and maybe pad it with a few pixels of whitespace so that it will at least pass when you feed it a pure barcode image like above.

@Extarys
Copy link
Author

Extarys commented Nov 17, 2021

I'll talk to the employee at the grocery store to make sure I can share recent codes. I took some home for testing purposes (cut them from the boxes) and I'll find a way to upload them here if I get the OK.

At first, I was also very confused by those codes, but it makes sense now that I know them. Just wish they'd use QR code or something like that instead. It would make scanning easier as a lot of data can fit in a QR code, and it has error correction - GS1 doesn't :\

@Extarys
Copy link
Author

Extarys commented Nov 17, 2021

3 fresh GS1-128 for you, my friend! 🎊 GS1Test.tar.gz

Since everything on the internet stays there forever, I removed some info that might be more sensitive, LOL but feel free to do what you please with those now.

Edit: If you are curious, here are the Application Identifiers list (the number in parentheses)

@ericblade
Copy link
Owner

The 1st and 3rd read with Q set to resolution 1600 and patch-size large, half-sample on . . . the middle one looks a bit decayed, and at an angle... the locator finds an area, but it doesn't get a decode. . . .

i get a decode on the second one with resolution 1280, patch-size small, half-sample on

@ericblade
Copy link
Owner

ericblade commented Nov 17, 2021

.. this makes me wonder if some sort of option to aggressively search with multiple patch-sizes and half-sample settings would be a good idea. if my more modular ideas for a future version of quagga were to start coming together, that'd be pretty easy.

@Extarys
Copy link
Author

Extarys commented Nov 17, 2021

I should have said that I didn't test them yet 😂 but thanks for the feedback - I'll try those settings when I test them. (I need to convert my scanner thing in a Vue component that can open to fill an input)

If by "the second one" you are referring to the one with the greenish bluish stripe on the right, in real life it looks ok, but I couldn't get a picture where it was blacker. (My phone camera sucks a little ever since I dropped the phone 🤫 ) It should be noted that most people won't be in a perfect 0° angle with perfect light while having a white label and black bars, sadly. I saw some yellow paper with dark grey stripes yesterday - yikes.

Does Quagga try to improve contrast in the background, or it only tries to process the image I see on the canvas? Some voodoo filter could be applied, I wonder how I could test that.

if my more modular ideas for a future version of quagga were to start coming together

were to start coming together I'm not entirely sure I understand what you mean, you are not sure in which direction to take the project or you have too many ideas and can't implement them all, or.. 😄

BTW I appreciate the time you are taking understanding this with me, you are awesome. 🏅

@ericblade
Copy link
Owner

ericblade commented Nov 17, 2021

I believe it processes the image in either grayscale or black and white, although there is an option to only use the red channel of the image, which I've never really found much of a use for, as the usual options seem to work just fine for UPC/EAN, which is all I use it for.

In the Discussions tab, I started talking some time ago, about pulling the individual pieces of this apart, so that the camera capture isn't tied to the locator and isn't tied to the decoder, which would allow for something like having the image come in from a source (camera, file, clipboard, remote image src, whatever), passing it to the locator once, then passing that data to multiple decoders, perhaps making use of multi-threading for that step. It would be much easier to setup a number of differently configured decoders that way. The current setup is not well suited for that.

... and then i got employed on a project that has absolutely nothing to do with quagga, and have been pretty quiet on this front since, though i still try to take time to maintain it.

@ericblade ericblade changed the title Can't scan long GS1-128 Can't scan long GS1-128 -- title not entirely accurate Mar 4, 2022
@ericblade
Copy link
Owner

TODO: There are a lot of TODOs exposed in this issue, figure them out and make separate issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants