# Patent

## Title
System and method for recovering image detail from multiple image frames in real-time

## Abstract

This invention describes an efficient super-resolution method for image enhancement that leverages prior knowledge about the specific task for which detail information is recovered. The particular case of barcode scanning is considered. The barcode localization and decoding algorithm of the present invention employs a subpixel-accurate search algorithm which allows for estimating barcode bit values at a higher resolution than that available in the image data itself. It thus allows for the synthesis of image detail from multiple frames with the result containing more detail than any of the input frames. For efficiency, it leverages special properties of the quadrilateral target object as well as prior knowledge about constant patterns in the barcodes of interest. This allows for real-time software implementations on portable devices such as camera-equipped cell phones where super-resolution helps to overcome some of the typical camera resolution and processing power constraints.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
This application claims priority to U.S. Provisional Application Ser. No. 60/791,391, filed Apr. 12, 2006, which is incorporated by reference herein in its entirety.


BACKGROUND OF THE INVENTION
Digital signal enhancement by means of algorithmic processing can improve signal quality drastically, in particular when multiple independent sensor readings are available. However, when computational resources are very limited, then the algorithms must be tailored to the task to be as time-efficient as possible. The focus here is the computational enhancement of light measurements from optical sensors as found in today's cameras, CCDs, infrared scanners or laser scanners. The accuracy of these measurements largely depends on the sensor's quality which is subject to production requirements like cost, size, power-consumption etc. However, by means of algorithmic processing of the recorded light signals, it is possible to restore detail and to improve on the signal-to-noise ratio. Detail information is particularly crucial if the ultimate goal is recognition, for example the recognition of human faces in digital images (i.e. the identification of individuals), the recognition of letters or characters, or the recognition of an infrared-scanned or photographed barcode.
Algorithmic processing can enhance signal detail but it requires computing resources which again are subject to practical constraints because of production requirements. This is particularly the case for portable devices, such as camera-equipped mobile phones, handheld barcode scanners or handheld digital cameras where computational resources are very limited.
In the particular example of barcode scanning with a camera, a portable device of today is typically limited in terms of available image resolution. Computational methods known as “super-resolution” methods can be employed to remedy this. However, standard super-resolution methods are computationally too complex for portable devices of today, given that the user expects to scan a barcode within a matter of seconds (or even less than 1 second).
Therefore, there clearly exists a need for a new time-efficient algorithm that is able to recover image detail in real-time thus providing a fluent and pleasant user experience even with today's portable devices which have limited computational resources.
SUMMARY OF THE INVENTION
Super-resolution methods can recover image detail by means of signal enhancement. However, current methods are too complex to efficiently run on today's mobile devices such as camera-equipped mobile phones. This invention therefore describes a novel super-resolution method that runs in real-time implemented in software by leveraging prior knowledge about the specific task for which detail information is recovered. The particular case of barcode scanning is described here. The barcode localization and decoding algorithm of the present invention employs an efficient subpixel-accurate search algorithm. It is this subpixel-accurate localization scheme which allows for estimating barcode bit values at a higher resolution than that available in the image data itself. It thus allows for the synthesis of image detail from multiple frames with the result containing more detail than any of the input frames alone. This invention can therefore be categorized as a multi-frame super-resolution computer vision algorithm. For efficiency, it leverages special properties of the quadrilateral target object as well as prior knowledge about constant patterns in the barcodes of interest (e.g. localization patterns, alignment patterns, timing patterns and any other form of barcode template). This allows for real-time implementations on portable devices such as camera-equipped cell phones where super-resolution helps to overcome some of the typical camera resolution and processing power constraints.
Therefore, it is a primary object of the present invention to provide a super-resolution algorithm capable of assisting the decoding of barcodes in real-time.
It is another object of the present invention to provide a super-resolution algorithm specifically tailored to barcode decoding on mobile devices.
It is an additional object of the present invention to provide a sophisticated method for information extraction from a series of images where the synthesized result contains potentially more information than each individual input image.
It is yet another object of the present invention to utilize the inherent structure of barcodes to provide increased efficiency in evaluating barcode images.
It is an additional object of the present invention to provide a super-resolution algorithm which is capable of operating on aliased images.
Other objects, features, and characteristics of the present invention, as well as the methods of operation and functions of the related elements of the structure, and the combination of parts and economies of manufacture, will become more apparent upon consideration of the following detailed description.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of super-resolution barcode scanning, according to the invention.
FIG. 2 is a block diagram of the subpixel-accurate localization process, according to the invention.
FIG. 3 is a block diagram of the feature extraction process, according to the invention.
FIG. 4 is a block diagram of the temporal integration and bit classification process, according to the invention.
FIG. 5 is a flow chart, with accompanying images, for illustrating an error reduction process according to the invention.
FIG. 6 is a flow chart, with accompanying images, for illustrating the sub-pixel registration process according to the invention.
FIG. 7 is a block diagram of the noise control process, according to the invention
FIG. 8 is a series of images showing examples of code symbologies and corresponding localization templates.
FIG. 9 is a schematic diagram of the sub-components of an example localization template.
FIG. 10 a series of images of input frames, the extracted codewords, the predicted codewords over time, and the decoding results according to this invention.
FIG. 11 is a diagram showing the prediction process based on counting density peaks.
FIG. 12 is a series of images visualizing the extracted codeword features and successive sharpening results.
FIG. 13 is a block diagram of version number estimation for QR-codes.
FIG. 14 is a schematic drawing of the projective transformation of image pixels to the orthoframe.
FIG. 15 is a block diagram of version number locking.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
A computer method implementation of the invention is described with reference to FIG. 1 which gives an overview. Details are then discussed and clarified. First, the image data of a single image frame is acquired in step 11 from a multi-frame video stream, live from video RAM, from previously stored image files, or from a movie file. The described algorithm is based on image intensities and does not require color. It is assumed the image frame contains an image of a quadrilateral barcode symbol, either 1-dimensional (1D) or 2-dimensional (2D), whose corners are located in step 12. Next, local features of the barcode are computed in step 13 based on the intensity information in the image data. The process maintains a statistical description of feature occurrences in memory and these statistics are updated in step 14 according to features found in the current frame. Symbol recognition in step 15 classifies each barcode bit as either 0 or 1 based on feature statistics and—if the barcode is decoded successfully (step 16)—returns the data string (step 17) encoded by the barcode. If decoding is not successful, the process continues with the next image (starting from step 11), integrating information over time. Thus, with successive image frames, information about the barcode is accumulated. The feature estimates improve and so does the probability for a successful decode. Also, a timer (implemented by a frame counter) is associated with the decoding loop, depicted in FIG. 1, to allow the process to terminate (step 18) after a predetermined period of time if decoding is not successful.
Barcode localization, according to the invention, employs an efficient subpixel-accurate search algorithm. It is this subpixel-accurate localization scheme which allows for estimating barcode bit values at a higher resolution than that available in the image data itself. It thus allows for the recovery of image detail from multiple frames not available in each single frame taken by itself. This invention can therefore be categorized as a multi-frame super-resolution computer vision algorithm. For efficiency, it leverages special properties of the quadrilateral target object as well as prior knowledge about constant patterns in the barcodes of interest (e.g. localization patterns, alignment patterns, timing patterns and any other form of barcode template). This allows for real-time implementations on portable devices such as camera-equipped cell phones where super-resolution helps to overcome some of the typical camera resolution and processing power constraints.
The subpixel localization according to the invention is detailed in FIG. 2 and focuses on the four corners of the quadrilateral target (barcode). Accurate localization is of utmost importance as small coordinate shifts in low resolution image data will result in reading intensities from wrong locations, which essentially means reading random noise.
Starting from a set of coarse corner coordinates (step 21) the space of adjacent coordinates on a sub-pixel scale is searched (step 22). FIG. 6 shows an example of a QR code sampled with four different subpixel shifts (61-64) resulting in four independent candidate codewords. In the actual implementation, only the template components of the QR code are projected to further reduce the number of necessary computations. To evaluate the new fit, process 23 computes the residual error δt between barcode-specific templates τt (the index t enumerates different code symbologies like QR, Datamatrix, EAN etc) and the warped image data A({right arrow over (x)}). It is important to understand that {right arrow over (x)} represents orthoframe coordinates, which in the 2D barcode case are bound by the number of rows and columns of the barcode, independent of the underlying image resolution.




  
    
      δ
      t
    
    ⁡
    
      (
      
        x
        →
      
      )
    
  
  =
  
    
      ∑
      
        x
        →
      
    
    ⁢
    
      
      
        
          τ
          t
        
        -
        
          A
          ⁡
          
            (
            
              x
              →
            
            )
          
        
      
      
    
  




