Hi,
I've cleaned up my changes for the PDF417 detection and think that they are ready to be merged now.
I've attached a zip file which contains new and changed classes. I've also attached a patch file, but that doesn't include the new test images. I've created a branch in my zxing git clone which contains my changes
https://github.com/graug/zxing/tree/mergeBranch.
The new version completely replaces the existing PDF417 detection code. It reuses the idea of finding the most likely codeword by finding the smallest squared error. It does not, however use oversampling or any image transformations. In my internal testing I found it to be about 40 times faster than the current implementation on my laptop.
My implementation also deals with more corrupt barcodes which are missing the or have a corrupt start or end pattern and can also handle missing columns, as long as enough bytes are available for the error correction. The implementation also supports Compact PDF417 which is missing the stop pattern and optionally the right row indicator column.
I've removed the special code for the pure_barcode option, because the existing implementation wasn't working correctly and I don't think it's needed given the very fast and low resource usage of the new implementation.
The code detects all current test images correctly (the current code fails to detect a few). I've also added a few more test images.
It also adds support for Macro PDF417, which allows information to be spread across several barcodes.
I think we should change the test images directory pdf417 to pdf417-1 to be more consistent with the other test images. I haven't included those changes in my patch. This should be a simple directory rename and updating the path in PDF417BlackBox1TestCase.
As the cutoff date has been pushed back a little, maybe the changes can even be included in the release? Let me know what you think.
Best regards,
Guenther
P.S.: I still have a few ideas on how to improve the detection even further, but this will only make a difference for really bad images.
P.P.S.: Here is a short description of my changes
MultiFormatReader:
added @SuppressWarnings("unchecked")
DecoderResult:
remove final to allow subclasses
GridSampler:
The current code breaks if three points need to be nudged. It only nudges the leftmost and rightmost one, so it fails if there are 3. Should probably be fixed in a better way.
PDF417Common:
New Class that contains common constants.
PDF417DecoderResult:
specific result for PDF417. It needs more attributes then other barcodes
PDF417Reader
New implementation which supports reading multiple barcodes in one image
PDF417ResultMetadata
Class that contains the PDF417 specific barcode metadata
package com.google.zxing.pdf417.decoder
The new decoder implementation
ErrorCorrection:
return number of corrected errors to measure detection quality
ModulusGF
use common constant
Detector
Improved barcode detection code
LineSampler
removed
PDF417DetectorResult
class holds detection results for multiple barcodes on one image
pdf417-2:
1 new test image
pdf417-3
6 new test images
PDF417BlackBox[1-3]TestCase
updated detection counts
DetectorTest
new test class for the detector
DecodeWorker
added null check for points (incomplete barcodes don't have all points set)