PDF417 not decoding?

Dec 12, 2014 at 1:53 AM
Edited Dec 12, 2014 at 1:55 AM
I am using ZXing for the 1st time today. The 1D barcode decoding is working great but trying to decode the back of my North Carolina license, which uses a 2D barcode/PDF417, does not work. I saw one other thread with this issue. Does anyone else have experience with 2D barcode scanning? Here is the relevant code from my WPF project:
        public MainWindow()
        {
            InitializeComponent();
            camera.Initialize();
            camera.Start();

            _barcodeReader = new BarcodeReader();
            var barcodeFormats = new List<BarcodeFormat>();
            barcodeFormats.Add(BarcodeFormat.PDF_417);
            _barcodeReader.Options.PossibleFormats = barcodeFormats;

            _timer = new Timer();
            _timer.Interval = 400;
            _timer.Tick += _timer_Tick;
        }

        void _timer_Tick(object sender, EventArgs e)
        {
            var bitmapSource = camera.GetImage();
            var bitmap = GetBitmapFromBitmapSource(bitmapSource);
            Decode(bitmap);
        }

        private void Decode(Bitmap image)
        {
            var timerStart = DateTime.Now.Ticks;
            var result = _barcodeReader.Decode(image);
            var timerStop = DateTime.Now.Ticks;

            if (result == null)
            {
                txtContent.Text = "No barcode recognized yet";
            }
            else
            {
                _timer.Stop();
                txtContent.Text = result.Text;
            }
            labDuration.Text = new TimeSpan(timerStop - timerStart).Milliseconds.ToString("0 ms");
        }
Thanks in advance
Coordinator
Dec 20, 2014 at 8:07 PM
Your code looks good.
The PDF417 decoder needs images with a good quality. Perhaps is that an issue.
Can you post a sample picture of your PDF417 image here?