Minimizing the residual error (i.e. template registration) corresponds to optimizing corner coordinates for different subpixel shifts {right arrow over (λ)} relative to the coarse corner coordinates {right arrow over (x)}0.




  
    
      
        arg
      
      ⁢
      min
    
    
      λ
      →
    
  
  ⁢
  
    
      δ
      t
    
    ⁡
    
      (
      
        
          
            x
            →
          
          0
        
        +
        
          λ
          →
        
      
      )
    
  




The residual δt serves also as a means to distinguish between different symbologies t. If corner templates are available (as is the case for example for QR codes), each corner can be optimized independently. Using this form of “local residuals” makes the search much more efficient. The search terminates either when the predefined space has been exhaustively searched (a predefined range vector on {right arrow over (λ)}) or if a predefined residual value has been met. The optimized coordinates (“new corners” in step 24) are then used to recompute the projective transform A (step 25). FIG. 6 shows the sampled codeword 65 after coordinate optimization. For comparison, the original codewords 61-64 exhibit an error rate of about 20% whereas the optimized codeword 65 only has a 10% error rate {right arrow over (x)}.
As shown in FIG. 3, the computed projective transform (step 31) is applied at each bit position i, j to read image intensity values A(i, j) in step 32. These intensities are contrast enhanced using sharpening. Two successive sharpening steps 33 and 35 yield feature matrices B(i, j) in step 34 and C(i, j) in step 36. The proposed invention implements sharpening using a 2D convolution kernel. Original intensities as well as sharpened versions thereof (matrices A, B and C) are the extracted information on which the classification of individual bits will be based.
A critical mechanism according to this invention is the noise control step in the temporal multi-frame integration as depicted in FIG. 4. The noise control step 44 decides whether or not the located and extracted codeword (42/43) from the current frame (step 41) is incorporated into the feature statistics (step 45). The key insight here is that only high quality information will improve the codeword prediction (step 46). This is also because in practice a relatively small number of independent frames is considered for the task: about 5 to 20 frames, because at low frame rates which are typical of handheld devices, additional frames mean more time for the user waiting for feedback which deteriorates overall user experience. Further, the a priori distribution of high quality versus low quality frames in the video stream is unknown, so no assumptions can be made here. Omitting a given frame altogether might be necessary if it is contaminated with too much noise, originating for example from out-of-focus blur, from motion blur, from (partially) under-exposed or over-exposed image data, shadows, glare, specularities etc. Equally, in the case of inaccurate localization in step 42 the extracted information will be overly noisy and would actually harm codeword prediction (step 46). Similar to the subpixel-localization step 42, the noise level is estimated in step 44 by evaluating the error residual with respect to a barcode template. These templates are barcode dependent and examples are shown in FIG. 8 for the QR code (81/82), Datamatrix (83/84) and the UPC-A barcode (85/86). Local residuals for QR codes are illustrated in FIG. 9. For efficiency, the previous results from step 42 can be reused here. The actual codeword quality {tilde over (q)} s estimated based on a linear regression (with regression coefficients {right arrow over (r)}) of local template error residuals {right arrow over (δ)}.

