# Patent

## Title
Methods and systems for identifying text in digital images

## Abstract

Aspects of the present invention relate to systems, methods and devices for detection of text in an image using an initial text classification result and a verification process.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
This application is a divisional application of U.S. patent application Ser. No. 11/470,519, entitled “Methods and Systems for Identifying Text in Digital Images,” filed on Sep. 6, 2006, invented by Toyohisa Matsuda, Richard John Campbell and Lawrence Shao-hsien Chen, now U.S. Pat. No. 7,876,959, said application, U.S. patent application Ser. No. 11/470,519, is hereby incorporated by reference herein, in its entirety.


FIELD OF THE INVENTION
Embodiments of the present invention comprise methods and systems for identifying text pixels in digital images.
BACKGROUND
Image enhancement algorithms designed to sharpen text, if applied to pictorial image content, may produce visually annoying artifacts in some areas of the pictorial content. In particular, pictorial regions containing strong edges may be affected. While smoothing operations may enhance a natural image, the smoothing of regions containing text is seldom desirable. Reliable and efficient detection of text in digital images is advantageous so that content-type-specific image enhancement methods may be applied to the appropriate regions in a digital image.
SUMMARY
Embodiments of the present invention comprise methods and systems for identifying text in a digital image using an initial text classification and a verification process.
The foregoing and other objectives, features, and advantages of the invention will be more readily understood upon consideration of the following detailed description of the invention taken in conjunction with the accompanying drawings.



BRIEF DESCRIPTION OF THE SEVERAL DRAWINGS
FIG. 1 is an example of an image comprising a multiplicity of regions of different content type;
FIG. 2 is a diagram showing embodiments of the present invention comprising generating text candidates with increased support over initial segmentation followed by entropy-based discrimination of pictorial regions;
FIG. 3 is a diagram showing embodiments of the present invention in which a counting process may be used to increase the support of the image features;
FIG. 4 is a diagram showing embodiments of the present invention in which a refined text map may be generated;
FIG. 5 is an exemplary histogram showing feature value separation;
FIG. 6 is an exemplary histogram showing feature value separation;
FIG. 7 is a diagram showing exemplary embodiments of the present invention comprising a masked-entropy calculation from a histogram;
FIG. 8 is a diagram showing an exemplary embodiment of masked-image generation;
FIG. 9 is a diagram showing an exemplary embodiment of histogram generation;
FIG. 10 is a diagram showing exemplary embodiments of the present invention comprising masking, quantization, histogram generation and entropy calculation;
FIG. 11 is a diagram showing exemplary embodiments of the present invention comprising multiple quantization of select data and multiple entropy calculations;
FIG. 12 is a diagram showing exemplary embodiments of the present invention comprising multiple quantizations of select data;
FIG. 13 is a diagram showing pixel classification comprising an image window;
FIG. 14 is a diagram showing block classification comprising an image window;
FIG. 15 is a diagram showing exemplary embodiments of the present invention comprising lobe-based histogram modification;
FIG. 16 is a diagram showing exemplary embodiments of the present invention comprising pixel selection logic using multiple mask inputs;
FIG. 17 is a diagram showing exemplary embodiments of the present invention comprising a masked-entropy calculation from a histogram using confidence levels;
FIG. 18 is a diagram showing an exemplary embodiment of masked-image generation using confidence levels;
FIG. 19 is a diagram showing an exemplary embodiment of histogram generation using confidence levels;
FIG. 20 is a diagram showing embodiments of the present invention comprising entropy-based discrimination of pictorial regions used in text refinement;
FIG. 21A shows the four causal neighbors for a top-left to bottom-right scan pass;
FIG. 21B shows the four causal neighbors for a top-right to bottom-left scan pass;
FIG. 21C shows the four causal neighbors for a bottom-left to top-right scan pass; and
FIG. 21D shows the four causal neighbors for a bottom-right to top-left scan pass.



