When trying https://zxing-js.github.io/library/examples/multi-camera/, the detection rate was quite poor in my tests due to the fact it was impossible to do the focus.
Would it be possible to add this feature in the demo:
On "tap" event (i.e. when tapping the image viewer with one finger), trigger a re-focus / auto-focus.
This is quite common in most camera apps, and I think it would increase the detection rate for users.
What do you think @odahcam @werthdavid ?
Do you have/know any content about this feature for us to take a look?
Thank you for your answer @odahcam. It's just a normal barcode photo but very blurry, because the phone camera did not make the autofocus.
Is there a way from code to ask the device's camera to trigger an autofocus?
This would be very useful.
Well, that was exactly what I wanted to know. 馃槃 I'm afraid we'll have to search for it together.
Stale issue message
.decodeOnceFromConstraints(
{
video: {
aspectRatio,
facingMode: 'environment',
focusMode: 'continuous',
frameRate: { ideal: 10, max: 15 },
width: { min: 640, ideal: 2048, max: 4048 },
},
audio: false,
},
videoRef.current,
)
With focusMode: 'continuous' you can enable autofocus.
Good news! Thanks for taking time to coming all the way back here after so long.
For various reasons what @DavidSichau is suggesting didn't work for me. For instance I want to be able to toggle between different cameras and not let the library decide which camera to open.
Also I am trying to add the autofocus while decoding with the use of applyConstraints() on the stream with no success till now.
@odahcam do you believe that adding a constraints object to decode functions in order to pass more constraints to those functions and not just the deviceId could be possible?
It already exists. See the "broswer" repository.
Most helpful comment
With focusMode: 'continuous' you can enable autofocus.