Embodiments of the present invention comprise methods and systems for determining a background color in a digital image.
Many digital image processing enhancements that improve the visual quality of a digital image rely on the accurate identification of different image regions in the digital image. Additionally, accurate determination of various regions in an image is critical in many compression processes.
Embodiments of the present invention comprise systems and methods for determining a local background color for a pixel in an image by summarizing the color values in a color buffer wherein the color values in the color buffer have been selectively added to the color buffer from the image data based on criterion which may be related to edge density, image uniformity, non-local color information, foreground color estimate and other selection criterion.
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.
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.
Some embodiments of the present invention may comprise a limited-context raster method for estimating the local background color at a location in a scanned document image.
In some embodiments of the present invention, local background estimation may be based on color averaging. In alternative embodiments, other color estimators may be used. Exemplary estimators may comprise those based on a median, a weighted average, a trimmed mean and other estimators.
Some embodiment of the present invention may comprise dominant-color summarization within a region.
Some embodiments of the present invention may comprise estimation of a local background color at a pixel of interest based on image-data samples in a buffer, wherein the buffer may be populated by sampling a neighborhood of image data around the pixel of interest. These embodiments may be described in relation to
In some embodiments of the present invention described in relation to
In some embodiments of the present invention described in relation to
The use of edge detection results may prevent text colors in transition areas from contaminating the local background color estimate. However, the exclusion in the buffer of image data from edge locations may not reduce the negative effects of large font or bold text characters. Excluding the edge pixels from entry into the buffer may not exclude the interior pixels of large font characters from the averaging buffers used to estimate the background. For example, in the interior of large-type text, the color buffer may progressively be dominated by the text color, and the local background color estimate may eventually converge to the text color if enough samples are gathered to fill the color buffer.
To alleviate this problem, in some embodiments of the present invention described in relation to
In some memory-limited implementations of the present invention, filling and expanding may not be used.
In alternative embodiments of the present invention, an edge density measure based on a weighted, running difference of the number of edge pixels and non-edge pixels may be used as the selection criterion. This measure may attain a large value near an edge and may gradually decay as the distance from the edge increases. Pixels beyond a set distance away from any edge may be added to the color buffer and used in the local background color estimate.
An edge density signal may be computed from an input edge signal. At each pixel in the input edge signal, a neighborhood may be defined. Within this neighborhood, a summary edge-density signal may be computed. An incoming edge signal may be combined with the neighborhood density signal to form the output edge density signal. Repeating this process over a sequence of image locations may be used to generate an edge density signal at the pixels of interest where a local background signal may be computed.
In some embodiments of the present invention, the edge density measure, edgeden, for each pixel in an input edge signal may be calculated using the following steps:
1. Initialize edgeden values to a known level.
2. Then, for each pixel, (i,j):
Through the parameters wdecay and count_saturate, the edge density measure may control how far away from a highly confident edge region a pixel must be before its image value may be added to the buffer and therefore influence the local background color estimate. The parameter we may control the rate at which the edge density measure may obtain highly confident edge region verses sensitivity to noise in the edge detection. The longer the decay, the less likely interior glyph pixels for large or bold fonts will be added to local background color estimate. Conversely, the longer decay, the more pixels it will take for the local background color estimate to converge to a new local background color.
In some embodiments of the current invention, the edge data may be indexed first in left-to-right scan order to set edgeden values for a line, then the edge data may be indexed in right-to-left scan order to refine edgeden values. This may reduce the order dependence of the running sum and may decay the count from both sides of an edge.
In alternative embodiments of the current invention, a binary map of edge or text pixels may be received and pixels that may be labeled as edge or text pixels according to this binary map may be ignored in the background color summarization.
In alternative embodiments of the present invention described in relation to
In some embodiments, the uniformity measure may be selected such that textured backgrounds may be labeled as “unknown.” In alternative embodiments, the uniformity measure may be selected such that a textured region may be considered a background region.
In some embodiments of the present invention described in relation to
In some embodiments of the present invention, foreground pixels may be assumed to be darker than background pixels. In alternative embodiments of the present invention, foreground pixels may be assumed to be lighter than background pixels. Regions of glyph pixels and regions of text pixels exhibiting this relationship with their background pixels may be referred to as “normal-glyph” regions and “normal-text” regions, respectively. A region in which the local background color is lighter than the glyph color or a region in which the local background color is lighter than the text color may be referred to as a “reverse-glyph” region or a “reverse-text” region, respectively.
In some embodiments of the present invention described in relation to
where K may be the buffer size.
In the exemplary embodiment shown in
In some embodiments of the present invention, in a region identified as a normal-text region, higher weightings may be applied to higher-lightness selected data values. In these embodiments, lower weightings may be applied to lower-lightness values, as these may more likely be lower-lightness foreground pixels.
In alternative embodiments of the present invention, in a region identified as a reverse-text region, higher weightings may be applied to lower-lightness selected data values. In these embodiments, higher weightings may be applied to higher-lightness values, as these may more likely be higher-lightness, reverse-text, foreground pixels.
In some embodiments of the present invention described in relation to
In some embodiments of the present invention, input image data may be stream-based processed, and as data is passed through the system, limited context may be maintained to minimize memory usage and limit computation time. In these embodiments, a spatial pixel delay may be required to estimate a local background color relative to the pixel of interest passing through the system.
In alternative embodiments, prior analysis may be performed to identify the major background colors in the input image. An exemplary method for identifying major background colors is disclosed in U.S. patent application Ser. No. 11/424,297, entitled “Methods and Systems for Segmenting a Digital Image into Regions,” filed Jun. 15, 2006, which is hereby incorporated herein by reference in its entirety. In these alternative embodiments, a non-local signal may be used in selecting pixels for color summarization. In some embodiments, the major peaks in a global color histogram may be considered likely local background colors. A color buffer may be assigned for each major peak. During background color estimation, each pixel of interest may be analyzed to determine whether it is associated with a major peak. If the pixel of interest is associated with a major peak, then the buffer corresponding to that peak may be updated, and that buffer may be used to estimate the local background color for the pixel of interest. These embodiments may be described in relation to
In these embodiments, non-local color information 121 may be used by a data selector 122 to determine if an image data value 120 may be added to a color buffer (three shown) 125, 126, 127. The data selector 122 may determine a color-buffer selection signal 123. A local background color estimator 124 may comprise a plurality of color buffers (three shown) 125, 126, 127 and a buffer summarization calculator 128. The buffer summarization calculator 128 may summarize the color data values of the selected color buffer 125, 126, 127. In some embodiments the buffer summarization calculator 128 may comprise a mean calculation, a trimmed-mean calculation, a median calculation, a weighted mean calculation, a weighted trimmed-mean calculation and other estimators. In some embodiments, the non-local color information may comprise peak color values derived from a histogram of the image data.
In some embodiments of the present invention, only pixels whose color is close to a major histogram peak may be added to a color buffer. In these embodiments, the spatial pixel delay required to converge to the local color value may decrease since the colors in the buffer may already be similar to the current pixel of interest.
In some embodiments of the present invention, image data may be buffered and processed multiple times using different scan directions in each processing pass. In some embodiments, multiple lines of a raster image data may be streamed into a processor or ASIC twice: first in raster order and subsequently in reverse raster order. The multiple local background estimates determined from multiple processing of the image data may be reconciled to produce a single estimate at each pixel of interest. In one embodiment each estimate may be used by subsequent processes. In an alternative embodiment, the pixel estimate may be determined by choosing the color estimate closest to the color of the pixel.
In some embodiments of the present invention described in relation to
In these embodiments, a background data selector 142 may select image data 140 based on a selection criterion that incorporates a current foreground color estimate 149. The selected data may be entered into a background color buffer from which a background color estimator 144 may produce an estimate of the local background color 145. In some embodiments of the present invention, the background color estimator 144 may comprise a background color buffer and a buffer summarization calculator. In alternative embodiments of the present invention, the background color estimator 144 may comprise a plurality of color buffers wherein each color buffer may correspond to a peak in a color histogram of the image data 140. In these embodiments, the background data selector 142 may comprise a color-buffer selector. In some embodiments of the present invention, image data 140 that is close in color value to the current foreground color estimate 149 may not be selected by the background data selector 142 for entry into a color buffer. In alternative embodiments, image data 140 that is close in color value to the current foreground color estimate 149 may be weighted less heavily by the background color estimator 144 than image data 140 that is not close in color value to the current foreground color estimate 149.
In some embodiments of the present invention, the foreground color estimate 149 may be determined by a foreground color estimator 148 based on a summary of image color values in a foreground color buffer. A foreground data selector 146 may select image data values 140 that exhibit foreground characteristics for entry into the foreground color buffer.
In some embodiments of the present invention, color similarity may be measured using a distance measurement between color values. Exemplary color-distance measures may comprise an L1 norm, an L2 norm, a 2-dimensional city block distance measure between the chroma components of a luma-chroma-chroma color space representation, a 3-dimensional city block distance measure between the components of a 3-dimensional color space representation, a Euclidean distance measure, a weighted 2-dimensional city block distance measure between the chroma components of a luma-chroma-chroma color space representation, a weighted 3-dimensional city clock distance between the components of a 3-dimensional color space representation and other well-known-in-the-art distance measures.
In some embodiments of the present invention, which pixels contribute to a background estimation buffer may be restricted based on a criterion or combination of criterion as described above. In alternative embodiments of the present invention, each buffer entry may be associated with a weighting factor.
In some embodiments of the present invention, the background color estimator may comprise a summarization method which may be biased based on features computed from the background and/or foreground color estimates. In some exemplary embodiments, when the foreground color is lighter than the background estimate, which may occur in a reverse-text region, then the background estimate may be biased darker, and the foreground estimate may be biased lighter. In other exemplary embodiments, when the foreground color is darker than the background color, which may occur in a normal-text region; then the background estimate may be biased lighter, and the foreground estimate may be biased darker.
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.