DETAILED DESCRIPTION OF EXEMPLARY EMBODIMENTS
Embodiments of the present invention will be best understood by reference to the drawings, wherein like parts are designated by like numerals throughout. The figures listed above are expressly incorporated as part of this detailed description.
It will be readily understood that the components of the present invention, as generally described and illustrated in the figures herein, could be arranged and designed in a wide variety of different configurations. Thus, the following more detailed description of the embodiments of the methods and systems of the present invention is not intended to limit the scope of the invention but it is merely representative of the presently preferred embodiments of the invention.
Elements of embodiments of the present invention may be embodied in hardware, firmware and/or software. While exemplary embodiments revealed herein may only describe one of these forms, it is to be understood that one skilled in the art would be able to effectuate these elements in any of these forms while resting within the scope of the present invention.
FIG. 1 shows an image 10 comprising three regions: a pictorial region 12, a text region 14, and a graphics region 16. For many image processing, compression, document management, and other applications, it may be desirable to detect various regions in an image. Exemplary regions may include: a pictorial region, a text region, a graphics region, a half-tone region, a text-on-half-tone region, a text-on-background region, a text-on-a-picture region, a continuous-tone region, a color region, a black-and-white region, a region best compressed by Joint Photographic Experts Group (JPEG) compression, a region best compressed by Joint Bi-level Image Experts Group (JBIG) compression, a background region, and a foreground region. It may also be desirable to identify pixels that are part of text, considered text pixels, in the digital image. Pixels in a pictorial region near, and on, a strong edge or other high-frequency feature may be misclassified as text pixels due to the strong edge nature of text. Half-tone pixels may also be misclassified as text pixels due to the high-frequency content of some half-tone patterns.
Verification of candidate text pixels to eliminate false positives, that is pixels identified as candidate text pixels that are not text pixels, and to resolve misses, that is text pixels that were not labeled as candidate text pixels, but are text pixels, may use a verification process based on edge information and image segmentation.
Embodiments of the present invention shown in FIG. 2 comprise increasing the support of text-pixel candidates 20, followed by discrimination of pictorial regions 22, and clean-up 24 to produce a verification and refinement of candidate text pixels identified by a prior text detection process. Prior detection of text in the digital image may be performed by any of numerous methods known in the art thereby producing a labeling of pixels in the digital image as candidate text edges 26 and raw edge information 28 which may be used to increase the support of candidate text pixels.
In some embodiments, a pixel may be labeled as a candidate text pixel based on a busyness measure in a region surrounding the pixel. The labeling, designated text map 26, may be represented by a one-bit image in which, for example, a bit-value of one may indicate the pixel is a text candidate, whereas a bit-value of zero may indicate the pixel is not considered a text candidate. In some embodiments of the present invention shown in FIG. 3, the raw edge information 28 may comprise a multi-bit label at each pixel in the image wherein any of the labels indicating a possible edge may be mapped 27 to a one-bit image, designated edge map 29, indicating pixels belonging to an edge of any type. The resolution of the one-bit maps, text 26 and edge 29, may be, in some embodiments, the same resolution as the input image.
In some embodiments, the edge map may be derived from applying a significance threshold to the response of an edge kernel. Many edge kernels and edge detection techniques exist in prior art.
In some embodiments, the text map may be derived from a texture feature known as busyness. The measure may differentiate halftone dots from lines and sharp edges from blurred edges. The measure along with edge map may be used to generate text map 26 by eliminating edges that coincide with halftone dot transitions and blurry edges that are less likely to be from text.
In some embodiments, the text map 26 may be derived by identifying edges whose intensity image curvature properties conform to proximity criteria.
In some embodiments, the text map 26 may be derived from the edge ratio features that measure the ratio of strong edges to weak edges and the ratio of edges to pixels for a local region of support.
In some embodiments, the text map 26 may be derived from other techniques known in the art.
As shown in FIG. 3, in some embodiments of the present invention, the one-bit maps, text 26 and edge 29, may be reduced in resolution 30 and 31, respectively. The reduction is done in such a way as to preserve high resolution information, while increasing area of support and enabling more computationally efficient lower resolution operations. The reduced resolution map corresponding to text 26 may be designated textCnt 32, and the reduced resolution map corresponding to edge 29 may be designated edgeCnt 33. The reduction in resolution may be accomplished by replacing each non-overlapping n×n neighborhood of pixels in a respective map by the sum of the bit values in the n×n neighborhood thus effecting a reduction from an N×N map to an




  
    N
    n
  
  ×
  
    N
    n
  




map, textCnt 32 and edgeCnt 33 for text 26 and edge 29, respectively. For example, for input one-bit maps of 600 dots-per-inch (dpi), an 8×8 summing operation will yield 75 dpi maps with entries ranging from 0 to 64 requiring 6 bits to represent each sum. In some embodiments, a sum of 0 and 1 may be represented by the same entry, therefore requiring only 5-bit maps.

On a pixel-by-pixel basis the pixels of textCnt 32 and edgeCnt 33 may be compared to thresholds and the results combined logically, 34 and 35, producing a text candidate map, textCandidate 36, and a pictorial candidate map, pictCandidate 37. If for a given pixel, (edgeCnt>TH1) and (busyCnt>TH2) 34, then the corresponding pixel in the map textCandidate 36 may be set to indicate the pixel is a text candidate. If for a given pixel, (edgeCnt>TH3) and (busyCnt<TH4) 35, then the corresponding pixel in the map pictCandidate 37 may be set to indicate the pixel is a pictorial candidate. In some embodiments, TH1 and TH3 may be equal.
The maps textCandidate 36, pictCandidate 37, edgeCnt 33 and textCnt 32 may be combined after incorporating neighborhood information into textCandidate 36 and pictCandidate 37, thereby expanding the support region of these labels. Embodiments in which the support region of the labels may be expanded are shown in FIG. 4. New maps, textCandidateCnt 42 and pictCandidateCnt 43, may be formed by summing 40, 41 the pixel values in a moving n′×n′ window in textCandidate 36 and pictCandidate 37, respectively. Pixels for which the entire n′×n′ window is not contained within the map may be treated by any of the acceptable methods known in the art including boundary extension and zero padding. The maps textCandidateCnt 42, pictCandidateCnt 43, textCnt 32 and edgeCnt 33 may be combined 44 according to:



  
    
      textCandidateCnt
      
        textCandidateCnt
        +
        pictCandidateCnt
      
    
    >
    
      TH
      ⁢
      
        
      
      ⁢
      5
      ⁢
      
        
      
      ⁢
      
        &
      
    
  




  
    edgeCnt
    >
    
      TH
      ⁢
      
        
      
      ⁢
      6
      ⁢
      
        
      
      ⁢
      
        &
      
    
  




  
    busyCnt
    >
    
      TH
      ⁢
      
        
      
      ⁢
      7
    
  



