Zxing can't find certain qrcode symbols with first choice mask - Suggestions?

117 views
Skip to first unread message

picn...@gmail.com

unread,
Sep 18, 2008, 5:34:02 AM9/18/08
to zxing
I am working on a project to place a qrcode symbol on a fax
coversheet
in order to automate processing on the receiving fax server. After
some initial testing I was impressed with zxing's qrcode decoding and
believe it could be the basis our automation. I couldn't find a
cheap/
free platform independant encoder that fit my needs so I decided to
build my own j2se based qrcode encoder.

I am in early testing of the encoder but results are pretty good so
far. After hand checking a number a few small symbols I resorted to
testing by "drawing" the symbols to a BufferedImage and then passing
the BufferedImage into zxing to validate the symbol. I have a loop
which takes a 466 character text string and substrings it to length 1
through 466. Each of the 466 generated symbols are passed into zxing
(one at a time) for decode and comparison to the input text. All but
about a dozen are working. For those dozen or so I am getting No
code
found or an error out of zxing (ver .9). For each of these I then
select the second best mask from my mask evaluation process and zxing
then decodes these properly.


I didn't realize that there was a 1.0 version of zxing out. I will
download and test with it but I have a hunch that I will get the same
results.


I am not sure what is making the dozen or so symbols to fail in zxing
with my "best mask" pick. Hopefully it will just be an issue of
tuning my mask evaluation class. Unfortunatly I found ISO/IEC
18004:2006 to be a bit lacking on detail in the section on mask
evaluation. In the end I may just include a zxing decode of the
generated symbol in my cover sheet creator program to make sure it is
a good symbol before the fax is sent. But in an effort to get it
right the first time do you have any recommendations for me to get a
cleaner evaluation of my masks in order to be relatively certain that
zxing will be able to decode?


Regards
PaulJP

srowen

unread,
Sep 18, 2008, 8:35:44 AM9/18/08
to zxing
There most certainly could be a bug here. A decoder should be able to
cope with any mask that you choose, so, it should not matter at all
which mask is chosen.

Do you find the ones that fail have anything in common, like a
particular mask type? could you possibly post one that does not
decode? also maybe you could try a different encoder to rule out
issues with the encoder?

I don't think anything changed in this area between 0.9 and 1.0 but
yes good to try the latest version.

picn...@gmail.com

unread,
Sep 20, 2008, 9:54:41 AM9/20/08
to zxing
Sorry it took so long to reply. I cannot access groups.google.com
from work because it is being blocked by our network overlords as a
time wasting chat site. So I am doing my testing at work and making
the entries to this group when I get home.

I had to go back and change the test data because it contained some
protected information. The new test data generated only 2 errors
using the "best pick" mask during the 466 substring tests. However,
the results of substring txtin.substring(0,259) produced a Eureka
scenario.
Two of the 8 masks fail for this particular text string. And the
failure is propagated in two different forms out of zxing.

The first case is the "best pick" mask #2

dataLength=259
Mask=2
mode=byte
eccLevel=Q
version=15
#dataCodewords=295
#EccCodewords=360
Data=CPCS:1.0;name=John J. Coop;title=Information Technology
Specialist;org=ABCD-123-XX/LKJHYU;address=1234 E 4th St Cleveland OH
45678;phone=216-123-4567;fax=216-890-1234;email=john...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:
1.0;name=John J. Coop

When I decoded the mask-2 symbol the following exception was
experienced.

java.lang.IllegalArgumentException: size must be at least 1
at com.google.zxing.common.BitArray.<init>(BitArray.java:31)
at
com.google.zxing.qrcode.detector.AlignmentPatternFinder.find(AlignmentPatternFinder.java:
86)
at
com.google.zxing.qrcode.detector.Detector.findAlignmentInRegion(Detector.java:
348)
at com.google.zxing.qrcode.detector.Detector.detect(Detector.java:
101)
at com.google.zxing.qrcode.QRCodeReader.decode(QRCodeReader.java:64)
at cpwf.qrencode.QREncode.doDecode(QREncode.java:57)
at cpwf.qrencode.QREncode.doEncode(QREncode.java:82)
at testpkg.CPCoverTest.doBuild(CPCoverTest.java:165)
at testpkg.CPCoverTest.jbInit(CPCoverTest.java:243)
at testpkg.CPCoverTest.<init>(CPCoverTest.java:63)
at testpkg.CPCoverTest.main(CPCoverTest.java:58)

Then I tried each of the other 7 masks on the same symbol. Masks
0,1,4,5,6, and 7 were all good. When I apply mask 3 to the same
symbol and then decode I get the following text printed from zxing.

"No barcode found in image"

If an exception is being generated then I must be eating it somewhere
but at first glance it appears that any exception should be getting
printed. I can dig deeper to verify if there is an exception if you
wish.

