zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.

Home Page:https://zxing-js.github.io/library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not decode ean-13 barcode from video if barcode is too small

muster-mark opened this issue · comments

Using BrowserMultiFormatReader.decodeFromVideoDevice, it does not decode an ean-13 barcode if the barcode does not take up quite a large area of the video.

This essentially means that, for example, scanning the barcode on the back of a book using my phone doesnt work, since the camera can't focus close enough to make the barcode big enough.

Is there a way around this?

We need something like mask or scanning area, someone is focusing on this topic? This feature is really needed on mobile devices

In my case, similar problem with decoding small ean-13 barcode - was caused by black borders around barcode.
Also to resolve camera can't focus close enough I'm using camera zoom capability from MediaStreamTrack like this:

  • track.getCapabilities() - to check camera/browser supports zoom
  • track.applyConstraints({ advanced: [{zoom: nextZoom}] }) - to zoom

If you are doing it for an android, you will get what you want if you turn on the flash feature of your phone and zoom the camera (when the flash is turned on, the camera focuses better)

but ios doesn't allow to zoom or flash

@cenkerkumlucali I am not doing it for any particular operating system. It needs to work for all my users.

like i said ios doesn't allow it