on a pixel-by-pixel basis forming a revised text candidate map 46, designated textCandidateMap.

A masked-entropy measure may be used to discriminate between text and pictorial regions given the revised text candidate map 46, textCandidateMap, the edge information, edgeCnt 33, and the luminance channel of the original image. The discrimination may provide a further refinement of identified text in the digital image.
The effectiveness and reliability of a region-detection system may depend on the feature or features used for the classification. FIG. 5 shows an example of normalized frequency-of-occurrence plots of the values of a feature for two different image regions. The solid line 52 shows the frequency of occurrence of feature values extracted from image samples belonging to one region. The dashed line 54 shows the frequency of occurrence of feature values extracted from image samples belonging to a second region. The strong overlap of these two curves may indicate that the feature may not be an effective feature for separating image samples belonging to one of these two regions.
FIG. 6 shows another example of normalized frequency-of-occurrence plots of the values of a feature for two different image regions. The solid line 62 shows the frequency of occurrence of feature values extracted from image samples belonging to one region. The dashed line 64 shows the frequency of occurrence of feature values extracted from image samples belonging to a second region. The wide separation of these two curves may indicate that the feature will be an effective feature for classifying image samples as belonging to one of these two regions.
For the purposes of this specification, associated claims, and included drawings, the term histogram will be used to refer to frequency-of-occurrence information in any form or format, for example, that represented as an array, a plot, a linked list and any other data structure associating a frequency-of-occurrence count of a value, or group of values, with the value, or group of values. The value, or group of values, may be related to an image characteristic, for example, color (luminance or chrominance), edge intensity, edge direction, texture, and any other image characteristic.
Embodiments of the present invention comprise methods and systems for region detection in a digital image. Some embodiments of the present invention comprise methods and systems for region detection in a digital image wherein the separation between feature values corresponding to image regions may be accomplished by masking, prior to feature extraction, pixels in the image for which a masking condition is met. In some embodiments, the masked pixel values may not be used when extracting the feature value from the image.
In some exemplary embodiments of the present invention shown in FIG. 7, a masked image 71 may be formed 72 from an input image 70. The masked image 71 may be formed 72 by checking a masking condition at each pixel in the input image 70. An exemplary embodiment shown in FIG. 8 illustrates the formation of the masked image. If an input-image pixel 80 satisfies 82 the masking condition, the value of the pixel at the corresponding location in the masked image may be assigned 86 a value, which may be called a mask-pixel value, indicating that the masking condition is satisfied at that pixel location in the input image. If an input-image pixel 80 does not satisfy 84 the masking condition, the value of the pixel at the corresponding location in the masked image may be assigned the value of the input pixel in the input image 88. The masked image thereby masks pixels in the input image for which a masking condition is satisfied.
In the exemplary embodiments of the present invention shown in FIG. 7, after forming 72 the masked image 71, a histogram 73 may be generated 74 for a block, also considered a segment, section, or any division, not necessarily rectangular in shape, of the masked image 71. For the purposes of this specification, associated claims, and included drawings, the term block will be used to describe a portion of data of any shape including, but not limited to, square, rectangular, circular, elliptical, or approximately circular.
FIG. 9 shows an exemplary embodiment of histogram formation 74. A histogram with bins corresponding to the possible pixel values of the masked image may be formed according to FIG. 9. In some embodiments, all bins may be initially considered empty with initial count zero. The value of a pixel 90 in the block of the masked image may be compared 91 to the mask-pixel value. If the value of the pixel 90 is equal 92 to the mask-pixel value, then the pixel is not accumulated in the histogram, meaning that no histogram bin is incremented, and if there are pixels remaining in the block to examine 96, then the next pixel in the block is examined 91. If the value of the pixel 90 is not equal 93 to the mask-pixel value, then the pixel is accumulated in the histogram 94, meaning that the histogram bin corresponding to the value of the pixel is incremented, and if there are pixels remaining in the block to examine 97, then the next pixel is examined 91.
When a pixel is accumulated in the histogram 94, a counter for counting the number of non-mask pixels in the block of the masked image may be incremented 95. When all pixels in a block have been examined 98, 99, the histogram may be normalized 89. The histogram may be normalized 89 by dividing each bin count by the number of non-mask pixels in the block of the masked image. In alternate embodiments, the histogram may not be normalized and the counter may not be present.
Alternately, the masked image may be represented in two components: a first component that is a binary image, also considered a mask, in which masked pixels may be represented by one of the bit values and unmasked pixels by the other bit value, and a second component that is the digital image. The logical combination of the mask and the digital image forms the masked image. The histogram formation may be accomplished using the two components of the masked image in combination.
An entropy measure 75 may be calculated 76 for the histogram 73 of a block of the masked image. The entropy measure 75 may be considered an image feature of the input image. The entropy measure 75 may be considered any measure of the form:




  
    -
    
      
        ∑
        
          i
          =
          1
        
        N
      
      ⁢
      
        
          h
          ⁡
          
            (
            i
            )
          
        
        *
        
          f
          ⁡
          
            (
            
              h
              ⁡
              
                (
                i
                )
              
            
            )
          
        
      
    
  
  ,




