cozmo / jsQR

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.
https://cozmo.github.io/jsQR/
Apache License 2.0
3.68k stars 606 forks source link

JSQR is using too much CPU #86

Open alexolliveira opened 6 years ago

alexolliveira commented 6 years ago

JSQR is using a lot of CPU. When the cam is turned on, the use of cpu increases by 50%. How to solve this?

cozmo commented 6 years ago

So generally scanning images is going to use CPU. We've made strides to reduce the amount of CPU (and memory) that jsQR uses, especially in the v1 refactor. That said I certainly agree it could be better. #78 for example will cut down the CPU cycles per image by ~30% (when inverting is disabled) I think.

Going to keep this issue open to track general CPU improvements but we should probably try to define some metrics etc or we'll never be able to close it. Not sure if you have any ideas around that?

adamreisnz commented 5 years ago

Is it possible to move some of the processing to service workers somehow? We also find that especially from a live stream, it becomes almost impossible to scan a QR code on a phone.

henrylearn2rock commented 5 years ago

Check this out https://github.com/tigranbs/reactive-qr

adamreisnz commented 5 years ago

Thanks that looks good, I will try to refactor it for Vue.

FPWombot commented 4 years ago

So generally scanning images is going to use CPU. We've made strides to reduce the amount of CPU (and memory) that jsQR uses, especially in the v1 refactor. That said I certainly agree it could be better. #78 for example will cut down the CPU cycles per image by ~30% (when inverting is disabled) I think.

Going to keep this issue open to track general CPU improvements but we should probably try to define some metrics etc or we'll never be able to close it. Not sure if you have any ideas around that?

Is there a way to destroy the scanner when it has grabbed a code? So it only is running when called. similar to this example:

any help appreciated thanks