Abstract:
A method for capturing high-quality document images, comprising steps which first attempt to correct deficiencies in a captured image, then subsequently score the corrected image for quality, and finally, use the score to determine whether the image duality is acceptable. Unacceptable images are flagged for recapture. Corrected deficiencies comprise exposure, geometric distortions and extraneous background. Scored attributes comprise focus, contrast, and legibility.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of the Invention 
         [0002]    The present invention relates to the field of document capture and management and, in particular, to techniques for insuring high-quality document capture. 
         [0003]    2. Description of the Related Art 
         [0004]    There are many known techniques related to both image enhancement and analysis. However, current high-quality image capture solutions typically rely upon a flatbed scanning device, where both the orientation of the document and the direction and quality of the light source can be carefully controlled. Under these circumstances, there is little need to later correct for poor lighting or geometric distortion, as the light source is typically both ample and uniform, and the target document is held flat and perpendicular to both the camera and the light source. 
         [0005]    With the recent promulgation of electronic cameras and smart phones offering high-pixel counts, it is becoming possible to capture a document with resolution on par with a flat-bed scanner. However, a camera or smart phone is typically used within less-than-ideal lighting conditions, and further, the camera or smart phone is often not held perpendicular to the target document during capture. The present invention assembles a number of known technologies in a novel way, in order to facilitate high-quality document capture using a camera, smart phone, or other similar device. 
       BRIEF SUMMARY OF THE INVENTION 
       [0006]    The use of cameras, smart phones, and other non-traditional devices to capture documents presents certain challenges that are not encountered with traditional flat-bed scanners. For instance, one common problem is the lack of a controlled light source. 
         [0007]    Often the only light source available is either too dim, or produces dare or uneven lighting of the target document. Sometimes these shortcomings can be corrected after-the-fact using electronic image processing, but often the only real remedy is to reposition the document relative to the light source and try again. 
         [0008]    Another common problem is that the capture device is held at an incorrect angle or at too much of a distance with respect to the target document. This produces distorted geometry in the first case, and an excessive border in the second. Unlike poor lighting, these shortcomings can often be corrected electronically, as the high pixel count found in modern devices is often sufficient to support the required geometric transformations, while still ultimately delivering the required resolution. However, in certain cases, the distortion or excessive border can be too extreme, or the capture device might not offer sufficient resolution. Thus, sometimes the only remedy is to better position the camera relative to the target document and try again. 
         [0009]    The present invention comprises solutions to each of the problems delineated above. Generally, the present invention comprises steps which first attempt to correct deficiencies in a captured mage using a variety of techniques, then subsequently score the corrected image for quality, and finally, use the score to determine whether the image quality is acceptable. If an image is deemed unacceptable, it is flagged for re-capture, and in some embodiments, feedback is immediately provided to a user, so that another attempt to better capture a target document can be quickly initiated. Note that image processing need not necessarily be confined to the device used at the point of capture. Given that modern devices, often have access to either local or wide-area networks, captured images can be readily transferred to more powerful computing devices where further image processing can be performed. 
         [0010]    For example, in at least one preferred embodiment, document images are first captured on a smart phone, and then initially processed on the phone to correct for geometric distortion. Images are then transferred to a remote server, where they are further processed to correct for lighting deficiencies, and then scored for quality. Images that are deemed to be of sufficient quality are then accepted. In cases where image quality is deemed unacceptable, the server instructs the phone to inform its user that the captured document has not been accepted, upon which the user typically chooses to try again. 
         [0011]    One of the keys to replicating the high-quality results of a flat-bed scanner, is to not only correct for geometrical distortions, but further, to remove any background that has been inadvertently captured. Flat-bed scanners almost universally have a white background, and thus, if there is anything captured beyond the edges of the document, it will display as white. When using an device that must be manually positioned, such as a smart phone or electronic camera, often the image will contain both the target document and parts of the background against which the target document was placed during capture. Thus, at least one preferred embodiment comprises a step which facilitates the cropping of the document image, to remove the unwanted background. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0012]      FIG. 1  presents a functional overview of a simple preferred embodiment. 
           [0013]      FIG. 2  presents a functional overview of a more sophisticated preferred embodiment. 
           [0014]      FIG. 3  presents the content of a sample image at various points along the sequential steps of a preferred embodiment. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
       [0015]    Using a camera, smart phone, and other non-traditional device to scan a document with high-quality results comprises the following steps: initial image capture, processing the captured image, scoring the processed image, and using the score to accept/reject the document image. 
         [0016]    The initial image capture can be initiated by either a machine or a user. In at least one preferred embodiment, a handheld electronic image capture device is positioned by a user, who attempts to align the document within a viewfinder, and then initiates capture. In at least one preferred embodiment, a capture device is mounted in a fixed orientation. In at least one preferred embodiment, capture is initiated automatically based upon a pressure sensitive trigger that senses when a document has been placed within the field of the capture device camera. In at least one preferred embodiment, capture is initiated automatically based upon a software trigger that senses when a document has been placed within the field of the capture device camera. In a plurality of preferred embodiments, the captured image is saved in raw, jpeg, png, tiff, bmp, and/or gif formats. In a plurality of preferred embodiments, the captured image is saved in ram, rom, prom, eprom, on a flash device, on a magnetic disk drive, on an optical drive, on a network drive, and/or on a storage solution assessable via a wireless network, local area network, wide-area network, internet, and/or within the cloud. 
         [0017]    In at least one preferred embodiment, the captured image is then electronically processed to better simulate the quality results of a traditional capture device such as a fiat-bed scanner. Image processing options include conversion to grayscale, contrast enhancement, noise reduction, color correction, glare reduction, perspective transformation to correct for suboptimal camera placement orientation during capture, and/or cropping to discard any extraneous background captured. In at least one preferred embodiment, the captured image is presented to a user, a cropping quadrilateral is super-imposed upon said image, and the user is instructed to reposition said cropping quadrilateral so as to coincide with the edges of the target document, whereupon the user then repositions said cropping quadrilateral and initiates a cropping operation. In at least one preferred embodiment, the edges of the target document are detected and the cropping quadrilateral is then initially aligned with said edges. In at least one preferred embodiment, the cropping quadrilateral is used to both crop and correct for any suboptimal camera placement orientation during capture. 
         [0018]    Two of the above-described processing steps are particularly useful in replicating the high-quality image capture results that are typically obtained by using a traditional image capture device such as a flat-bed scanner. Because traditional image capture devices often hold the target document in a particular position relative to the camera, said devices capture images relatively free of geometric distortions and extraneous background. For instance, images captured using a handheld device such as a smart phone will often include some amount of extraneous background and are often geometrically distorted to some degree because the camera was not centered or held exactly perpendicular to the target document at the time of capture. These two processing options are interrelated in that they both rely upon accurate edge detection of the target document, in at east one preferred embodiment, the edges of the target document are first automatically detected using one or more software algorithms known to those well versed in the art. Then a cropping quadrilateral is presented to a user, whereupon said user is given the capability to adjust the quadrilateral, to more faithfully indicate the actual edges of said document. Finally, the resulting quadrilateral is used as the basis for both the cropping and the perspective transformation of the target image, such that any extraneous background and/or geometric distortion is removed. 
         [0019]    Geometric distortion correction is predicated upon the assumption that the target document is a rectangle. A perspective transformation is utilized which converts the quadrilateral into a target rectangle, said target rectangle being assigned an aspect ratio based upon the mathematical properties of the quadrilateral. Note that the perspective transform is used because it preserves straight lines. 
         [0020]    The target aspect ratio r is calculated as follows: 
         [0000]    
       
         
           
             
               
                 
                   A 
                   = 
                   
                     [ 
                     
                       
                         
                           f 
                         
                         
                           0 
                         
                         
                           w 
                         
                       
                       
                         
                           0 
                         
                         
                           f 
                         
                         
                           h 
                         
                       
                       
                         
                           0 
                         
                         
                           0 
                         
                         
                           1 
                         
                       
                     
                     ] 
                   
                 
               
               
                 
                   ( 
                   1 
                   ) 
                 
               
             
             
               
                 
                   
                     
                       m 
                        
                       
                           
                       
                        
                       1 
                     
                     = 
                     
                       [ 
                       
                         
                           
                             
                               x 
                                
                               
                                   
                               
                                
                               1 
                             
                           
                         
                         
                           
                             
                               y 
                                
                               
                                   
                               
                                
                               1 
                             
                           
                         
                         
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                    
                   
                     
 
                   
                    
                   
                     
                       m 
                        
                       
                           
                       
                        
                       2 
                     
                     = 
                     
                       [ 
                       
                         
                           
                             
                               
                                 
                                   
                                     x 
                                      
                                     
                                         
                                     
                                      
                                     2 
                                   
                                 
                               
                               
                                 
                                   
                                     y 
                                      
                                     
                                         
                                     
                                      
                                     2 
                                   
                                 
                               
                             
                           
                         
                         
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                    
                   
                     
 
                   
                    
                   
                     
                       m 
                        
                       
                           
                       
                        
                       3 
                     
                     = 
                     
                       [ 
                       
                         
                           
                             
                               x 
                                
                               
                                   
                               
                                
                               3 
                             
                           
                         
                         
                           
                             
                               y 
                                
                               
                                   
                               
                                
                               3 
                             
                           
                         
                         
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                    
                   
                     
 
                   
                    
                   
                     
                       m 
                        
                       
                           
                       
                        
                       4 
                     
                     = 
                     
                       [ 
                       
                         
                           
                             
                               x 
                                
                               
                                   
                               
                                
                               4 
                             
                           
                         
                         
                           
                             
                               y 
                                
                               
                                   
                               
                                
                               4 
                             
                           
                         
                         
                           
                             1 
                           
                         
                       
                       ] 
                     
                   
                 
               
               
                 
                   ( 
                   2 
                   ) 
                 
               
             
             
               
                 
                   
                     n 
                      
                     
                         
                     
                      
                     2 
                   
                   = 
                   
                     
                       
                         ( 
                         
                           
                             ( 
                             
                               
                                 
                                   ( 
                                   
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     1 
                                     × 
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     4 
                                   
                                   ) 
                                 
                                 · 
                                 m 
                               
                                
                               
                                   
                               
                                
                               3 
                             
                             ) 
                           
                           ÷ 
                           
                             ( 
                             
                               
                                 
                                   ( 
                                   
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     2 
                                     × 
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     4 
                                   
                                   ) 
                                 
                                 · 
                                 m 
                               
                                
                               
                                   
                               
                                
                               3 
                             
                             ) 
                           
                         
                         ) 
                       
                        
                       m 
                        
                       
                           
                       
                        
                       2 
                     
                     - 
                     
                       m 
                        
                       
                           
                       
                        
                       1 
                     
                   
                 
               
               
                 
                   ( 
                   3 
                   ) 
                 
               
             
             
               
                 
                   
                     n 
                      
                     
                         
                     
                      
                     3 
                   
                   = 
                   
                     
                       
                         ( 
                         
                           
                             ( 
                             
                               
                                 
                                   ( 
                                   
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     1 
                                     × 
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     4 
                                   
                                   ) 
                                 
                                 · 
                                 m 
                               
                                
                               
                                   
                               
                                
                               2 
                             
                             ) 
                           
                           ÷ 
                           
                             ( 
                             
                               
                                 
                                   ( 
                                   
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     2 
                                     × 
                                     m 
                                      
                                     
                                         
                                     
                                      
                                     4 
                                   
                                   ) 
                                 
                                 · 
                                 m 
                               
                                
                               
                                   
                               
                                
                               2 
                             
                             ) 
                           
                         
                         ) 
                       
                        
                       m 
                        
                       
                           
                       
                        
                       3 
                     
                     - 
                     
                       m 
                        
                       
                           
                       
                        
                       1 
                     
                   
                 
               
               
                 
                   ( 
                   4 
                   ) 
                 
               
             
             
               
                 
                   r 
                   = 
                   
                     
                       
                         n 
                          
                         
                             
                         
                          
                         
                           2 
                           T 
                         
                          
                         
                           A 
                           
                             - 
                             T 
                           
                         
                          
                         
                           A 
                           
                             - 
                             1 
                           
                         
                          
                         n 
                          
                         
                             
                         
                          
                         2 
                       
                       
                         n 
                          
                         
                             
                         
                          
                         
                           3 
                           T 
                         
                          
                         
                           A 
                           
                             - 
                             T 
                           
                         
                          
                         
                           A 
                           
                             - 
                             1 
                           
                         
                          
                         n 
                          
                         
                             
                         
                          
                         3 
                       
                     
                   
                 
               
               
                 
                   ( 
                   5 
                   ) 
                 
               
             
           
         
       
     
         [0000]    where f is the focal length of the image capture device&#39;s camera, w is the width of the original image, h is the height of the original mage, and y 1 , x 2 , y 2 , x 3 , y 3 , x 4 , &amp; y 4  are the xy coordinates of the upper-left, lower-left, upper-right, and lower-right corners of the quadrilateral representing the edges of the document as positioned within the original image. 
         [0021]    In at least one preferred embodiment, cropping is performed in two-steps. First, auto-edge detection is used to initially align a cropping quadrilateral with the edges of the target document, and both the document mage and the superimposed cropping quadrilateral are presented to a user. The user then optionally adjusts the quadrilateral to better indicate the actual edges of the harder document. Finally, the quadrilateral is used as input to a second auto-edge detection operation, which removes any extraneous background that would otherwise be included within the cropped image. This second auto-edge detection is useful, because a user will often inadvertently adjust the cropping quadrilateral in such a way as to leave a small slice of extraneous background near one or more of the document edges. If the background matches the document, then this is not particularly noticeable. But more often than not, the background will not match the document in color or texture, in which case it becomes a distraction. 
         [0022]    In at least one preferred embodiment, the captured image is temporarily divided into sub-images. Said sub-images are then processed individually, using parameters some of which are shared and some of which are specific to a particular sub-image or set of sub-images. The processed sub-images are then recombined in a later step. 
         [0023]    In at least one preferred embodiment, the captured image is further processed to enhance its contrast, color fidelity, and sharpness, using techniques well known in the art. In at least one preferred embodiment; an optional noise reduction step is also available. 
         [0024]    Once the captured image has been sufficiently processed, it is then analyzed by computer and assigned an image quality score (IQS). Note that in at least one preferred embodiment the processing step is performed initially on the capture device, after which the image is transferred electronically to a second device where it is further processed, analyzed and scored. 
         [0025]    In at least one preferred embodiment, the IQS calculation comprises the following steps: 
         [0026]    (1) convert captured image electronic representation to grayscale, 
         [0027]    (2) create a vector of delta values between adjacent horizontal pixels, 
         [0028]    (3) calculate a first mean by averaging said delta values, 
         [0029]    (4) for each delta value, square the difference between it and said first mean, 
         [0030]    (5) calculate a second mean by averaging said squared differences, 
         [0031]    (6) assign the Log 10 of said second mean as the IQS. 
         [0032]    In a plurality of preferred embodiments, the IQS is calculated using a variety of analytical techniques well known in the arts, including but not limited to: 
         [0033]    (1) overexposure: analyzing image pixels for degree of saturation, 
         [0034]    (2) focus: analyzing the spacial frequencies of a Fourier transform, 
         [0035]    (3) contrast: analyzing one or more histograms of pixel channel values, 
         [0036]    When a captured image has been scored, its score is then compared to one or more threshold values, and a determination is thereby made as to whether the image is of sufficient submission quality. The one or more threshold values are set using a variety of criteria, based upon the intended purpose of the document image. In at least one preferred embodiment, the threshold is set dynamically depending upon at least one external input value. 
         [0037]    if a captured image is scored and deemed acceptable for submission, then said image is accepted and made available for further processing or distribution. If instead a captured image is scored and deemed unacceptable, then in at least one preferred embodiment, this rejection is relayed to a user, who then decides on a further course of action. In at least one preferred embodiment, said user is given the opportunity to override the rejection and force acceptance of the captured document image. In at least one preferred embodiment, a user may elect to recapture the target document. In at least one preferred embodiment, said user is provided with feedback regarding the reason for rejection, for example a lack of sufficient contrast. Said user is then instructed to take corrective action, with the goal of improving the quality of the subsequent captured image.