{tilde over (q)}={right arrow over (r)}·{right arrow over (δ′)}

Noise control is further detailed in FIG. 7. The overall error in step 73 is estimated from the vector of local residuals of step 72 (linear mapping). If the result exceeds a previously “learned” threshold (in the machine learning sense) in step 74 the codeword is rejected and the next frame is considered (step 71). Otherwise the codeword is added to the feature statistics in step 75.
The linear estimator is learned beforehand from a set of training examples with measured template residuals. We employ supervised learning with ground truth in form of the actual error percentage of a training instance codeword. The regression coefficients {right arrow over (r)} can then be computed with standard least-squares techniques. Coefficients represent the weight or importance of individual template components. In particular, zero or close-to-zero coefficients indicate that the associated template component is irrelevant. The learning thus serves as a form of feature selection. The parametric form of the estimator is linear because it was found empirically to be both sufficiently accurate and fast to compute (simple dot-product).
The effect of multi-frame integration on the cumulative codeword error according to the invention is illustrated in FIG. 5. The example shows codeword prediction for a QR code. The predicted codeword from the first image frame (label 51) has about 90% of bits correct, not enough though to be successfully decoded. The cumulative error shown by graph 52 reflects the number of bit errors in each column of the codeword. Errors were determined in this illustration by comparing to ground truth. With successive frames yielding high quality codewords (53 and 55) the cumulative error is continuously driven towards zero and falls below 2% in codeword 55.
FIG. 10 relates the actual input frames (101,103,105,107) to the predicted codewords (102,104,106,108) and also shows the decoding status on the right-most column. It must be emphasized here that none of the individual frames allow for decoding. Only their combination through the method as detailed in this invention allows for recovering sufficient barcode detail for successful decoding (108).
Codeword prediction is illustrated in FIG. 11 and FIG. 12. The schematic sketch in FIG. 11 gives a more detailed account of the codeword prediction process. Feature values of n features f0 . . . fγt marked 111-113 in FIG. 11 are binned into histograms which approximate their likelihood p(fi|θ) (where p denotes the density function). For efficiency we seek to minimize the number of features that need to be evaluated and modeled. The implementation according to this invention uses n=3 features, namely the original intensities A(i, j) where i, j are orthoframe coordinates and the sharpening results B(i, j) and C(i, j). All feature values are normalized to the range [0;1]. Assuming equal prior probabilities we decide on an individual bit value given one particular feature fi according to where the peak in the density occurs