I then turned to look at other encoders to verify that I am not doing
something stupid.

www.viooli.com and qrcode.kaywa.com only accept a max of 250
characters of input (just 9 short). However I was able to generate
symbols from www.swetake.com/qr/sample_e.html and from
chart.apis.google.com. In the past when trying to test by comparison
against other encoders I was frequently thwarted with the other
encoders selecting different default masks than me. In this case
though both swetake and google-charts used mask 2. Comparison showed
that my symbol is dead on with google-charts.
Swetake's symbol only differed by a backwards encoding of the 3
modules for the remainder bits found after the end of the ECC codeword
area. I have actually noticed this before with the remainder bits
from Mr.
Swetake's encoder. Each time it only effected the remainder bits.

After rereading the ISO spec I believe mine is correct. And I presume
it does not matter anyways because I can't imagine they would ever be
looked at during decode.

Decoding both google-chart's and Swetake's symbols using the
GUIRunner.java that came with zxing 1.0 both produced the result
"com.google.zxing.ReaderException: No barcode was detected in this
image."

The url for generation of the symbol from google-charts is found
below.

http://chart.apis.google.com/chart?chs=400x400&chld=Q&cht=qr&choe=ISO-8859-1&chl=CPCS:1.0;name=John%20J.%20Coop;title=Information%20Technology%20Specialist;org=ABCD-123-XX/LKJHYU;address=1234%20E%204th%20St%20Cleveland%20OH%2045678;phone=216-123-4567;fax=216-890-1234;email=john...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:1.0;name=John%20J.%20Coop

I have not done the analysis for the other error yet
txtin.substring(0,409) as it took me most of the afternoon to get this
far.

Regards
PaulJP
> > PaulJP- Hide quoted text -
>
> - Show quoted text -

srowen

unread,
Sep 21, 2008, 7:29:55 AM9/21/08
to zxing
The QR Code from Google Charts seems to decode correctly. I am using
version 1.0. I wonder what the difference is. Maybe you can post the
exact image that is failing, and also verify you are using the latest
code?

On Sep 20, 2:54 pm, picni...@gmail.com wrote:
> Sorry it took so long to reply.  I cannot access groups.google.com
> from work because it is being blocked by our network overlords as a
> time wasting chat site.  So I am doing my testing at work and making
> the entries to this group when I get home.
>
> I had to go back and change the test data because it contained some
> protected information.  The new test data generated only 2 errors
> using the "best pick" mask during the 466 substring tests.  However,
> the results of substring txtin.substring(0,259) produced a Eureka
> scenario.
> Two of the 8 masks fail for this particular text string.  And the
> failure is propagated in two different forms out of zxing.
>
> The first case is the "best pick" mask #2
>
> dataLength=259
> Mask=2
> mode=byte
> eccLevel=Q
> version=15
> #dataCodewords=295
> #EccCodewords=360
> Data=CPCS:1.0;name=John J. Coop;title=Information Technology
> Specialist;org=ABCD-123-XX/LKJHYU;address=1234 E 4th St Cleveland OH
> 45678;phone=216-123-4567;fax=216-890-1234;email=john.g...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:
> www.viooli.comand qrcode.kaywa.com only accept a max of 250
> characters of input (just 9 short).  However I was able to generate
> symbols fromwww.swetake.com/qr/sample_e.htmland from
> chart.apis.google.com.  In the past when trying to test by comparison
> against other encoders I was frequently thwarted with the other
> encoders selecting different default masks than me.  In this case
> though both swetake and google-charts used mask 2.  Comparison showed
> that my symbol is dead on with google-charts.
> Swetake's symbol only differed by a backwards encoding of the 3
> modules for the remainder bits found after the end of the ECC codeword
> area.  I have actually noticed this before with the remainder bits
> from Mr.
> Swetake's encoder.  Each time it only effected the remainder bits.
>
> After rereading the ISO spec I believe mine is correct.  And I presume
> it does not matter anyways because I can't imagine they would ever be
> looked at during decode.
>
> Decoding both google-chart's and Swetake's symbols using the
> GUIRunner.java that came with zxing 1.0 both produced the result
> "com.google.zxing.ReaderException: No barcode was detected in this
> image."
>
> The url for generation of the symbol from google-charts is found
> below.
>
> http://chart.apis.google.com/chart?chs=400x400&chld=Q&cht=qr&choe=ISO-8859- 1&chl=CPCS:1.0;name=John%20J.%20Coop;title=Information%20Technology%20Speci alist;org=ABCD-123-XX/LKJHYU;address=1234%20E%204th%20St%20Cleveland%20OH%2 045678;phone=216-123-4567;fax=216-890-1234;email=john.g...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:1.0;name=John%20J.% 20Coop
Message has been deleted

picn...@gmail.com

