ngx-scanner icon indicating copy to clipboard operation
ngx-scanner copied to clipboard

Ability to scan inverted (white on black) codes

Open kevincorizi opened this issue 5 years ago • 3 comments

Is your feature request related to a problem? Please describe. I had the need to scan an inverted QR code: although not standard, it is a quite common use case and as far as I could read on the Internet, other libraries do have support for it.

Describe the solution you'd like What i implemented in my local project is an extension of the BrowserMultiFormatReader class to reimplement the createBinaryBitmap changing the luminanceSource as found in this link: https://github.com/zxing-js/library/issues/135. To support both modes, this extended class has a mode toggling variable. I then assign the scanner.codeReader.createBinaryBitmap method to the one of the extended class.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context This is clearly a hack (although a working one). I would like this to be implemented in the BrowserMultiFormatContinuousReader class, maybe with a "enableInverseRead" method that could be exposed to let users decide how to handle the two modes.

I would be very glad to contribute with my solution so far, let me know if it is something you would like to add to the library and I can create a PR to show you what i have so far :)

kevincorizi avatar Nov 22 '19 13:11 kevincorizi

I would be glad to see such as PR :) Let me know if I can help!

AdrienPoupa avatar Nov 29 '19 18:11 AdrienPoupa

We should first implement this on the zxing/library package, so we could just use the feature here, without the need for creating more hacks. I'm also the maintainer of the library, so I can say this feature would be very welcome there too.

odahcam avatar Dec 02 '19 00:12 odahcam

Any news on this?

beyerleinf avatar Aug 05 '21 08:08 beyerleinf

Any new development on this?

I saw the mentioned issue by elmi82, but it does not solve my current requirement.

I use your library to activate video scanning from a device and it's active until it scans the QR code, and it works great, thanks!

But...

Like kevincorizi mentioned, I require scanning of inverted QR codes (white code on black background), and I've been trying all kinds of hacks to get it to work, but apparently it only registers black code on white background.

If there isn't any development on this requested feature, is there someone who could help me implement some sort of hack to be able to scan the inverted codes?

I have been trying to invert the input video, but to no avail.

Romanizat avatar May 04 '24 11:05 Romanizat