A Bayesian Algorithm for Reading 1D Barcodes