How to recognize ITF barcode with Red Lines at the start and end of the code?

28 views
Skip to first unread message

Neal Sanche

unread,
Jul 27, 2015, 3:42:44 PM7/27/15
to zxing
Hi All,

I have been asked to recognize a barcode like the attached, which is an ITF code with a red vertical line at the start and end. It has been suggested that making a modified binarizer that treats red and black differently may be a workable way to approach this.

Has anyone made a binarizer that finds only black, or filters out colour components of an image? Thanks in advance for any help you can give me in solving this problem.

Thanks.

Neal

IMG_20150727_124638.jpg

Neal Sanche

unread,
Jul 27, 2015, 6:00:33 PM7/27/15
to zxing, thori...@gmail.com
I suspect the quiet zone at the end of this code might be a little short, but the code is recognized quickly by zbar, and I wonder if there's a hint I can give to zxing to make it recognize this despite the small quiet zone?

Bas Vijfwinkel

unread,
Jul 28, 2015, 12:25:29 AM7/28/15
to zxing, thori...@gmail.com
On Tuesday, July 28, 2015 at 7:00:33 AM UTC+9, Neal Sanche wrote:
> I suspect the quiet zone at the end of this code might be a little short
That is indeed the case with this example.
If you color the red lines gray then it is recognized with zxing online.
ZXing expects 10 times the individual bar widths to be present on the right and left side of the barcode. In your case it is only 3~4 times the bar width.

You could try to adjust the minimum 'quiet space' :
https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/oned/ITFReader.java#L213

'removing' the red line can be done in this section :
https://github.com/zxing/zxing/blob/master/core/src/main/java/com/google/zxing/RGBLuminanceSource.java#L44
Check if you have a 'reddish' color and in that case replace it with a white color.

Neal Sanche

unread,
Jul 29, 2015, 12:36:26 AM7/29/15
to Bas Vijfwinkel, zxing

Thanks. I was able to improve recognition by preprocessing the YUV frames and adding the U channel to the Y channel, increasing the brightness of the Red areas of the image.

Seems to help a lot. Thanks for the hints.

Neal

Reply all
Reply to author
Forward
0 new messages