Test a bar code image, but not get correct result.

38 views
Skip to first unread message

Neo Chu

unread,
May 20, 2015, 2:54:54 AM5/20/15
to zx...@googlegroups.com
Hello,

Someone generates a bar code as attached image file. After testing, it will get "N+E+WS+O+F+T" output. Why there are "+" in the output?

Please help!

Thanks,
Neo
ns-barcode.png

Sean Owen

unread,
May 20, 2015, 4:02:55 AM5/20/15
to zx...@googlegroups.com, neo....@gmail.com
If I recall correctly, this is Code 39's "full ASCII" encoding. It's not possible to know whether to decode it further just looking at the barcode. There's a mode on the Code39Reader that will force it to try to decode it further as full ASCII; you can try that if you know you expect this decoding. But as far as I know this is also a correct decoding of the barcode, since it's literally what the barcode encodes.

Lachezar Dobrev

unread,
May 20, 2015, 5:15:19 AM5/20/15
to Neo Chu, zxing
The Code39 symbology can encode 39 characters (Hence the Code39 name).
This is insufficient to encode both lower-case and upper-case
characters, and most other symbols. To work around this limitation the
Code39 has an encoding scheme that allows additional characters to be
encoded using pairs of characters.
http://en.wikipedia.org/wiki/Code_39#Full_ASCII_Code_39
There is however no sensible way to tell if the +A should mean '+'
and 'A' or 'a', hence the decision whether to decode these pairs is
left to the caller.

Sean: it might be nice for the Code39 reader to always return (an
attempted) Full-ASCII decoded variant in the meta-data? It can also
add a 'check-sum-matches' meta-data? In this case I do not see
significant overhead for doing these. Only problem I see is that the
ResultMetadataType is a fixed enumeration, that does not allow
sub-classing/extending to suit arbitrary symbology needs.
If that is OK with you I could make an attempt to implement this 'proposal'.
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Neo Chu

unread,
May 20, 2015, 6:13:19 AM5/20/15
to zx...@googlegroups.com, neo....@gmail.com
Thank you all very much.
I can try to decode these characters according to http://en.wikipedia.org/wiki/Code_39#Full_ASCII_Code_39.

Sean Owen

unread,
May 20, 2015, 7:35:03 AM5/20/15
to zx...@googlegroups.com, l.do...@gmail.com, neo....@gmail.com
Yeah that is pretty reasonable. If it's decodable as Full ASCII, include that result too. A new enum type is OK.
There may be some similar opportunities to return more possibilities for other m-of-n formats.

Lachezar Dobrev

unread,
May 20, 2015, 10:00:28 AM5/20/15
to Sean Owen, zxing, TH Chu
I have created a pull-request.
https://github.com/zxing/zxing/pull/393
Reply all
Reply to author
Forward
0 new messages