This project has moved and is read-only. For the latest updates, please go here.

Detect no. of layers of aztec code?

Dec 19, 2013 at 9:49 AM
I am using ZXing.BarcodeReader to decode various barcode formats in a Windows Phone app. I then later regenerate the bar code from the Result.Text. I would like the regenerated images to show the exact same bar code as the original, but with aztec codes, the size of the code (number of layers) are not always the same. Is there a way to detect the number of layers in the original aztec code when scanning?

Dec 19, 2013 at 2:34 PM
I found a solution by using some of the internal classes:
ZXing.BitmapLuminanceSource lumSource = new BitmapLuminanceSource(writableBitMap);
ZXing.Common.HybridBinarizer binarizer = new ZXing.Common.HybridBinarizer(lumSource);
ZXing.BinaryBitmap bbm = new BinaryBitmap(binarizer);
var bitMatrix = binarizer.BlackMatrix;           
ZXing.Aztec.Internal.Detector detector = new ZXing.Aztec.Internal.Detector(bitMatrix);
ZXing.Aztec.Internal.AztecDetectorResult detres = detector.detect();
The AztecDetectorResult has the number of layers, datablocs etc.
Marked as answer by JonS on 12/19/2013 at 6:34 AM
Dec 19, 2013 at 9:52 PM
Thanks for your report. I added a new result meta datatype which exports the information to the caller.