Bug 23641 - Checkout via camera on device
Summary: Checkout via camera on device
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
: 23699 25644 (view as bug list)
Depends on: 30979
Blocks:
  Show dependency treegraph
 
Reported: 2019-09-19 03:01 UTC by Christopher Brannon
Modified: 2024-04-17 15:08 UTC (History)
16 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 23641: Add barcode capture via device camera for self-checkout (391.04 KB, patch)
2023-08-14 00:14 UTC, David Cook
Details | Diff | Splinter Review
Bug 23641: Add barcode capture via device camera for self-checkout (391.04 KB, patch)
2024-04-12 11:19 UTC, Philip Orr
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2019-09-19 03:01:25 UTC
Would love it if someone could figure out a way to do checkout on a device via camera.  Maybe an option to type, but that might be questionable.  Barcode on camera would be better.

It would be great if a patron could grab a book and check it out.  Barring any issues with the checkout (fines/overdues/holds, etc), it could be a quick in and out scenario for patrons.

Those libraries that have security measures could be instructed to a station to deactivate pending checkouts.
Comment 1 Lisette Scheer 2019-09-19 19:48:24 UTC
This would be very helpful!
Comment 2 Ian Walls 2019-09-20 14:02:06 UTC
With HTML5 and smartphone development where they currently stand in 2019, this might actually finally be possible!  Some possible approaches: https://a.kabachnik.info/reading-barcodes-with-built-in-camera-with-html5.html#fileapi

Very exciting stuff!
Comment 3 Arthur Suzuki 2019-09-20 14:03:38 UTC
I definitely love the idea :)
Comment 4 Owen Leonard 2019-09-30 11:31:24 UTC
*** Bug 23699 has been marked as a duplicate of this bug. ***
Comment 5 Martin Renvoize 2020-02-11 08:25:04 UTC
Nice, we're in 2020 now, I wonder if things have stablised enough to attempt adding such functionality now.
Comment 6 Tomáš Wünsch 2020-02-11 15:42:48 UTC
I would also love this feature very much.

I am trying to learn how to process an complete audit of whole library without moving all those items from shelves to the desk and back or buying laptops just for this purpose.
We are obligated to do this every second or fifth year here in Czech Republic, and it is every time quite an operation - we have 10 "big" (20-80k)  and 100 small (2-6k of volumes) local libraries.

As of now, smoothest solution I see in Android tablets/phablets/phones + dedicated readers (we have USB versions, but I am thinking about buying some Bluetooth variations, any experience or recomendation in this field)?
Comment 7 Tomáš Wünsch 2020-02-11 15:46:37 UTC
I would also love this feature very much.

I am trying to learn how to process an complete audit of whole library without moving all those items from shelves to the desk and back or buying laptops just for this purpose.
We are obligated to do this every second or fifth year here in Czech Republic, and it is every time quite an operation - we have 10 "big" (20-80k)  and 100 small (2-6k of volumes) local libraries.

