Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live scan feature #37

Open
rugk opened this issue Mar 28, 2017 · 10 comments
Open

Live scan feature #37

rugk opened this issue Mar 28, 2017 · 10 comments

Comments

@rugk
Copy link
Contributor

rugk commented Mar 28, 2017

It would be nice if this lib could have a live scan/live stream feature - just like this lib for barcodes -, so you can easily use it to read QR codes in real time.

Also related to/required for #29

@rugk
Copy link
Contributor Author

rugk commented Mar 29, 2017

Actually a problem for this is how to efficiently get the image data from a video element without saving it in a canvas first. @edi9999, do you have any suggestions/ideas?

@rugk
Copy link
Contributor Author

rugk commented Mar 29, 2017

Okay, I found some ways, but actually decoding does not work at all on mobile devices (tested with Firefox for Android). It always fails with: Couldn't find enough finder patterns:0 patterns found

The code I used is here: https://gist.github.com/rugk/44e9cd89f3b67adfcb229843fffed02

And even when using your test file on the desktop with some photos of a QR code and some surrounding elements, only 2 of 4 images were recognized in my case. (If you want the test pics, I can mail them to you)

@edi9999
Copy link
Owner

edi9999 commented Mar 30, 2017

The URL file gist is a 404.

Yes, I'd be interested in the images, but if possible, it would be good to add them in the testsuite. Do you have confidential data on those images ?

@rugk
Copy link
Contributor Author

rugk commented Mar 30, 2017

No, but it's easy to create new images. (I only wanted to share them, so you can reproduce the issues…) The real link is https://gist.github.com/rugk/44e9cd89f3b67adfcb229843fffed02f.

@Lucassifoni
Copy link

Lucassifoni commented Jul 28, 2017

Here's what I'm using to live-scan (extracted and approximately rewritten from my vue files, it's now pseudo-code for some parts and I messed up indentation when pasting), I'm mid-development and will refactor & temper everything, so it's a mess right now.

Edit : see comment below

@rugk
Copy link
Contributor Author

rugk commented Jul 28, 2017

Is there a proof of concept one can use to test it?

@Lucassifoni
Copy link

I'll make a github page with a runnable version this afternoon.

@Lucassifoni
Copy link

Lucassifoni commented Jul 28, 2017

@rugk here's a demo : https://lucassifoni.github.io/qr-code-live-scan/
I'm really sorry for the packaging though, you currently both have to run

npm run watch

And serve it accordingly, with

php -S localhost:8080

or

caddy

or whatever suits your use. Without mentioning that the code is currently a mess and needs to be refactored, and that my package.json includes way too much things.
I added qrcode-reader to the repo, because I removed a case invoking new Image() in my worker script, that made it fail.

Regardless, the demo works, and is configured to run at 45 FPS and ask for a scan (if the worker isn't busy) every 17 frames. With this setup, my testing Motorola G (1gb ram, quite weak computing power) manages to keep everything fluid.

Feel free to ask anything, I'll have to elaborate on this and cover more use-cases for a current project, this is our first draft.

@GaylPy
Copy link

GaylPy commented Jul 28, 2017

Salut Lucas, ta démo avec support WebRTC fonctionne très bien. J'ai besoin de ce système pour un projet mais je n'y arrive pas avec le projet de LazarSoft, c'est très instable. Alors que ta démo me détecte facilement et rapidement les QRCodes ! Merci beaucoup, je vais récupérer tes sources, on verras si j'arrive à le faire fonctionner :)

@Lucassifoni
Copy link

Le repo est très sale parce que je n'arrivais pas à configurer webpack pour compiler mon worker séparément avec la base fournie par vue-cli, d'où les dépendances demandées par vue-cli ET laravel-mix (qui n'est qu'un wrapper autour de webpack). J'ai l'impression que réécrire la lib en s'inspirant de ça cozmo/jsQR#25 pourrait être bon pour les perfs, cependant.
C'est pour un gros soft interne, donc c'est possible que je prenne le temps de le faire.

//

The repository is really messy because I couldn't configure webpack to separately compile my worker with the vue-cli generated configuration, so that's why both vue-cli/webpack & laravel-mix dependencies are required. Anyway, laravel-mix is only a webpack wrapper. I feel like rewriting the library following this trail cozmo/jsQR#25 could improve performance. We'll maybe put the time for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants