Improve poor quality TIF image prior to barcode recognition

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
keith_rigg
Posts: 4
Joined: 2013-06-25T00:36:18-07:00
Authentication code: 6789

Improve poor quality TIF image prior to barcode recognition

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Improve poor quality TIF image prior to barcode recognit

Post by Bonzo »

I would recomend posting some sample images.
keith_rigg
Posts: 4
Joined: 2013-06-25T00:36:18-07:00
Authentication code: 6789

Re: Improve poor quality TIF image prior to barcode recognit

Post 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.
Coscript Consulting
Posts: 6
Joined: 2013-06-21T06:43:23-07:00
Authentication code: 6789
Location: Philadelphia, PA

Re: Improve poor quality TIF image prior to barcode recognit

Post by Coscript Consulting »

You can try to apply motion blur in vertical direction.
convert -motion-blur 10x7+90 4772088.tif 4772088blur.tif
keith_rigg
Posts: 4
Joined: 2013-06-25T00:36:18-07:00
Authentication code: 6789

Re: Improve poor quality TIF image prior to barcode recognit

Post 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.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Improve poor quality TIF image prior to barcode recognit

Post 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.
Coscript Consulting
Posts: 6
Joined: 2013-06-21T06:43:23-07:00
Authentication code: 6789
Location: Philadelphia, PA

Re: Improve poor quality TIF image prior to barcode recognit

Post 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.
keith_rigg
Posts: 4
Joined: 2013-06-25T00:36:18-07:00
Authentication code: 6789

Re: Improve poor quality TIF image prior to barcode recognit

Post 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
Coscript Consulting
Posts: 6
Joined: 2013-06-21T06:43:23-07:00
Authentication code: 6789
Location: Philadelphia, PA

Re: Improve poor quality TIF image prior to barcode recognit

Post 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.
Post Reply