7

I need build a UWP app that can (phone/tablet) use the camera to read a QR barcode from a computer screen. I need to detect the QR barcode as camera is on as I don't want to take a screenshot (or similar) and save this to file and then read it. It needs to be detected at run-time.

Is there any MIT license code (in C#) I can use out there?

Many apps who use this functionality tend to have a "target" window which is not using the entire screen. How can I achieve this as well?

Can someone point me in the right direction as to how can I do this?

Many Thanks.

Thierry
  • 6,142
  • 13
  • 66
  • 117

1 Answers1

4

After quite a bit of research, I eventually found a few articles that pointed me in the right direction.

This one is an interesting read: Mobile Barcode Scanning With Zxing.Net

This one provided me with the core of what I needed: Windows 8 – 8.1 QR Code reader – Definitive guide but used the class SoftwareBitmapLuminanceSource from Zxing.Net.Mobile.

And while I got the above to work as expected, I started to investigate ZXing.Net.Mobile and downloaded the full project. It supports various platforms including UWP.

It's taken me a while to get it up and running, but I eventually did and while their UWP app is crashing for most barcode reading scenarios, the Continuous Scanning does seem to work as expected and works extremely well and extremely fast.

Download the full project from here: ZXing.Net.Mobile

I'll continue investigating but this will get you started if you're in need of a QR reader for UWP.

Hope this will help others.

Thierry
  • 6,142
  • 13
  • 66
  • 117
  • 1
    Hi, I am using ZXing with UWP. It works with me, but when the app runs the camera, it cannot detect any barcode. Do you know the solution of this problem? – Hatim May 05 '16 at 05:07
  • @Hatim I don't save the barcode to an image as I'm only interested in the result it returns as the camera is in "search" mode. Maybe you can create a new question and post the code you're using to save your images, but I'm assuming it is not being released somewhere but I'm pretty sure that doesn't have anything to do with ZXing unless you're using their code to save the image. Sorry cant be of more help. – Thierry May 05 '16 at 11:24
  • Take a look at this link: http://www.yortondotnet.com/2015/07/mobile-barcode-scanning-with-zxingnet.html I agree with the author of that link that autofocus is "overrated". Indeed, autofocus doesn't work very well so manual focus is used. To help the user position the camera, I create a rectangle on the screen such that when the barcode just fills the rectangle, the barcode is read. – ezaspi Jun 29 '16 at 15:04
  • @ezaspi thanks for additional feedback. My app is working great but I did implement autofocus. Works great on the 950xl and 535 but as a matter of interest, would you mind sharing how you restricted your camera to just pick a specific region? At the moment, it scan the whole page. It's super fast on both devices but I would prefer if I only limited to a specific area. Thanks. – Thierry Jun 29 '16 at 16:19
  • Unfortunately I have to deal with the cameras that don't autofocus very well (Like the 920 and 925), as well as those that do. The visual rectangle doesn't restrict the region, it's just a visual aid such that if the user gets the barcode to fit there, it means they have the optimal distance for the manual focus. Additionally, the nice thing about the link I gave is that they start out manual, but switch to autofocus after the user taps the screen. I think I will add that. – ezaspi Jun 29 '16 at 18:27