News for hackers. Stuff that matters.
Re:Barcode Detection API by miohtama on Wednesday March 09, 2022 @05:47PM (#30620985)
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 / WebGL / etc.?
Re:Barcode Detection API by michaelt on Wednesday March 09, 2022 @07:47PM (#30621941)
> does anyone know why this is ”native” API and not just a generic image processing script

Consider the following facts:

1. This was designed by Google

2. Google Play Services provides an API for detecting barcodes, faces and text https://developers.google.com/android/reference/com/google/a...

3. Chrome gets a shape detection API for detecting barcodes, faces and text https://web.dev/shape-detection/

Of course, it's a matter of perspective whether you want to see this as lovers of the free web helping webapps to feature parity with native apps; or Google churning out yet another low-effort standard that's easy for them and difficult for all their competitors.

Re:Barcode Detection API by PaulHoule on Wednesday March 09, 2022 @06:02PM (#30621136)
At this point in time it's a pain point for me that Android devices don't usually have built-in QR reader software. I can tell iOS users to just "scan the code with the Camera" app but I have to tell Android users to find a QR scanner app on the app store.

My experience with an actual bottom-of-the-line prepaid phone was that the first QR scanner app I downloaded from Google Play worked right the first time but I had to try six different apps before I found one that worked with my Samsung Tablet.

A web-based scanner would be a possible answer, though really Google and the phone makers and the carriers should have prioritized a "just works" solution years ago.

Re:Barcode Detection API by Bilal_io on Wednesday March 09, 2022 @06:15PM (#30621252)
I've been scanning QR codes with my Android phone for a long time. I know at least two native cameras work, Pixel's and Samsung's since 2019. But I am sure legacy phones with older android versions don't support it natively.
Re:Barcode Detection API by fy20 on Thursday March 10, 2022 @02:26AM (#30624088)
I have a flagship Xiaomi phone and the built in QR code scanner is garbage. I went to a restaurant with friends which only had a QR code for the menu (which turned out just to be a link to the root of their website - why not write the URL too?). In the end I had to take a picture of the QR code, then crop it, then open that in the scanner app.
Re:Barcode Detection API by Lev1a on Wednesday March 09, 2022 @07:10PM (#30621675)
> I know at least two native cameras work, Pixel's and Samsung's since 2019

My Motorola One can do that as well and IIRC the "moto g4" I had before that too.

Re:Barcode Detection API by WesternWind on Wednesday March 09, 2022 @07:38PM (#30621877)
I've had intermittent issues with my motorola's camera app. Sometimes it picks up qr codes at restaurants, sometimes it refuses, maybe because of lighting issues, though turning on the flash doesn't help. I ended up downloading BinaryEye from F-Droid and I just default to that now.
Re:Barcode Detection API by calmoo on Wednesday March 09, 2022 @06:56PM (#30621583)
My Huawei P20 doesn't have QR scanning native to the camera app.
Re:Barcode Detection API by SkyPuncher on Wednesday March 09, 2022 @07:43PM (#30621913)
> At this point in time it's a pain point for me that Android devices don't usually have built-in QR reader software

It's hidden, but I believe it's built in the default camera app now.

I've learned that my last 3 phones have had it built in.

Re:Barcode Detection API by RenThraysk on Wednesday March 09, 2022 @06:43PM (#30621472)
It's built into Google Lens. Use it occasionally to send files over wifi to phone, with webwormhole.
Re:Barcode Detection API by OJFord on Thursday March 10, 2022 @05:17AM (#30625246)
As always, some fragment of Android actually got there before Apple (to put it in the Camera app), but no, it's not standard.

My current phone (Nokia 3.4) doesn't have it, but previous one (Motorala One) did. Ironic, since I chose them for being about as close to stock as you can get, both in the 'Android One' programme (so also comparatively LTS).

Re:Barcode Detection API by olvrng on Thursday March 10, 2022 @07:54AM (#30626360)
It's always included in Google Lens (and Nokia 3.4 uses Android One). You can open Google Lens and point to the QR code.
Re:Barcode Detection API by OJFord on Friday March 11, 2022 @01:56PM (#30644404)
Yes I said I chose them for being Android One, not that it wasn't.

I didn't know Lens had it, I've never used it. (I have all Google apps disabled.)

Re:Barcode Detection API by easrng on Wednesday March 09, 2022 @07:53PM (#30621986)
My Motorola phone from 2017 has QR support in the Camera app.
Re:Barcode Detection API by eertami on Wednesday March 09, 2022 @06:20PM (#30621283)
Honest question: for what reasons do you ever need to scan a random QR code? I think I've used them to sign in to some apps (eg, WhatsApp) while logged in on a PC, and other than that exactly 0 times.

The Google camera app does support QR codes FWIW, but I don't know if any other vendors except Google use it.

Re:Barcode Detection API by filoleg on Wednesday March 09, 2022 @06:33PM (#30621402)
> Honest question: for what reasons do you ever need to scan a random QR code?

In the past two years, due to COVID, a lot of restaurants and dining establishments got rid of paper menus and left people with "here is a QR code, scan it to see the menu". This is the most common situation I've encountered this in. It wasn't just a few restaurants that did this, it was heavy majority of places here (Seattle).

Re:Barcode Detection API by simonbw on Wednesday March 09, 2022 @06:26PM (#30621352)
In general, assuming you have an easy-to-use QR scanner, it's easier to scan a QR code than type in a URL on a phone, especially a complicated one. A couple examples I've run into recently:

- Lately it's been pretty common for restaurants to replace their physical menus with a QR code on the table that links to their online menu.

- When I've taken COVID tests recently, the site gives me a sticker with a QR code that links to my results page.

- I encoded my wifi network/password into a QR code and printed it out, so guests can just scan it to join, rather than have to scroll and find the right network and type in a password.

Re:Barcode Detection API by PaulHoule on Wednesday March 09, 2022 @06:31PM (#30621387)
Displaying a QR code on a screen is a quick way to beam a URL to a phone or tablet either from a PC or another mobile.

You can put up a QR code to point people to the web app which controls the IoT functions in a space, music system, etc.

Re:Barcode Detection API by dplavery92 on Wednesday March 09, 2022 @06:34PM (#30621413)
They became very popular during the pandemic for restaurants to offer their menu as a scannable QR code instead of distributing and sanitizing hand-held paper menus. I think this is becoming less relevant now.

They're popular for street-level advertisements for (concerts, events, clubs, jobs) to provide a link to more information without the consumer having to type a url into the browser. This is more important if you don't want to pay for a pithy high-level domain as a landing page for the thing you are advertising.

I have also seen them for easily entering WiFi credentials to your device on a new network.

They can be used in museums to link to self-guided tour information on the artwork/exhibits you are looking at. This used to be done more with rentable/loanable walkman+headset kind of devices, but makes more sense to do on one's own mobile device now.

Re:Barcode Detection API by PaulHoule on Wednesday March 09, 2022 @06:29PM (#30621374)
I print ‘three-sided cards’ that have a photo or art reproduction on one side, some documentation on the back, and more information if you scan the QR code. One series of the cards are ‘music cards’ that will play a song, another application is ‘constellations’ that let me stick anywhere from 3 to 40 cards on the wall (so far) and you can see the back sides and other narration by scanning a code.

So my use cases are (1) I am demoing the cards for people, and (2) I give the cards away for free (If it wasn’t for the supply chain crisis I’d be creating a new card design every day) or put up an installation somewhere and people interact with them. Either way I want it to be very easy for people.

Re:Barcode Detection API by askonomm on Wednesday March 09, 2022 @07:43PM (#30621906)
In Argentina, QR codes is how you pay with your phone in super markets, pubs/bars, restaurants, everywhere - its their "apple pay", using Mercado Pago [0] app/service. Also, all the paper menus from restaurants are replaced with QR codes thanks to the pandemic.

[0] https://www.mercadopago.com.ar/

Re:Barcode Detection API by toastal on Wednesday March 09, 2022 @09:03PM (#30622436)
The merchants and banks in Thailand do this as well
Re:Barcode Detection API by computerfriend on Thursday March 10, 2022 @05:14AM (#30625228)
I feel like this is a US thing. The rest of the world (at least in my experience) has been quite liberal with QR codes for the past ten or so years.
Re:Barcode Detection API by Jcampuzano2 on Wednesday March 09, 2022 @07:52PM (#30621977)
You wouldn't be able to see a single menu nearly anywhere here in Mexico City without one.

Basically everywhere uses a QR code for something of importance

Re:Barcode Detection API by isatty on Wednesday March 09, 2022 @06:34PM (#30621412)
Lots of restaurants and bars switched to QR codes for their menus and that alone is a good enough reason to have native scanning.
Re:Barcode Detection API by LouisSayers on Wednesday March 09, 2022 @06:31PM (#30621389)
I literally just scanned a couple while at the doctors - one to check in, and another provided a url of a form to fill in.

They're also in some restaurants where you can get to a menu to order from your phone.

You also scan QR codes for use in two factor authentication apps.

Covid has normalised QR code scanning in Australia - we have to do it at certain venues in order to show our vaccine passes.

Re:Barcode Detection API by meepmorp on Wednesday March 09, 2022 @07:06PM (#30621657)
My gym has a QR code with the Wi-Fi info
Re:Barcode Detection API by idealmedtech on Wednesday March 09, 2022 @06:02PM (#30621140)
Native code allows for performance gains that a script (even a performant one) may not be able to match. After all, this is fundamentally an image processing problem, one of the more computationally expensive things a browser has to do.
Re:Barcode Detection API by Gigachad on Wednesday March 09, 2022 @06:27PM (#30621357)
Isn't that the point of webassembly? Just seems like we are still moving in the wrong direction on trying to move the whole of NPM in to the browser web apis, rather than building a solid base you can build anything on.
Re:Barcode Detection API by michaelt on Wednesday March 09, 2022 @07:17PM (#30621726)
High performance barcode decoding (e.g. scandit) uses the GPU.

After all, a modern cell phone could be producing 4k 30fps video, and high performance barcode decoders will detect linear barcodes with lines a single pixel wide, even in the presence of moderate noise/blur/overexposure (e.g. the barcode on a shiny can of coke)

Of course, I've got no idea if browsers will provide high performance barcode reading, or something simpler like zxing.

And I've got to say, it's not obvious to me why browsers would implement a barcode scanning API in preference to a more general accelerated image processing API. Plenty of other applications want to do real time video processing in the browser - such as video call background removal.

Re:Barcode Detection API by nwsm on Thursday March 10, 2022 @12:15PM (#30629401)
Do you have any examples of what a more general image processing API would feature? Everything between reading pixels and reading barcodes is a mystery to me.
Re:Barcode Detection API by idealmedtech on Wednesday March 09, 2022 @07:23PM (#30621780)
I'm not a browser developer, but to wager a guess, it probably has something to do with the inertia of existing solutions being native, rather than in WebAssembly, which is still quite new as standards go.
Re:Barcode Detection API by agucova on Wednesday March 09, 2022 @06:15PM (#30621243)
It's a heavily standardized, very recurrent problem that can take a lot of advantage of native code and platform-specific optimization, so it's really an ideal target for a Web API.
Re:Barcode Detection API by rahimnathwani on Wednesday March 09, 2022 @05:57PM (#30621096)
To allow the implementation to take advantage of libraries provided by the operating system[0] (where available), without the web site developer needing to even know that it's happening.

[0] or things like Google Play Services.

Re:Barcode Detection API by afavour on Wednesday March 09, 2022 @06:16PM (#30621261)
Barcode detectors can be pretty big dependencies. Given that this will often just be forwarding directly so some kind of OS capability it makes sense to ship in browser.
Re:Barcode Detection API by bena on Wednesday March 09, 2022 @05:54PM (#30621066)
Because while barcode scanning is a subset of image processing, it's a use case that's pretty common.