bit=1max p(fi|θ)>0.5

The maximum frequency count (we employ histograms for density modeling) is determined for each feature histogram to obtain each feature's hypothesis hi for a barcode bit being either 0 or 1 (steps 114-116). These hypotheses are then accumulated in step 117 and the final bit value {tilde over (h)} is predicted based on voting with uniform weights:

{tilde over (h)}=Σhi>└n/2┘

In probabilistic terms, this can be interpreted as a Naïve Bayes integration of the log-likelihoods, which is well-known for its noise tolerance.
FIG. 12 shows examples of feature matrices A, B and C (121-123). The overall goal is to use only few features which capture enough information to predict bit values accurately and with the least amount of image frames possible (minimum user wait time).
For parameterized barcodes of variable complexity such as QR codes and Datamatrix codes, the barcode parameters need to be recovered first before the entire codeword can be examined. This is done by a version estimation process as illustrated in FIG. 13. The term “version” refers specifically to the QR code which is taken as an example here, and which defines the number of rows and columns in the code matrix (codeword dimension). In the case of QR barcodes this number is related to the number of bits per row m (“orthoframe dimension”)




  υ
  =
  
    
      m
      -
      17
    
    4
  




The general idea here is to recover the version number v first and then to start estimating all other bits in the codeword. It is possible that v can be recovered from the very first image frame already, but it is also possible that a number of frames need to be evaluated first before codeword prediction is initiated. FIG. 13 shows the version estimation process, which follows the principles of codeword prediction as described in this invention. The proposed method maintains a probability distribution over the set of possible version numbers initialized to zeros (step 131). After the codeword has been localized in the current image frame (step 132) a projective transform to an orthoframe is computed. The projection handles in-plane and out-of-plane rotation as well as translation and scaling (illustrated in FIG. 14). The projection is applied for different orthoframe dimensions m, and each time the projection result is then compared to a barcode template (analogous to the description of FIG. 7). The minimum residual gives rise to the most likely version number, that is, it is anti-proportional to the likelihood p(x|v=k) where x relates to the residual conditioned on one particular value k for the version number v. The probability density over all version numbers is stored in memory and updated with successive frames (step 152) and as it becomes more and more accurate over time, the true version number is eventually recovered (step 153). In the particular case of QR barcodes we use the BCH-encoded version string as a secondary cue in version number recovery (step 154). Once the BCH string has been successfully decoded the version number is not further examined (step 151).
While the present invention has been described with reference to one or more preferred embodiments, which embodiments have been set forth in considerable detail for the purposes of making a complete disclosure of the invention, such embodiments are merely exemplary and are not intended to be limiting or represent an exhaustive enumeration of all aspects of the invention. The scope of the invention, therefore, shall be defined solely by the following claims. Further, it will be apparent to those of skill in the art that numerous changes may be made in such details without departing from the spirit and the principles of the invention.

## Claims

1. A method for real-time recovery of barcode features from a plurality of image frames, comprising:
(a) obtaining a first image frame from the plurality of image frames, wherein the plurality of image frames include a barcode;
(b) detecting four-corner coordinates of the barcode in the first image frame using at least one corner template;
(c) detecting a set of barcode features of the barcode based on image intensities;
(d) estimating a noise level of the detected set of barcode features using at least one barcode template;
(e) if the estimated noise level is not greater than a predetermined threshold level, collecting statistical information of the set of barcode features, wherein statistical barcode data is generated from accumulating the collected statistical information;
(f) determining whether the set of barcode features can be decoded based on the statistical barcode data;
(g) if it is determined that the set of barcode features cannot be successfully decoded based on the statistical barcode data, repeating (a)-(g) for a next image frame in the plurality of image frames; and
(h) if it is determined that the set of barcode features can be successfully decoded based on the statistical barcode data, decoding the set of barcode features to extract information encoded in the barcode, wherein the set o of barcode features could not be decoded from any one individual image frame in the plurality of image frames.

2. The method of claim 1, wherein the four-corner coordinates of the barcode are detected using a subpixel-accurate search algorithm.

3. The method of claim 1, wherein the barcode is one of one-dimensional barcode and two-dimensional barcode.

4. The method of claim 1, wherein the statistical information of the barcode features includes nonparametric histogram.

5. The method of claim 4, wherein determining whether the set of barcode features can be decoded is based on histogram peaks in the nonparametric histogram.