unread,
Sep 24, 2008, 9:27:37 PM9/24/08
to zxing
I am definitely using 1.0. I had downloaded a new copy of the zxing
source on 9/20 before my tests on that day.

I had done the build with Ant with JDK 1.5 loaded. Previously I had
compiled 0.9 with Oracle jDeveloper and got the same results. The
only common factor is that I ran both from jDeveloper but it is using
JVM 1.5 also. Perhaps I will try running directly from the JVM 1.5
java command.


I don't really have a good place to post the symbols that are giving
me errors and could not figure out a way to use this forum to do
that. I will email them to your gmail account associated with these
posts unless there si a better way to get them to you. I will wait
for a reply before emailing them to you.


Regards
PaulJP
> >www.viooli.comandqrcode.kaywa.com only accept a max of 250
> > characters of input (just 9 short).  However I was able to generate
> > symbols fromwww.swetake.com/qr/sample_e.htmlandfrom
> > chart.apis.google.com.  In the past when trying to test by comparison
> > against other encoders I was frequently thwarted with the other
> > encoders selecting different default masks than me.  In this case
> > though both swetake and google-charts used mask 2.  Comparison showed
> > that my symbol is dead on with google-charts.
> > Swetake's symbol only differed by a backwards encoding of the 3
> > modules for the remainder bits found after the end of the ECC codeword
> > area.  I have actually noticed this before with the remainder bits
> > from Mr.
> > Swetake's encoder.  Each time it only effected the remainder bits.
>
> > After rereading the ISO spec I believe mine is correct.  And I presume
> > it does not matter anyways because I can't imagine they would ever be
> > looked at during decode.
>
> > Decoding both google-chart's and Swetake's symbols using the
> > GUIRunner.java that came with zxing 1.0 both produced the result
> > "com.google.zxing.ReaderException: No barcode was detected in this
> > image."
>
> > The url for generation of the symbol from google-charts is found
> > below.
>
> >http://chart.apis.google.com/chart?chs=400x400&chld=Q&cht=qr&choe=ISO...1&chl=CPCS:1.0;name=John%20J.%20Coop;title=Information%20Technology%20Speci alist;org=ABCD-123-XX/LKJHYU;address=1234%20E%204th%20St%20Cleveland%20OH%2 045678;phone=216-123-4567;fax=216-890-1234;email=john.g...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:1.0;name=John%20J.% 20Coop
> > > - Show quoted text -- Hide quoted text -

srowen

unread,
Sep 30, 2008, 8:57:20 AM9/30/08
to zxing
Thanks, yes please feel free to email me anything. I am srowen at just
about anything, including gmail.com.

There must be some tiny difference between how we're running it and
let's figure it out. I suppose it's good news that it seems to work
for me at least so it must be do-able.
> > >www.viooli.comandqrcode.kaywa.comonly accept a max of 250
> > > characters of input (just 9 short).  However I was able to generate
> > > symbols fromwww.swetake.com/qr/sample_e.htmlandfrom
> > > chart.apis.google.com.  In the past when trying to test by comparison
> > > against other encoders I was frequently thwarted with the other
> > > encoders selecting different default masks than me.  In this case
> > > though both swetake and google-charts used mask 2.  Comparison showed
> > > that my symbol is dead on with google-charts.
> > > Swetake's symbol only differed by a backwards encoding of the 3
> > > modules for the remainder bits found after the end of the ECC codeword
> > > area.  I have actually noticed this before with the remainder bits
> > > from Mr.
> > > Swetake's encoder.  Each time it only effected the remainder bits.
>
> > > After rereading the ISO spec I believe mine is correct.  And I presume
> > > it does not matter anyways because I can't imagine they would ever be
> > > looked at during decode.
>
> > > Decoding both google-chart's and Swetake's symbols using the
> > > GUIRunner.java that came with zxing 1.0 both produced the result
> > > "com.google.zxing.ReaderException: No barcode was detected in this
> > > image."
>
> > > The url for generation of the symbol from google-charts is found
> > > below.
>
> > >http://chart.apis.google.com/chart?chs=400x400&chld=Q&cht=qr&choe=ISO...alist;org=ABCD-123-XX/LKJHYU;address=1234%20E%204th%20St%20Cleveland%20OH%2 045678;phone=216-123-4567;fax=216-890-1234;email=john.g...@abcd.com;type=reg;ssn=123-45-6789;wt=SF50;pages=23CPCS:1.0;name=John%20J.% 20Coop

srowen

unread,
Oct 2, 2008, 9:59:04 AM10/2/08
to zxing
I'm still very interested in following up on this since there might
well be a bug. So far I can't reproduce this. Could you open an issue
at code.google.com/p/zxing or else send me a message with an image
that doesn't decode, if you have a chance?
Reply all
Reply to author
Forward
0 new messages