Skip to content

Commit

Permalink
Various QR decoder fixes to bring it more in-line with the spec.
Browse files Browse the repository at this point in the history
- Support mirror-image reversals.
  We still don't support reflectance-reversals.
- Properly compute the self-parity of each symbol in an S-A group.
  We still don't use it to validate the parity of the entire group.
- Properly decode the Application Indicator for FNC1 in the 2nd
   position, and prepend its textual representation to the output.
- Only use the first S-A header, instead of the last, as this is
   supposed to be the very first entry in the stream.
- Only use the first FNC1 marker, instead of the last, as this is
   supposed to appear once, before any data entries (after S-A and
   ECI).
- Properly reserve some of the parity bytes for small codes
   (versions 1, 2-L, and 3-L) for error detection instead of
   correction, as the spec requires.
  This causes zxing-4/43.png to fail where it succeeded before.
- Add support for the UTF-8 ECI marker (000026).
- Treat data encoded in kanji mode as part of the ECI-specified
   character set, if any, instead of always treating it as SJIS.

Also, assorted bug fixes:
- Properly reset the "empty" count after finding an isolated module
   while scanning the right edge during homography estimation.
- Avoid division by zero when projecting the lower-right alignment
   pattern out to the corner during homography estimation.
- Limit the number of consecutive invalid configurations we'll try,
   to avoid long delays in images with lots of finder-pattern-like
   features.
- Properly report the FNC1 markers back to zbar via the modifiers
   field.
  • Loading branch information
tterribe committed Jun 30, 2011
1 parent 48d7bc1 commit e26195a
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 83 deletions.
2 changes: 2 additions & 0 deletions zbar/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <zbar.h>

#include "debug.h"

#define NUM_CFGS (ZBAR_CFG_MAX_LEN - ZBAR_CFG_MIN_LEN + 1)

#ifdef ENABLE_EAN
Expand Down
4 changes: 4 additions & 0 deletions zbar/decoder/qr_finder.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ zbar_symbol_type_t _zbar_find_qr (zbar_decoder_t *dcode)
qrf->s5 += get_width(dcode, 1);
s = qrf->s5;

/*TODO: The 2005 standard allows reflectance-reversed codes (light on dark
instead of dark on light).
If we find finder patterns with the opposite polarity, we should invert
the final binarized image and use them to search for QR codes in that.*/
if(get_color(dcode) != ZBAR_SPACE || s < 7)
return(0);

Expand Down
Loading

0 comments on commit e26195a

Please sign in to comment.