where N is the number of histogram bins, h(i) is the accumulation or count of bin i, and ƒ(·) may be a function with mathematical characteristics similar to a logarithmic function. The entropy measure 75 may be weighted by the proportion of pixels that would have been counted in a bin, but were masked. The entropy measure is of the form:





  -
  
    
      ∑
      
        i
        =
        1
      
      N
    
    ⁢
    
      
        w
        ⁡
        
          (
          i
          )
        
      
      ⁢
      
        h
        ⁡
        
          (
          i
          )
        
      
      *
      
        f
        ⁡
        
          (
          
            h
            ⁡
            
              (
              i
              )
            
          
          )
        
      
    
  




where w(i) is the weighting function. In some embodiments of the present invention, the function ƒ(h(i)) may be log2(h(i)).

In the embodiments of the present invention shown in FIG. 7, after calculating 76 the entropy measure 75 for the histogram 73 corresponding to a block of the image centered at a pixel, the pixel may be classified 77 according to the entropy feature 75. In some embodiments, the classifier 77 may be based on thresholding. A threshold may be determined a priori, adaptively, or by any of numerous methods. The pixel may be classified 77 as belonging to one of two regions depending on which side of the threshold the entropy measure 75 falls.
In some embodiments of the present invention shown in FIG. 10, a digital image 100 and a corresponding mask image 101 may be combined 102 to form masked data 103. The masked data 103 may be quantized 104 forming quantized, masked data 105. The histogram 107 of the quantized, masked data 105 may be generated 106, and an entropy measure 109 may be calculated 108 using the histogram of the quantized, masked data 107. The computational expense of the histogram generation 106 and the entropy calculation 108 may depend on the level, or degree, of quantization of the masked data. The number of histogram bins may depend of the number of quantization levels, and the number of histogram bins may influence the computational expense of the histogram generation 106 and the entropy calculation 108. Due to scanning noise and other factors, uniform areas in a document may not correspond to a single color value in a digital image of the document. In some embodiments of the present invention shown in FIG. 10, the degree of quantization may be related to the expected amount of noise for a uniformly colored area on the document. In some embodiments, the quantization may be uniform. In alternate embodiments, the quantization may be variable. In some embodiments, the quantization may be related to a power of two. In some embodiments in which the quantization is related to a power of two, quantization may be implemented using shifting.
In some embodiments of the present invention, the masked data may not be quantized, but the number of histogram bins may be less than the number of possible masked data values. In these embodiments, a bin in the histogram may represent a range of masked data values.
In some embodiments of the present invention shown in FIG. 11, quantization 110, 111, histogram generation 112, and calculation of entropy 114 may be performed multiple times on the masked data 103 formed by the combination 102 of the digital image 100 and the corresponding mask image 101. The masked data may be quantized using different quantization methods 110, 111. In some embodiments, the different quantization methods may correspond to different levels of quantization. In some embodiments, the different quantization methods may be of the same level of quantization with histogram bin boundaries shifted. In some embodiments, the histogram bin boundaries may be shifted by one-half of a bin width. A histogram may be generated 112 from the data produced by each quantization method 110, 111, and an entropy calculation 114 may be made for each histogram. The multiple entropy measures produced may be combined 116 to form a single measure 117. The single entropy measure may be the average, the maximum, the minimum, a measure of the variance, or any other combination of the multiple entropy measures.
In alternate embodiments of the present invention shown in FIG. 12, data 103 formed by the combination 102 of the digital image 100 and the corresponding mask image 101 may be quantized using different quantization methods 110, 111. Multiple histograms 120, 121 may be formed 112 based on multiple quantizations 122, 123. One histogram 126 from the multiple histograms 120, 121 may be selected 124 for the entropy calculation 125. In some embodiments, the entropy calculation may be made using the histogram with the largest single-bin count. In alternate embodiments, the histogram with the largest single lobe may be used.
In some embodiments of the present invention, a moving window of pixel values centered, in turn, on each pixel of the image, may be used to calculate the entropy measure for the block containing the centered pixel. The entropy may be calculated from the corresponding block in the masked image. The entropy value may be used to classify the pixel at the location on which the moving window is centered. FIG. 13 shows an exemplary embodiment in which a block of pixels is used to measure the entropy feature which is used to classify a single pixel in the block. In FIG. 13, a block 131 is shown for an image 130. The pixels in the masked image in the block 131 may be used to calculate the entropy measure, which may be considered the entropy measure at pixel 132. The pixel in the center of the block 132 may be classified according the entropy measure.
In other embodiments of the present invention, the entropy value may be calculated for a block of the image, and all pixels in the block may be classified with the same classification based on the entropy value. FIG. 14 shows an exemplary embodiment in which a block of pixels is used to measure the entropy feature which is used to classify all pixels in the block. In FIG. 14, a block 141 is shown for an image 140. The pixels in the masked image in the corresponding block may be used to calculate the entropy measure. All pixels 142 in the block 141 may be classified according to the entropy measure.
In some embodiments of the present invention shown in FIG. 15, the entropy may be calculated considering select lobes, also considered peaks, of the histogram. A digital image 100 and a corresponding mask image 101 may be combined 102 to form masked data 103. The masked data 103 may be quantized 104 forming quantized, masked data 105. The histogram 107 of the quantized, masked data 105 may be generated 106, a modified histogram 151 may be generated 150 to consider select lobes of the histogram 107, and an entropy measure 153 may be calculated 152 using the modified histogram of the quantized, masked data 151. In some embodiments, a single lobe of the histogram 107 may be considered. In some embodiments, the single lobe may be the lobe containing the image value of the center pixel of the window of image data for which the histogram may be formed.
FIG. 16 shows embodiments of the present invention in which a digital image 160 may be combined 163 with output 162 of a pixel-selection module 161 to generate data 164 which may be considered in the entropy calculation. The data 164 may be quantized 165. A histogram 168 may be formed 167 from the quantized data 166, and an entropy measure 159 may be calculated 169 for the histogram 168. The pixel-selection module 161 comprises pixel-selection logic that may use multiple masks 157, 158 as input. A mask 157, 158 may correspond to an image structure. Exemplary image structures may include text, halftone, page background, and edges. The pixel-selection logic 161 generates a selection mask 162 that is combined with the digital image 160 to select image pixels that may be masked in the entropy calculation.
In some embodiments of the present invention, the masking condition may be based on the edge strength at a pixel.
In some embodiments of the present invention, a level of confidence in the degree to which the masking condition is satisfied may be calculated. The level of confidence may be used when accumulating a pixel into the histogram. Exemplary embodiments in which a level of confidence is used are shown in FIG. 17.
In exemplary embodiments of the present invention shown in FIG. 17, a masked image 171 may be formed 172 from an input image 170. The masked image 171 may be formed by checking a masking condition at each pixel in the input image 170. An exemplary embodiment shown in FIG. 18, illustrates the formation 172 of the masked image 171. If an input image pixel 180 satisfies 182 the masking condition, the corresponding pixel in the masked image may be assigned 186 a value, mask-pixel value, indicating that the masking condition is satisfied at that pixel. If an input image pixel 180 does not satisfy the masking condition 184, the corresponding pixel in the masked image may be assigned the value of the corresponding pixel in the input image 188. At pixels for which the masking condition is satisfied 182, a further assignment 185 of a confidence value reflecting the confidence in the mask signature signal may be made. The assignment of confidence value may be a separate value for the masked pixels, or the mask-pixel value may be multi-level with the levels representing the confidence. The masked image may mask pixels in the input image for which a masking condition is satisfied, and further identify the level to which the masking condition is satisfied.
In the exemplary embodiments of the present invention shown in FIG. 17, after forming 172 the masked image 171, a histogram 173 may be generated 174 for a block of the masked image 171. FIG. 19 shows an exemplary embodiment of histogram formation 174. A histogram with bins corresponding to the possible pixel values of the masked image may be formed according to FIG. 19. In some embodiments, all bins may be initially considered empty with initial count zero. The value of a pixel 190 in the block of the masked image may be compared 191 to the mask-pixel value. If the value of the pixel 190 is equal 192 to the mask-pixel value, then the pixel is accumulated 193 in the histogram at a fractional count based on the confidence value, and if there are pixels remaining in the block to examine 196, then the next pixel in the block is examined 191. If the value of the pixel 190 is not equal 194 to the mask-pixel value, then the pixel is accumulated in the histogram 195, meaning that the histogram bin corresponding to the value of the pixel is incremented, and if there are pixels remaining in the block to examine 197, then the next pixel in the block is examined 191.
When a pixel is accumulated in the histogram 195, a counter for counting the number of non-mask pixels in the block of the masked image may be incremented 198. When all pixels in a block have been examined 200, 199, the histogram may be normalized 201. The histogram may be normalized 201 by dividing each bin count by the number of non-mask pixels in the block of the masked image. In alternate embodiments, the histogram may not be normalized and the counter not be present.
An entropy measure 175 may be calculated 176 for the histogram of a neighborhood of the masked image as described in the previous embodiments. In the embodiments of the present invention shown in FIG. 17, after calculating 176 the entropy measure 175 for the histogram 173 corresponding to a block of the image centered at a pixel, the pixel may be classified 177 according to the entropy feature 175. The classifier 177 shown in FIG. 17 may be based on thresholding. A threshold may be determined a priori, adaptively, or by any of numerous methods. The pixel may be classified 177 as belonging to one of two regions depending on which side of the threshold the entropy measure 175 falls.
In some embodiments of the present invention, the masking condition may comprise a single image condition. In some embodiments, the masking condition may comprise multiple image conditions combined to form a masking condition.
In some embodiments of the present invention, the entropy feature may be used to separate the image into two regions. In some embodiments of the present invention, the entropy feature may be used to separate the image into more than two regions.
In some embodiments of the present invention, the full dynamic range of the data may not be used. The histogram may be generated considering only pixels with values between a lower and an upper limit of dynamic range.
In some embodiments of the present invention, the statistical entropy measure may be as follows:




  
    E
    =
    
      -
      
        
          ∑
          
            i
            =
            1
          
          N
        
        ⁢
        
          
            h
            ⁡
            
              (
              i
              )
            
          
          *
          
            
              log
              2
            
            ⁡
            
              (
              
                h
                ⁡
                
                  (
                  i
                  )
                
              
              )
            
          
        
      
    
  
  ,




