quagga2 icon indicating copy to clipboard operation
quagga2 copied to clipboard

How to locate a small barcode in a big image?

Open Raketten1963 opened this issue 6 months ago • 4 comments

I am having trouble in locating the image (a file) where the barcode only takes up a small portion of the full image. Is this not supposed to work? Fully understand if that is so, but I thought the locator did that job.

Thanks in advance

Image

Raketten1963 avatar Aug 10 '25 10:08 Raketten1963

Thank you for filing an issue! Please be patient. :-) Dont forget to add yourself to the contributors array in package.json! Have a great day!

github-actions[bot] avatar Aug 10 '25 10:08 github-actions[bot]

I don't know if this is late, but yes Quagga has trouble in detecting barcodes when it isn't the the majority of the image, It is best used for the real time barcode scan where the user can zoom in on the barcode with a phone or such.

I tried improve the accuracy of reading those smallers barcodes by using OpenCV and OCR to look for things that could potentially be barcodes crop them and then giving them one by one along side the big image to Quagga and it worked better but still missed a lot

Ended up using a comercial C# library for decoding those smaller barcodes and Quagga for real time in browser barcode recognition

danisss9 avatar Nov 28 '25 11:11 danisss9

Certainly something to add to the test suite to play with. Yes, it can and should work, but it probably would require some fiddling with the settings to find the right combination of image and patch size to make the locator find it. It's not quite as automatic as one might like.
I will say @danisss9 is definitely correct that the majority of usage is probably from phones where you are usually getting the barcode mostly into the frame, at least, that's where I'm using it, with live image.

If you're running against a pile of static images, you might try running with imageSource.size ranging from 0.5x to 2.0x the longest side of the images, with and without halfSample on, and each of the settings for patchSize. I'm wanting to add some options to maybe try automatically doing things like that, or at least an example of doing it from the outside, if doing it internally isn't feasible.

ericblade avatar Nov 28 '25 17:11 ericblade

Well, it doesn't work with any setting in the sample application ( https://ericblade.github.io/quagga2/examples/file_input.html ) as far as I can tell. It may take some analysis to figure out if that's a limitation of the sample application or of quagga itself ...

ericblade avatar Dec 01 '25 17:12 ericblade