Open victory-glitch opened 2 years ago
Thank you for filing an issue! Please be patient. :-)
I believe that BarcodeReader is going to be probably mostly only useful for 1D barcodes, although if it were extended to be able to detect the area that 2D barcodes occupy, that would be a great improvement, as I'm sure providing just the imagedata that actually needs to be decoded would make it easier for any decoder to figure out.
So, yeah, I think probably best to wire it like the prototype QR reader, which simply takes the entire image data, and passes it to a separate library that figures it out from the entire image.
That said, if you are able to get any useful output from BarcodeReader as to where the rectangle that contains the barcode is, that would probably improve your chances of getting a good read.
Thanks for the clarification! Can you explain more about "extending BarcodeReader to detect the area that 2D barcodes occupy":
barcode_reader.ts
, right?BarcodeReader
class are doing? (there's no documentation, so it's not entirely clear what role _nextUnset
or _matchPattern
is supposed to do)public decodePattern(pattern: Array<number>)
is the only function that we would override if we are going to create our own plugin on top of BarcodeReader. Assuming that the 2D processing is implemented, would that function signature change to something like public decodePattern(pattern: Array<Array<number>>)
? Or should we add an entirely new function in BarcodeReader that users can override (eg public decodePattern2D(pattern: Array<Array<number>>)
?@ericblade Hi, just following up on the above questions. Even if you don't have a complete answer for every question, even a partial answer for each question (eg knowledge of some functions) would be hugely helpful.
@hareharey sorry, I didn't notice the first reply! Thanks for getting my attention again
One of the more important features in Quagga, I think, is the Locator in src/locator/barcode_locator , which figures out where in an image a barcode-like area is found, which I'm pretty sure if found, then goes through some processing to send only that area through to the decoder.
I was thinking if the locator could locate 2D barcodes as well as 1D, then even if we don't have any built in BarcodeReader classes that can handle it, we could at least make the job for whatever does read the code easier. Maybe my psuedo-solution of just passing the entire image to an external 2D reader would be fine, too.
I don't really know anything about 1D vs 2D codes, or if there is any standard delineation around them.
I also don't know if any of the pieces of BarcodeReader would be useful in decoding them. I honestly don't think, with such a good library as zxing-js available, that we would gain a lot by implementing a whole Reader/Decoder system, but there might be value to a Locator. There definitely is value in the locator in 1D barcodes, I tried a lot of barcode systems before quagga, and quagga was the only one that consistently was able to decode sideways and diagonal 1D codes
I am also interested in PDF417 barcodes.
It is important to distinguish between the more common types of barcodes:
The challenge with PDF417 may include increasing the resolution of the scanning (eliminating half-sample and decreasing the patch size) so that the individual bar codes that are stacked are recognized, changing the recognition of the quiet zone, and detecting the prefixing and suffixing signature.
Hi @ericblade , I saw your comment in https://github.com/serratus/quaggaJS/issues/70#issuecomment-396465816 where you mentioned that it could be possible to wire up js-zxing-pdf417 to quagga with the help of an external decoder. I am interested in using quagga to read pdf417 barcodes off of scanned documents that users will upload.
The quagga2 readme mentions that a qr-reader has been integrated in a separate repo, but the qr-reader doesn't use the BarcodeReader prototype for integration. I am wondering if making a PDF417 reader should follow the same path that the qr-reader is doing, considering that both qr and pdf417 are 2D barcodes?