TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Barcode Detection API

331 pointsby addcninblueabout 3 years ago

26 comments

bob1029about 3 years ago
This stuff has been a nightmare for us for a long time. We have to scan pdf417 barcodes from physical identification as part of our offering.<p>Recently, we stumbled upon some cheap USB keyboard emulator 2d scanners that can pick these up very reliably. For our product&#x2F;customers, this is a viable path. We have tested probably 30 different webcams by this point. The only 2 that are as reliable as the handheld CCD scanner are the iPad and my Canon DSLR tethered to my PC in automatic mode with a macro lens.<p>Resolution is a factor, but so is frame rate and environment. You have to consider the full UX stack. Someone is required to physically position the barcode in a particular way with certain lighting constraints, etc. With a handheld CCD scanner, you get a laser guide for precisely what distance to go for, and an ergonomic experience that is much more conducive to successful scans. Most offer on board illumination, so even in a pitch black room you will get a successful scan.
评论 #30621885 未加载
评论 #30621871 未加载
评论 #30622552 未加载
评论 #30624415 未加载
评论 #30642300 未加载
gruezabout 3 years ago
&gt;Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.<p>What&#x27;s the point of this? I understand why you might want this for APIs that expose private user information, but this just performs some computation. You could do the same thing with a js library or webassembly. Is this just to punish http sites?
评论 #30622044 未加载
评论 #30621649 未加载
评论 #30623287 未加载
评论 #30622019 未加载
评论 #30622458 未加载
djbusbyabout 3 years ago
There is a full copy of the zxing library in JS. It&#x27;s been working great for my purposes - scanning QR and C128 Barcodes.<p>E: <a href="https:&#x2F;&#x2F;github.com&#x2F;zxing-js&#x2F;library" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zxing-js&#x2F;library</a>
评论 #30624044 未加载
评论 #30623351 未加载
评论 #30621525 未加载
jacob019about 3 years ago
I recently made a webapp for scanning barcodes using the phone camera for warehouse use. I used QuaggaJS. I disabled the barcode locator because it was too heavy, instead I just draw a box on the screen that the barcode is to be positioned in. The barcode detection and decoding happens entirely in the browser and it works very well.
评论 #30621455 未加载
miohtamaabout 3 years ago
As the page does not discuss the motivation behind the API, does anyone know why this is ”native” API and not just a generic image processing script implemented with JavaScript &#x2F; WebGL &#x2F; etc.?
评论 #30621941 未加载
评论 #30621136 未加载
评论 #30621140 未加载
评论 #30621243 未加载
评论 #30621096 未加载
评论 #30621261 未加载
评论 #30621066 未加载
timandoabout 3 years ago
I wanted this to be a barcode scanning API where a web app can use the camera to scan a barcode without being able to see anything else in the image.
duck-valentineabout 3 years ago
There&#x27;s a couple good datasets with trained models on Roboflow Universe that would pair nicely for a Computer Vision project&#x2F;app:<p>Object Detection for QR Code and Bar-Codes - <a href="https:&#x2F;&#x2F;universe.roboflow.com&#x2F;new-workspace-mrc2b&#x2F;optiscan-lwrhq&#x2F;overview" rel="nofollow">https:&#x2F;&#x2F;universe.roboflow.com&#x2F;new-workspace-mrc2b&#x2F;optiscan-l...</a><p>another one for just QR Codes - <a href="https:&#x2F;&#x2F;universe.roboflow.com&#x2F;lihang-xu&#x2F;qr-code-oerhe" rel="nofollow">https:&#x2F;&#x2F;universe.roboflow.com&#x2F;lihang-xu&#x2F;qr-code-oerhe</a>
cyodeabout 3 years ago
Bit off-topic: can anyone recommend resources (videos&#x2F;papers&#x2F;tutorials) that could help me learn how QR barcode detection and scanning itself is implemented?<p>I&#x27;ve been thinking that building a basic scanner from scratch (i.e. only using vanilla cpp&#x2F;python&#x2F;whatever + image processing libraries, but nothing barcode-specific) could teach me a lot.
评论 #30622345 未加载
deracabout 3 years ago
I forked another person&#x27;s code and added bounding boxes, if you want to check it out. Seems like it works pretty well, though the bounding boxes are erratic.<p><a href="https:&#x2F;&#x2F;gist.github.com&#x2F;derac&#x2F;9dfa8884bb04df59ac498d3bac4a93da" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;derac&#x2F;9dfa8884bb04df59ac498d3bac4a93...</a><p><a href="https:&#x2F;&#x2F;htmlpreview.github.io&#x2F;?https:&#x2F;&#x2F;gist.githubusercontent.com&#x2F;derac&#x2F;9dfa8884bb04df59ac498d3bac4a93da&#x2F;raw&#x2F;25f660ba8486774a8ac281f8442e8b58b1afbaaf&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;htmlpreview.github.io&#x2F;?https:&#x2F;&#x2F;gist.githubuserconten...</a>
paxysabout 3 years ago
The dream of the early 2000s is finally being realized.
numlock86about 3 years ago
Cool. Another feature that Firefox won&#x27;t support. Same with the WebSerial API and others. I sort of understand their reasoning that they want to make a web browser and not an application platform, but that&#x27;s where the web is shifting to ... or rather has already for a long time. And people wonder why every new tech&#x2F;browser is based on Chromium all the time. Well, this is one of the many reasons.
评论 #30626982 未加载
adamrezichabout 3 years ago
all of these small features seem good in aggregate but each one makes it that much harder to ever build a competing browser, especially from scratch.
schappimabout 3 years ago
Here is an example of using the Barcode Detection API w&#x2F; WebRTC on Android &#x2F; Chrome: <a href="https:&#x2F;&#x2F;files.littlebird.com.au&#x2F;barcode20.html" rel="nofollow">https:&#x2F;&#x2F;files.littlebird.com.au&#x2F;barcode20.html</a>
marcjuulabout 3 years ago
Does anyone happen to know where in the Chromium code base the implementation is hiding?<p>The android version seems to use a library that&#x27;s part of Google Play Services:<p><pre><code> &#x2F;** * Implementation of mojo BarcodeDetection, using Google Play Services vision package. *&#x2F; </code></pre> and<p><pre><code> &#x2F;&#x2F; The vision library will be downloaded the first time the API is used &#x2F;&#x2F; on the device; this happens &quot;fast&quot;, but it might have not completed, &#x2F;&#x2F; bail in this case. Also, the API was disabled between and v.9.0 and &#x2F;&#x2F; v.9.2, see https:&#x2F;&#x2F;developers.google.com&#x2F;android&#x2F;guides&#x2F;releases. </code></pre> From: <a href="https:&#x2F;&#x2F;github.com&#x2F;chromium&#x2F;chromium&#x2F;blob&#x2F;c4d3c31083a2e1481253ff2d24298a1dfe19c754&#x2F;services&#x2F;shape_detection&#x2F;android&#x2F;java&#x2F;src&#x2F;org&#x2F;chromium&#x2F;shape_detection&#x2F;BarcodeDetectionImpl.java" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;chromium&#x2F;chromium&#x2F;blob&#x2F;c4d3c31083a2e14812...</a><p>The desktop version references a third party library called &quot;barhopper&quot; here:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;chromium&#x2F;chromium&#x2F;blob&#x2F;e1e495b29e1178a451f65980a6c4ae017c34dc94&#x2F;services&#x2F;shape_detection&#x2F;barcode_detection_impl_barhopper.cc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;chromium&#x2F;chromium&#x2F;blob&#x2F;e1e495b29e1178a451...</a><p>and barhopper seems to come from a non-public Google repo:<p><pre><code> &#x27;src&#x2F;third_party&#x2F;barhopper&#x27;: { &#x27;url&#x27;: &#x27;https:&#x2F;&#x2F;chrome-internal.googlesource.com&#x2F;chrome&#x2F;deps&#x2F;barhopper.git&#x27; + &#x27;@&#x27; + &#x27;ad3c4382875afdd0340f1549f8b9c93cbbc16e37&#x27;, &#x27;condition&#x27;: &#x27;checkout_src_internal and checkout_chromeos&#x27;, }, </code></pre> from <a href="https:&#x2F;&#x2F;source.chromium.org&#x2F;chromium&#x2F;chromium&#x2F;src&#x2F;+&#x2F;master:DEPS" rel="nofollow">https:&#x2F;&#x2F;source.chromium.org&#x2F;chromium&#x2F;chromium&#x2F;src&#x2F;+&#x2F;master:D...</a><p>I didn&#x27;t realize that Chromium had missing APIs compared to Chrome but maybe that&#x27;s always been the case? This appears not to be a W3C standard:<p><a href="https:&#x2F;&#x2F;wicg.github.io&#x2F;shape-detection-api&#x2F;" rel="nofollow">https:&#x2F;&#x2F;wicg.github.io&#x2F;shape-detection-api&#x2F;</a><p>I was interested in this because there are no really good open source DataMatrix decoders (to my knowledge) with the one in ZXing being basically unusable (last I checked) and libdtmx being ok but not comparable to commercial offerings.
评论 #30622791 未加载
veysiertekinabout 3 years ago
A different context but related: a website plugin that I have built years ago for barcode scanning machines: JBarcode - <a href="https:&#x2F;&#x2F;github.com&#x2F;veysiertekin&#x2F;jbarcode" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;veysiertekin&#x2F;jbarcode</a><p>I didn&#x27;t made any changes since then. But it can be easily ported into a more modern framework (React.js etc)
Scoundrellerabout 3 years ago
I’m happy to see things like this. My ISP used to ask for a picture of my docsis modem sticker because people kept making mistakes entering in the MAC address.<p>Unfortunately, the csr was just keying them in and keyed mine in wrong so I was without internet for a few days.<p>Something to automatically pick it out would be a lot better.
sleepy_keitaabout 3 years ago
I bought my first Android device to try this feature out. It&#x27;s so much faster than zxing on iOS.
noodlesUKabout 3 years ago
I’d love to see this in safari on iOS as well. The native barcode detection capabilities in iOS are substantially better than libraries like zximg, and I like barcodes as an interface between the real world and tech. I also wish text recognition were in safari.
pabs3about 3 years ago
Anyone know what the backend for this is? Is it zxing-cpp or similar?<p>Edit: guess it depends on the browser and OS.
matthewmacleodabout 3 years ago
Huh, TIL. Recognition performance is pretty modest (on Chrome&#x2F;Mac at least) but it&#x27;s fast and probably more than adequate for most close-up mobile device scans. It basically just wraps MacOS&#x27;s Vision framework on the Mac, and ML Kit on Android.
xg15about 3 years ago
It&#x27;s a nice feature, but, honest question, why is this a web API?<p>I don&#x27;t see anything this has to do with browsers. This could be implemented perfectly well in a library.
ameliusabout 3 years ago
I&#x27;m still looking for an open source python library that can decode Data-Matrix barcodes as seen on Digikey bags. Should I give up and switch to JavaScript+browser?
评论 #30622530 未加载
评论 #30621793 未加载
评论 #30621666 未加载
Eyghtabout 3 years ago
I would love to use this for pairing a product with the correct image by decoding barcodes in the image.
bricssabout 3 years ago
In the latest Chrome: &gt; Uncaught ReferenceError: BarcodeDetector is not defined
PaulHouleabout 3 years ago
... it decodes the barcode too?
评论 #30621169 未加载
评论 #30621143 未加载
ape4about 3 years ago
Even thought its on mozilla.org is not supported by Firefox according to the matrix at the bottom.
评论 #30621109 未加载
评论 #30621226 未加载
评论 #30621655 未加载
评论 #30621118 未加载