where N is the number of bins, h(i) is the normalized (Σi=1Nh(i)=1) histogram count for bin i, and log2(0)=1 may be defined for empty bins.

The maximum entropy may be obtained for a uniform histogram distribution,




  
    
      h
      ⁡
      
        (
        i
        )
      
    
    =
    
      1
      N
    
  
  ,




for every bin. Thus,





  Emax
  =
  
    
      -
      
        
          ∑
          
            i
            =
            1
          
          N
        
        ⁢
        
          
            1
            N
          
          *
          
            
              log
              2
            
            ⁡
            
              (
              
                1
                N
              
              )
            
          
        
      
    
    =
    
      -
      
        
          
            log
            2
          
          ⁡
          
            (
            
              1
              N
            
            )
          
        
        .
      
    
  




The entropy calculation may be transformed into fixed-point arithmetic to return an unsigned, 8-bit, uint8, measured value, where zero corresponds to no entropy and 255 corresponds to maximum entropy. The fixed-point calculation may use two tables: one table to replace the logarithm calculation, denoted log_table below, and a second table to implement division in the histogram normalization step, denoted rev_table. Integer entropy calculation may be implemented as follows for an exemplary histogram with nine bins:



  
    
      
    
    ⁢
    
      
        log_table
        ⁡
        
          [
          i
          ]
        
      
      =
      
        
          2
          log_shift
        
        *
        
          
            log
            2
          
          ⁡
          
            (
            i
            )
          
        
      
    
  




  
    
      
    
    ⁢
    
      s
      =
      
        
          ∑
          
            i
            =
            0
          
          8
        
        ⁢
        
          hist
          ⁡
          
            [
            i
            ]
          
        
      
    
  




  
    
      
    
    ⁢
    
      
        rev_table
        ⁡
        
          [
          i
          ]
        
      
      =
      
        
          
            2
            rev_shift
          
          *
          
            255
            Emax
          
        
        i
      
    
  




  
    
      
    
    ⁢
    
      s_log
      =
      
        log_table
        ⁡
        
          [
          s
          ]
        
      
    
  




  
    
      
    
    ⁢
    
      s_rev
      =
      
        rev_table
        ⁡
        
          [
          s
          ]
        
      
    
  




  
    
      
    
    ⁢
    
      
        bv
        ⁡
        
          [
          i
          ]
        
      
      =
      
        
          hist
          ⁡
          
            [
            i
            ]
          
        
        *
        s_rev
      
    
  




  
    
      
    
    ⁢
    
      
        log_diff
        ⁡
        
          [
          i
          ]
        
      
      =
      
        s_log
        -
        
          log_table
          ⁡
          
            [
            
              hist
              ⁡
              
                [
                i
                ]
              
            
            ]
          
        
      
    
  




  
    E
    =
    
      (
      
        
          
            ∑
            
              i
              =
              0
            
            NBins
          
          ⁢
          
            (
            
              
                (
                
                  
                    bv
                    ⁡
                    
                      [
                      i
                      ]
                    
                  
                  *
                  
                    log_diff
                    ⁡
                    
                      [
                      i
                      ]
                    
                  
                
                )
              
              ⪢
              
                (
                
                  log_shift
                  +
                  rev_shift
                  -
                  accum_shift
                
                )
              
            
            )
          
        
        ⪢
        accum_shift
      
    
  



where log_shift, rev_shift, and accum_shift may be related to the precision of the log, division, and accumulation operations, respectively.

An alternate hardware implementation may use an integer divide circuit to calculate n, the normalized histogram bin value.



  
    n
    =
    
      
        (
        
          
            hist
            ⁡
            
              [
              i
              ]
            
          
          ⪡
          8
        
        )
      
      /
      s
    
  




  
    Ebin
    =
    
      
        (
        
          81
          *
          n
          *
          
            log_table
            ⁡
            
              [
              n
              ]
            
          
        
        )
      
      ⪢
      16
    
  




  
    E
    =
    
      
        ∑
        
          i
          =
          0
        
        NBins
      
      ⁢
      
        
          Ebin
          ⁡
          
            [
            i
            ]
          
        
        .
      
    
  



In the example, the number of bins is nine (N=9), which makes the normalization multiplier 255/Emax=81. The fixed-point precision of each calculation step may be adjusted depending upon the application and properties of the data being analyzed. Likewise the number of bins may also be adjusted.

In some embodiments of the present invention shown in FIG. 20, a masked entropy feature 213 may be generated 220 for a luminance channel 211 of the input image using the textCandidateMap as a mask 210. In some embodiments the luminance channel 211 used in the masked entropy feature calculation 220 may be the same resolution as the digital image. In other embodiments, the resolution of the luminance channel 211 used in the masked entropy feature calculation 220 may be of lower resolution than the digital image. In some embodiments of the present invention, the masked entropy feature may be low-pass filtered 221 producing an entropy measure, referred to as average entropy, with a larger region of support 214.
In some embodiments of the present invention, the luminance channel of a 600 dpi image may be down-sampled to 75 dpi and combined with a 75 dpi textCandidateMap to generate a 75 dpi masked entropy feature array, also considered image, by using an 11×11 moving window to calculated the masked entropy using any of the above disclosed methods. The resulting masked entropy feature array may then be filtered using a 3×3 averaging filter.
Pictorial regions 215 may be grown from the average entropy 214 using a double, or hysteresis, threshold process 223. In some embodiments, the upper threshold may be 200, and the lower threshold may be 160. The pictorial regions 215 grown 223 from the average entropy 214 may be indicated by a one-bit map, referred to as pictEnt.
The average entropy 214 and the map 210 used in the masked entropy calculation 220 may be combined 222 to form a one-bit map 216 indicating that a pixel is an uncertain edge pixel. If the average entropy at a pixel is high and that pixel is a text candidate, then the pixel may be a text pixel, or the pixel may belong to an edge in a pictorial region. The one-bit map 216, referred to as inText, may be generated according to the following logic: textCandidateMap & (aveEnt≧TH6). In some embodiments, TH6 may be 80.
The average entropy 214, the map 210, and a thresholded version of the edgeCnt 212 may be combined 224 to form a one-bit map 217, referred to as inPict, indicating if a non-text edge pixel pixel has a high likelihood of belonging to a pictorial region. The one-bit map 217 may be generated according to the following logic: (edgeCntTH& ̃textCandidateMap)|(aveEnt>TH7). In some embodiments TH7 may be 200.
The three results, pictEnt 215, inText 216 and inPict 217 may be combined in a pictorial region growing process 225 thereby producing a multi-value image whereby higher values indicate higher likelihood a pixel belongs to a pictorial region, PictCnt, 218. In some embodiments of the present invention, the pictorial region growing process 225 at each pixel may be a counting process using four neighboring pixels where the four neighbors may be the four causal neighbors for a scan direction. FIG. 21A shows the four pixel neighbors 231-234 of pixel 230 considered for a top-left to bottom-right scan direction. FIG. 21B shows the four pixel neighbors 241-244 of pixel 240 considered for a top-right to bottom-left scan direction. FIG. 21C shows the four pixel neighbors 251-254 of pixel 250 considered for a bottom-left to top-right scan direction. FIG. 21D shows the four pixel neighbors 261-264 of pixel 260 considered for a bottom-right to top-left scan direction. The counting process may be performed for multiple scan passes accumulating the count from each previous pass.
In some embodiments, four scan passes may be performed sequentially. The order of the scans may be top-left to bottom-right, top-right to bottom-left, bottom-left to top-right and bottom-right to top-left. In some embodiments, the value PictCnt(i, j) at a pixel location (i, j), where i may denote the row index and j may denote the column index, may be given by the following for the order of scan passes described above where the results are propagated from scan pass to scan pass.
Top-left to bottom-right:















maxCnt = MAX(PictCnt(i, j−1), PictCnt(i−1, j));



maxCnt = MAX(maxCnt, PictCnt(i−1, j−1));



maxCnt = MAX(maxCnt, PictCnt(i−1, j+1));



if (inPict(i, j) & pictEnt(i, j))









pictCnt(i, j) = maxCnt + 1;









else if (inPict(i, j) | pictEnt(i, j))









pictCnt(i, j) = maxCnt;









else if (inText(i, j)) {










cnt = PictCnt(i, j−1)
> TH ? 1 : 0;



cnt = PictCnt(i−1, j)
> TH ? cnt+1 : cnt;



cnt = PictCnt(i−1, j−1)
> TH ? cnt+1 : cnt;



cnt = PictCnt(i−1, j+1)
 > TH ? cnt+1 : cnt;









PictCnt(i, j) = maxCnt − (16 − cnt*4);









}



else









PictCnt(i, j) = 0;









PictCnt(i, j) = PictCnt(i, j) > 255 ? 255 : PictCnt(i, j);



PictCnt(i, j) = PictCnt(i, j) < 0 ? 0 : PictCnt(i, j);










Top-right to bottom-left:















maxCnt = MAX(PictCnt(i, j+1), PictCnt(i−1, j));



maxCnt = MAX(maxCnt, PictCnt(i−1, j+1));



maxCnt = MAX(maxCnt, PictCnt(i−1, j−1));



if (inPict(i, j) & pictEnt(i, j))









pictCnt(i, j) = maxCnt + 1;









else if (inPict(i, j) | pictEnt(i, j))









pictCnt(i, j) = maxCnt;









else if (inText(i, j)) {










cnt = PictCnt(i, j+1)
> TH ? 1 : 0;



cnt = PictCnt(i−1, j)
> TH ? cnt+1 : cnt;



cnt = PictCnt(i−1, j+1)
> TH ? cnt+1 : cnt;



cnt = PictCnt(i−1, j−1)
> TH ? cnt+1 : cnt;









PictCnt(i, j) = maxCnt − (16 − cnt*4);









}



else









PictCnt(i, j) = 0;









PictCnt(i, j) = PictCnt(i, j) < 0 ? 0 : PictCnt(i, j);



Bottom-left to top-right:



maxCnt = MAX(PictCnt(i, j−1), PictCnt(i+1, j));



maxCnt = MAX(maxCnt, PictCnt(i+1, j−1));



maxCnt = MAX(maxCnt, PictCnt(i+1, j+1));



if (inPict(i, j) & pictEnt(i, j))









pictCnt(i, j) = maxCnt + 1;









else if (inPict(i, j) | pictEnt(i, j))









pictCnt(i, j) = maxCnt;









else if (inText(i, j)) {










cnt = PictCnt(i, j−1)
> TH ? 1 : 0;



cnt = PictCnt(i+1, j)
 > TH ? cnt+1 : cnt;



cnt = PictCnt(i+1, j−1)
 > TH ? cnt+1 : cnt;



cnt = PictCnt(i+1, j+1)
 > TH ? cnt+1 : cnt;









PictCnt(i, j) = maxCnt − (16 − cnt*4);









}



else









PictCnt(i, j) = 0;









PictCnt(i, j) = PictCnt(i, j) < 0 ? 0 : PictCnt(i, j);










Bottom-right to top-left:















maxCnt = MAX(PictCnt(i, j+1), PictCnt(i+1, j));



maxCnt = MAX(maxCnt, PictCnt(i+1, j+1));



maxCnt = MAX(maxCnt, PictCnt(i+1, j−1));



if (inPict(i, j) & pictEnt(i, j))









pictCnt(i, j) = maxCnt + 1;









else if (inPict(i, j) | pictEnt(i, j))









pictCnt(i, j) = maxCnt;









else if (inText(i, j)) {










cnt = PictCnt(i, j+1)
> TH ? 1 : 0;



cnt = PictCnt(i+1, j)
 > TH ? cnt+1 : cnt;



cnt = PictCnt(i+1, j+1)
 > TH ? cnt+1 : cnt;



cnt = PictCnt(i+1, j−1)
 > TH ? cnt+1 : cnt;









PictCnt(i, j) = maxCnt − (16 − cnt*4);









}



else









PictCnt(i, j) = 0;









PictCnt(i, j) = PictCnt(i, j) < 0 ? 0 : PictCnt(i, j);










The pictorial likelihood, PictCnt, and the candidate text map, textCandidateMap, may be combined 226 to form a refined text map, rText, 219. The combination may be generated on a pixel-by-pixel basis according to: (PictCnt<TH8) & textCandidateMap, where in some embodiments TH8 is 48.
Embodiments of the present invention as shown in FIG. 2 may comprise a clean-up pass 24 after the entropy-based pictorial region discrimination and refinement of the text candidate map 22. The clean-up pass may comprise morphological operations on the refined text map, rText, using PictCnt as support information to control the structuring element.
In some embodiments, the lower resolution result from text cleanup process may be combined with higher resolution edge map to produce a high resolution verified text map.
The terms and expressions which have been employed in the foregoing specification are used therein as terms of description and not of limitation, and there is no intention in the use of such terms and expressions of excluding equivalence of the features shown and described or portions thereof, it being recognized that the scope of the invention is defined and limited only by the claims which follow.

## Claims

1. A method for identifying text in a digital image, said method comprising:
receiving a first feature data set comprising measurements of a first feature on a digital image;
receiving a confidence data set related to said first feature data set, wherein said confidence data set indicates a confidence level of the measurements of said first feature data set;
receiving digital image data related to said digital image;
calculating a pictorial feature for said digital image data using said first feature data set and said confidence data set;
forming a pictorial confidence image using said pictorial feature and said first feature data set; and
generating a text-map based on said pictorial confidence image.

2. A method as described in claim 1 wherein said pictorial feature is masked entropy.

3. A method as described in claim 1 wherein said first feature is an edge feature.

4. A method as described in claim 1 wherein said digital image data is a luminance image.

5. A method as described in claim 1 wherein the resolution of said digital image data is less than the resolution of said first feature data set.

6. A method as described in claim 1 further comprising generating a mask from said first feature data set and said confidence data set.

7. A method as described in claim 1 wherein said forming a pictorial confidence image further comprises hysteresis thresholding.

8. A method as described in claim 1 wherein said forming a pictorial confidence image further comprises a plurality of scan passes.

9. A method as described in claim 8 wherein said number of scan passes is four.

10. A method as described in claim 1 wherein said pictorial confidence image and said first feature data set have the same resolution.