Live data from Hacker News

Show HN: QuaggaJS, a barcode scanner written in JavaScript

serratus.github.io

1–10 of 28 posts

Re: Show HN: QuaggaJS, a barcode scanner written in JavaScript

#2
Invariant to scale and rotation in JS on mobile? That's fantastic! I just tested the Red Laser native app on my phone and it can handle scale/rotation too. But I never thought about rotation for the Red Laser app and always tried to align it properly between the [ ] brackets.

I think apps that support scale/rotation should not show [ ] brackets but instead a central red +. Haven't dug deeply into how barcode_locator.js in your repo works but with the expectation that the barcode will be in the middle, you might be able to slightly optimize your code to start the location detection from the middle and expand outwards.

It appears you are breaking the image into smaller 'patches' and looping through those to look for chunks of a barcode. Even if the algorithm is resolution independent, you might be able to exit the loop 50-60% earlier if you detect from the middle and go out in a spiral. In other words, the order in which you iterate the loop can make a difference.

Re: Show HN: QuaggaJS, a barcode scanner written in JavaScript

#4
post #2

Invariant to scale and rotation in JS on mobile? That's fantastic! I just tested the Red Laser native app on my phone and it can handle scale/rotation too. But I never thought about rotation for the Red Laser app and always tried to align it properly between the [ ] brackets. I think apps that support scale/rotation should not show [ ] brackets but instead a central red +. Haven't dug deeply into how barcode_locator.…

Barcode can be anywhere. It's an impressive work. http://www.oberhofer.co/how-barcode-localization-works-in-qu...

Re: Show HN: QuaggaJS, a barcode scanner written in JavaScript

#5
post #2

Invariant to scale and rotation in JS on mobile? That's fantastic! I just tested the Red Laser native app on my phone and it can handle scale/rotation too. But I never thought about rotation for the Red Laser app and always tried to align it properly between the [ ] brackets. I think apps that support scale/rotation should not show [ ] brackets but instead a central red +. Haven't dug deeply into how barcode_locator.…

There are a range of different methods that can be used, but your guess is probably correct regardless of which method you use: "breaking the image into smaller 'patches' and looping through those to look for chunks of a barcode". I would probably train a classifier (SVM or similar) using some rotation invariant feature, such as DAISY or ORB (BRIEF). I tried something similar for CRF image segmentation. This is mighty impressive in JS whatever method they use, the CV libraries in JS are kind of limited.

Re: Show HN: QuaggaJS, a barcode scanner written in JavaScript

#6
post #3

There's also a port of ZBar using Emscripten / asm.js: https://github.com/yurydelendik/zbarjs and a hand-made port of ZXing by Wojciech Szela here: https://github.com/wojciechszela/zxingjs

Thanks, I was looking for a way to trigger a QR code scan from a webpage. I can see zxingJs is in progress

Re: Show HN: QuaggaJS, a barcode scanner written in JavaScript

#7
This is great news.

I just wrote a QRcode-reader Django widget to be used on a mobile browser, using the LazarSoft library (https://github.com/LazarSoft/jsqrcode). The library worked great, but the HTML5 bits turned out to be surprisingly painful. Camera selection works differently in different browsers - Android Chrome has an API, Firefox throws up a selection dialog every time. Mobile Chrome doesn't let you emit audio unless it is in the context of a UI interaction (desktop Chrome does!)

Worst of all: poor autofocus. I tried multiple Android devices (Nexus 4, Moto G v2, Nexus 5) and in all cases, autofocus on getUserMedia() worked indifferently or not at all, especially close up. In contrast, native barcode/QRcode reader apps on the same devices did much better, snapping to focus very quickly.

I wonder if you faced something similar?

Post reply on HN