serratus/quaggaJS

Results seem to always be random after scanning same barcode

Closed this issue · 8 comments

I will scan the same barcode and each time it is a different result code. Is that how it is supposed to work?

The barcodes I am attempting to scan are UPC 128, however, the barcode only gets decoded by the EAN 8 reader so that may be what is causing the random results.

Here is my Quagga setup:
carbon

If you're reading it with a reader that isn't the one it goes to, that's definitely going to contribute to poor results. I would recommend adjusting the resolution and locator parameters. Something you might do is take a picture of the barcode in question, and feed it into the demonstration linked in the README, until you find settings that seem to work properly for your type of barcode.

Additionally, some, maybe all readers, will fill in result.codeResult.decodedCodes with an object containing an "error" entry which seems to be something along the lines of "how much the reader trusts this result", with 0 being 100% confidence, and 1 being "this is an erroneous read", or something along those lines.

In my personal application implementation, I have added a barcode validation check ( https://github.com/ericblade/barcode-validator ) that I run on anything that reaches onDetected, before I assume that the detection is good. I accept any barcode that has a very low error threshold, or passes the checksum validation.

If you're reading it with a reader that isn't the one it goes to, that's definitely going to contribute to poor results. I would recommend adjusting the resolution and locator parameters. Something you might do is take a picture of the barcode in question, and feed it into the demonstration linked in the README, until you find settings that seem to work properly for your type of barcode.

Additionally, some, maybe all readers, will fill in result.codeResult.decodedCodes with an object containing an "error" entry which seems to be something along the lines of "how much the reader trusts this result", with 0 being 100% confidence, and 1 being "this is an erroneous read", or something along those lines.

In my personal application implementation, I have added a barcode validation check ( https://github.com/ericblade/barcode-validator ) that I run on anything that reaches onDetected, before I assume that the detection is good. I accept any barcode that has a very low error threshold, or passes the checksum validation.

Thanks for the reply!

I went to the file input example (https://serratus.github.io/quaggaJS/v1.0.0-beta.1/examples/file_input/) but I cant seem to find where the result is logged. Also, is the patchSize and halfSample the only ways to change the resolution?

So I would imagine I am getting a different code each time because it isnt decoding it with the code_128_reader, but if I just set that as the reader it never finds the barcode.

My experience has been that adjusting the resolution (in your constraints), and the locator patchSize can have significant effects on the locator being able to find things. As well, increasing the amount of white space around the barcode can be a big help too. I use 640x480 on my app and it seems to work well. Other resolutions don't seem to be so good, with the default medium patchSize.

My experience has been that adjusting the resolution (in your constraints), and the locator patchSize can have significant effects on the locator being able to find things. As well, increasing the amount of white space around the barcode can be a big help too. I use 640x480 on my app and it seems to work well. Other resolutions don't seem to be so good, with the default medium patchSize.

Ill give those constraints a try and see if I can't get it to read anything. I don't think it'd be a problem with the whitespace because the barcode/s i'm using have a lot of it.

Thanks a lot for the help. It's appreciated!

Hmmm code_128 reader still isnt working. Could it be the quality of my barcode? Here is an image of one that I have been using.
unnamed

So I just tried the file input example again and I was finally able to get it return the correct result

Here were the settings:

resolution: 640px
patch size: x-large
half sample: true
workers: 0

However, still nothing when using the LiveStream

A better quality webcam is what solved this issue for me!

@ajess33 what camera did you get? on PC, nothing reads for me, so I'm looking to get a different camera, because it's pretty much hell having to push my app to a live server and test it with a phone for every change i make that involves camera. :-D