As of now, smoothest solution I see in Android tablets/phablets/phones + dedicated readers (we have USB versions, but I am thinking about buying some Bluetooth variations, any experience or recomendation in this field)?
Comment 8 Martin Renvoize 2021-02-12 11:30:20 UTC
https://zxing-js.github.io/library/ Looks promising
Comment 9 Martin Renvoize 2021-03-03 14:52:03 UTC
*** Bug 25644 has been marked as a duplicate of this bug. ***
Comment 10 Martin Renvoize 2023-02-14 14:46:41 UTC
With bug 30979 nearing completion, adding camera driven barcode input would be a nice enhancement.
Comment 11 koha-US bug tracker 2023-03-08 17:28:52 UTC
I would want a system for this type of self-check that could be configured on a a library-by-library basis.  I have some that have no security system, some that have older security systems using tattle-tape, and some that have RFID.  If a library has an older system that requires demagnetizing tattle-tape, the check-out process will not handle the tattle tape, so those libraries will not want borrowers to check themselves out with a phone.
Comment 12 David Cook 2023-08-14 00:02:06 UTC
(In reply to Martin Renvoize from comment #8)
> https://zxing-js.github.io/library/ Looks promising

Back in June 2021, I did a local implementation using version 0.0.9 of https://github.com/zxing-js/browser 

It was easy enough to do, but the library didn't work that well. Performance ranged heavily between mobile devices (with cheaper devices not working well or at all in many cases), and even with a good more expensive device it could take a lot of attempts to get 1 good scan as the camera wouldn't focus on the barcode very well.

We ended up discarding the implementation and integrating with third-party commercial software which worked much much better.

--

I can share my zxing-js implementation, but I wouldn't recommend anyone use it.
Comment 13 David Cook 2023-08-14 00:14:21 UTC
Created attachment 154400 [details] [review]
Bug 23641: Add barcode capture via device camera for self-checkout

This patch adds barcode capture via device camera using the
zxing-browser Javascript library.
Comment 14 David Cook 2023-08-14 00:22:52 UTC
In my original version, I wrapped the buttons with a system preference. I left it off here just for ease of testing. 

I just double-checked it worked using my webcam and a barcode from my breakfast. It took a bit of time and physical manipulation, but it managed to scan the barcode.
Comment 15 Christopher Brannon 2023-11-02 15:47:32 UTC
Very cool!
Comment 16 David Cook 2023-11-02 23:56:49 UTC
(In reply to Christopher Brannon from comment #15)
> Very cool!

I liked it! 

It tends to work better on higher end devices. We found cheaper smart phones didn't work very well.
Comment 17 Martin Renvoize 2024-02-29 07:35:38 UTC
Looks like there's a patch to test here, thanks David. I'm resetting to NSO
Comment 18 Lucas Gass 2024-02-29 23:28:12 UTC
Very cool, David. Do you we need to add license information to the about page ZXing library?
Comment 19 David Cook 2024-03-01 00:07:55 UTC
(In reply to Lucas Gass from comment #18)
> Very cool, David. Do you we need to add license information to the about
> page ZXing library?

For some reason I thought people meant David Nind. Glad I decided to double-check the bug. 

Yeah, we'd better do that. This looks like the one: https://github.com/zxing-js/browser/blob/master/LICENSE
Comment 20 David Cook 2024-03-01 00:09:59 UTC
As I mentioned before, we had a library try it and it didn't work well enough for them.

We did another version using a commercial vendor (Scandit) which worked much better, although that has on-going costs associated with it.
Comment 21 Philip Orr 2024-04-12 11:19:18 UTC
Created attachment 164827 [details] [review]
Bug 23641: Add barcode capture via device camera for self-checkout

This patch adds barcode capture via device camera using the
zxing-browser Javascript library.

Signed-off-by: Philip Orr <philip.orr@lmscloud.de>
Comment 22 Philip Orr 2024-04-12 11:23:08 UTC
I tested this using only my laptop webcam.
Worked for me with:
- barcodes on books
- barcode on my phone screen
Did not work with barcodes on reflective things.
For instance I tried scanning the barcode on
a bag of chips - didn't work.
Still very cool!
Comment 23 Owen Leonard 2024-04-12 12:12:19 UTC
I tested this on my 2019 iMac and I couldn't get anything to scan.

I tested on my 2021 Macbook and it worked on UPC barcodes but none of the others I could find (unfortunately I don't know what types they were).

I'm concerned that while cool, this isn't reliable enough to offer. If we do want to offer this I think some things need to be addressed:

- Add a system preference to turn it on or off.
- Add some feature-detection to hide the scan button if permission has been denied in the browser.
- Establish which types of barcode are compatible. I see a list of supported types on the ZXing project page (https://github.com/zxing/zxing), but are they all working with the JS implementation.

We also need an update to the about page with details of the plugin, but the other issues are higher priority.
Comment 24 David Cook 2024-04-14 23:29:35 UTC
(In reply to Owen Leonard from comment #23)
> I'm concerned that while cool, this isn't reliable enough to offer. 

Agreed. That's why we abandoned this path. It just wasn't reliable enough, and the Zxing library isn't that well supported.
Comment 25 Christopher Brannon 2024-04-15 17:57:23 UTC
Wouldn't the primary uses of this feature be from phones?  I see very little use case for iMac.

While it might be possible someone would try something other than an Android or iPhone, I don't think those should be a show stopper.
Comment 26 Martin Renvoize 2024-04-15 21:24:23 UTC
What were saying here is that to reliably scan barcode from the web on any platform you'll need to pay to use a service.  Scandit, https://www.scandit.com/pricing/, as mentioned by David are the main one out there to my knowledge.

Unfortunately, Android and iOS don't have any SDK's or similar to expose barcode data via their built in systems. I imagine there's commercial reasons for that somewhere along the line and unfortunately the open source alternative, xzing, doesn't perform well on anything but the highest specification platforms.

We could ensure hooks are available in core for a plugin to support paid options like scandit, though it sounds like that's really already possible anyway as David seems to utilise that route.
Comment 27 David Cook 2024-04-17 06:53:58 UTC
(In reply to Christopher Brannon from comment #25)
> Wouldn't the primary uses of this feature be from phones?  I see very little
> use case for iMac.
> 
> While it might be possible someone would try something other than an Android
> or iPhone, I don't think those should be a show stopper.

We had a number of libraries and librarians try it out, and their low end Android devices just weren't up to the task. It was unusable for them. Even on high-end devices, it could take a bit of work to get the scanning working.

Feel free to try out the code, but I think you'll find that people complain that it doesn't work well enough.

Scandit worked very well, but I don't have code for that at hand. I don't know if the library who was using them ended up continuing with that integration. I think they ended up opting for a dedicated self-checkout machine.
Comment 28 David Cook 2024-04-17 06:55:38 UTC
(In reply to Christopher Brannon from comment #25)
> While it might be possible someone would try something other than an Android
> or iPhone, I don't think those should be a show stopper.

I've put a proof of concept up. Feel free to sponsor someone to take it further if you think there's a future in it.

I'm not going to work on it anymore, but someone else might be able to take it further. Browsers are also constantly changing, so you never know when better functionality might become available.
Comment 29 Christopher Brannon 2024-04-17 15:08:58 UTC
Another thought for this concept down the road, if anyone ever decides to tackle it again - most barcodes print the number below the code.  I know that some devices can pull text from an image.  Would this be another approach at getting the barcode?  Could it be a fallback method?