Because of the lack of disciplined and efficient mechanisms, most modern area charge-coupled device-based barcode scanning technologies are not capable of handling out-of-focus (OOF) image blur and rely heavily on camera systems for capturing good quality, well-focused barcode images. In this paper, we present a novel linear barcode scanning system based on a dynamic template matching scheme. The proposed system works entirely in the spatial domain, and is capable of reading linear barcodes from low-resolution images containing severe OOF blur. This paper treats linear barcode scanning under the perspective of deformed binary waveform analysis and classification. A directed graphical model is designed to characterize the relationship between the blurred barcode waveform and its corresponding symbol value at any specific blur level. Under this model, linear barcode scanning is cast to find the optimal state sequence associated with the deformed barcode waveform segments. A dynamic programming-based inference algorithm is designed to retrieve the optimal state sequence, enabling real-time decoding on mobile devices of limited processing power.