Page 1 of 1

Improve poor quality TIF image prior to barcode recognition

Posted: 2013-06-25T00:43:52-07:00
by keith_rigg
Hi All,

I have a large batch of TIF images - each of which contain Code 39 barcodes that I need use to index the documents.

I'm using ZBAR (zbarimg) to process the images and detect the barcode - but I'm only achieving a low success rate (3567 out of 10849 - approx. 32%).
I thought it may be possible to use IM to carryout our some pre-processing to improve the image quality prior to ZBAR attempting to recognise the barcode.

I've checked a number of the images that have failed - and they look to be low quality images with jagged edges etc.

Any help or thoughts on how this could be achieved would appreciated.

Thanks.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T01:28:20-07:00
by Bonzo
I would recomend posting some sample images.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T05:23:30-07:00
by keith_rigg
Bonzo wrote:I would recomend posting some sample images.
I've posted some examples (cropped to only include the barcode) to my Dropbox account - should allow public access;
https://www.dropbox.com/sh/526dogq322xgir8/NQ9lfyhOus

Thanks.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T07:23:36-07:00
by Coscript Consulting
You can try to apply motion blur in vertical direction.
convert -motion-blur 10x7+90 4772088.tif 4772088blur.tif

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T08:00:40-07:00
by keith_rigg
Thank you - I've tried that and still get 0 out of 7 which is a shame.

I've uploaded the 'converted' images to a sub-folder called "motion-blur".
The original 7 images are in a folder called "Original".

Also - I've done some testing using 'zbarcam' & 'zbarimg' - using 'zbarimg' to process the images, I get 0 out of 7 barcodes.
But by opening the image on-screen, and using 'zbarcam' to scan the image (via a webcam pointing at my monitor) I'm able to recognise 6 out of 7 barcodes.

See following screen shot for further information: https://www.dropbox.com/s/491kwgava8aht ... images.jpg

This seems to suggest enlarging the barcode would help (and maybe cropping the image) as the image is displayed larger on-screen when scanning with the webcam?!?

Any further ideas?

Thanks.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T09:49:44-07:00
by holden
I'm curious if scaling them up then back down with a specific method http://www.imagemagick.org/Usage/filter/ and/or this http://www.imagemagick.org/Usage/resize ... ive-resize would get you usable results. This is a tricky thing to do with low res images, the old blood from a stone thing.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-25T15:39:25-07:00
by Coscript Consulting
Compile the latest development version of ZBAR. It recognizes 6 out of 7 files unmodified.
The last one is recognized after applying some vertical blur
convert -motion-blur 30x30-90 4774438.tif 4774438blur.tif

Please contact me directly if you need further assistance with compiling, scripting, or
custom programming.

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-26T00:59:37-07:00
by keith_rigg
Thank you - could you confirm the version of ZBAR you used?
I'm running what I believe to be the latest release - 0.10

Re: Improve poor quality TIF image prior to barcode recognit

Posted: 2013-06-26T06:35:14-07:00
by Coscript Consulting
$ ./zbarimg/zbarimg --version
0.10

$ hg tip
changeset: 362:38e78368283d
tag: tip
user: spadix@users.sourceforge.net
date: Sun Oct 14 23:02:08 2012 -0700
summary: Added tag iPhoneSDK-1.3.1 for changeset 5eb3c8786845

I'm running the current development version on 64-bit GNU/Linux.
The version displayed by the program was, probably, not updated.