Partially Blind Deblurring of Barcode

Description

Image restoration from out-of-focus (OOF) blur is a very difficult problem, as one has to infer both the original image and the point-spread function (PSF) from the data. We attempt to solve this OOF deblurring problem in the application of barcode reconstruction. We propose a partially blind method to recover binary barcode. It is based on an image formation model for out-of-focus blur. We first estimate a low-dimensional approximation to the PSF by using some parts of clean barcode that are known by construction. This low-dim representation only involves a few parameters, which can be iteratively computed via the Levenberg-Marquardt (LM) algorithm. The rest of the PSF is obtained by polynomial interpolations. Next, image deblurring is performed by

solving the least-square (LS) solution with box constraint. We further take the minimum bar width into account, which corresponds to a stretching matrix or an up-sampling operator. Having this matrix in the LS term largely enhances the efficiency of image deblurring.

The automatic workflow to deal with real data is the following.

  1. take the average of several rows in the image to suppress the noise

  2. bar width estimation. We detect the local minima of the real data, each ideally corresponding to the center of black bar. Using the fact that the barcode is a 95-dim binary vector, we set the bar width to be the number of pixels between the first and the last minimum locations divided by 94. The division by 94 instead of 95 is because that half bars on two ends are not counted in the range of two minima.

  3. Translation alignment. Using the first and last minima, we can determine the center of the barcode. As the length of barcode is known, we take the data from the center with half of the barcode length on each side.

  4. Intensity adjustment. We plot the histogram of real barcode data and match the lowest value to 0, and highest to 1. This gives a linear transform for the intensity.

  5. PSF estimation. Using the pre-processed data together with the known information of the barcode, we estimate a low-dim representation of the PSF. The rest of it is computed by polynomial interpolations.

  6. Image deblurring. Once the PSF is obtained, the image debluring is performed by quadratic programming: least square with box constraint. In particular, a stretching matrix, corresponding to the bar width, is taken into account.

Experiments on real data

Real image of Huggies diaper barcode

Real image of Kirkland plastic wrap barcode

Pre-processed data

Pre-processed data

Ground-truth barcode

Ground-truth barcode

Our reconstruction: perfect!

Our reconstruction: only on bar is incorrect

Codes are available for download.

Please cite our paper:

Yifei Lou, Ernie Esser, Hongkai Zhao and Jack Xin, Partially blind deblurring of barcode from out-of-focus blur. SIAM J. Imaging Sci.,7(2), 740-760, 2014