Re: Inverted codes support

46 views
Skip to first unread message

Sean Owen

unread,
Feb 8, 2013, 5:55:50 PM2/8/13
to zx...@googlegroups.com
There are two ways to handle inverted codes -- tell the camera driver to invert the image, or invert the image manually in memory. It seems like a lot of devices support the former. Yes it's pretty easy to add, by setting the effect to "negative": http://developer.android.com/reference/android/hardware/Camera.Parameters.html#EFFECT_NEGATIVE

This is something I added to Barcode Scanner+ as an option (https://play.google.com/store/apps/details?id=com.srowen.bs.android). I'm OK back-porting this bit; the general idea is to filter some of these changes back to open source over time.

But first, do you know if your target devices support this mode? you can use ZXingTest to dump the camera's set of supported values.

Yes I like separating the format parameters too and did so in BS+, but not sure if there is consensus on this one for the base app.

Richard Stockham

unread,
Feb 8, 2013, 6:28:33 PM2/8/13
to zx...@googlegroups.com
In my particular case it has to work on a wide class of devices, and ideally on my Android 2.2 device, which doesn't support it. In order to save development costs, we are even looking at possibly having the app integrate with BarcodeScanner+ if we can confirm that it can start each time with whichever flag we need for the particular code. It isn't expectable in our case to have spotty support depending on device. Also, as the codes we are reading can be very small, it would be ideal to allow integration of some sort of filter to rebalance the image for optimum integration into the binarizer, which isn't always symmetric. Obviously such specific functionality wouldn't be integrated into the base, but it isn't practical to develop a new app that uses the zxing library just to avoid trademark issues. We don't even intent to sell or make public our app, but still have this legal issue.

Sean Owen

unread,
Feb 8, 2013, 6:42:41 PM2/8/13
to zx...@googlegroups.com
OK, well I committed the change to add the option to invert the barcode using the camera at least. This isn't controllable by Intent but is a user-chosen option. I think you may need to develop your own scanning app in the end. There are bits of code already in the code base to invert the image manually but needs more work to enable.

Richard Stockham

unread,
Feb 8, 2013, 7:23:50 PM2/8/13
to zx...@googlegroups.com
Thanks, I'll be looking at that then. I hope that's not the case, its nice to be able to take the efforts of open source to speed development like this. I've already noticed that your app is very stable, I only broke it when I started dinking with it to figure out how hard it was to software invert. 18 lines did it inside of Decode Handler, right after the try catch for rawResult, I checked for null, then ran data through a byte inverter and tried again. It would be super easy to modify Barcode Scanner itself if I don't bother with flags, but then we have UI trademark issues. Still, even if I can't use it because of hardware support, I kept finding posts looking for this support while looking for my own solution. Keep up the good work, its nice to see older projects stay fresh with current support.
Reply all
Reply to author
Forward
0 new messages