googlesamples / android-vision

Deprecated: The Mobile Vision API is now a part of ML Kit: Check out this repo:
https://github.com/firebase/quickstart-android/tree/master/mlkit
Apache License 2.0
2.92k stars 1.73k forks source link

Detected QR codes are appearing and dissapearing quickly (blinking) - poor user experience #280

Open PawelKrawczyk opened 7 years ago

PawelKrawczyk commented 7 years ago

When I scan QR code and try to do not move the camera, the border rectangle is blinking, because of a lot of "onMissing" and "onUpdate" events. I have over 10 events for the same barcode in 1 second. It makes it not usable, when user needs to read data or click on the overlay.

I added logs to the BarcodeGraphicTracker callbacks like "onNewItem", "onUpdate", "onMissing" and "onDone" and here are the results:

10-30 17:11:24.045 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:24.137 3805-6572/: onNewItem: BarcodeGraphic{mId=-1748543329} 10-30 17:11:24.249 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:24.345 3805-6572/: onNewItem: BarcodeGraphic{mId=-1748543329} 10-30 17:11:24.444 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:24.542 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:24.638 3805-6572/: onNewItem: BarcodeGraphic{mId=-1748543329} 10-30 17:11:24.737 3805-6572/: onNewItem: BarcodeGraphic{mId=-1748543329} 10-30 17:11:24.836 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:24.927 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1 10-30 17:11:25.015 3805-6572/: onUpdate: BarcodeGraphic{mId=-1748543329} item: 4|=D03+C1-X1

Is there a way to reduce it and get "onUpdate" and "onNewItem" only after some time or X/Y position change threshold will be reached?

pchx-zz commented 7 years ago

Do you have any example images?

If you're using MultiProcessor, you can tune this behavior with MultiProcessor.Builder.setMaxGapFrames.