Text improvement

In a method of text improvement, image text in an image is detected (SW, Det), the image is scaled (Scal) to adjust first numbers of pixels per line and lines per image of the image to second numbers of pixels per line and lines per image that fit in with a display (D) on which the image is to be displayed, and the image is processed (Post-proc) in dependence on a result of the text detection.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to a method and device for text improvement.

2. Description of the Related Art

The article “Thresholding and enhancement of text images for character recognition”, by W. W. Cindy Jiang, IEEE, Proceedings of the international conference on acoustics, speech, and signal processing (ICASSP), NY, vol. 20, 1995, pp. 2395–2398, discloses a scheme which converts graytone text images of low spatial resolution to bi-level images of higher spatial resolution for character recognition. A variable thresholding technique and morphological filtering are used. It is stated that most optical character recognition systems perform binarization of inputs before attempting recognition, and that text images are usually supposed to be binary.

The article “A segmentation method for composite text/graphics (halftone and continuous tone photographs) documents”, by S. Ochuchi et al., Systems and Computers in Japan, Vol. 24, No. 2, 1993, pp. 35–44, discloses that when processing composite documents for digital copy machines and facsimile which contain a mixture of text, halftone and continuous tone photographs, ideally, the text portion can be separated from the graphics portion and more efficiently represented than the multi-bit pixel bitmap graphics representation.

Nowadays, digital display devices are more and more frequently matrix devices, e.g., Liquid Crystal Displays, where each pixel is mapped on a location of the screen having a one-to-one relationship between raster data and display points. This technology implies the usage of a scaling system to change the format of the input video/graphic signal so that it satisfies the size of the device, i.e., the number of its pixels. The scaling block is based on a filter bank that performs pixel interpolation when the zooming factor is varying. Actually available solutions on the market apply an undifferentiated processing on the graphic raster that leads to results with unavoidable artifacts. Usually, low-pass filters reduce pixellation, also know as the seesaw effect, on diagonals, and prevent the signal from suffering from aliasing due to the sub-sampling, but they also introduce other annoying effects, such as, blurring the images. It depends on the content of the displayed signal, the relevance of the perceived artifacts and the kind of artifacts that have to be preferred as unavoidable.

SUMMARY OF THE INVENTION

It is, inter alia, an object of the invention to provide a simple text improvement for use with displays that require a scaling operation.

Starting from the above-mentioned observations, a novel technique is provided here that is able to take into account the image content and to apply an ad hoc post-processing only where it is required. Hence, in accordance with the present invention, text improvement after the scaling operation is based on text detection before the scaling operation. The processing is active only in presence of text region. A viable area of application of this invention is the text readability improvement in the case of LCD devices, when, and it is usually the case, we do not want to affect other parts of the displayed signal.

A remarkable characteristic of the technique presented here is its really low computational complexity. This aspect determines a high effectiveness in terms of cost/performances ratio. In fact, the insertion of the proposed algorithm into the other circuitry that carries out all the digital processing needed for resizing the matrix display device input, presumably raises the display quality, according with the average user perception, without considerable affecting its cost.

It is noted that while in one embodiment, a binarization takes place, this binarization is only carried out in regions where text has been detected, while in the prior art, the binarization is a preliminary step to be carried out before characters can be recognized.

These and other aspect of the invention will be apparent from and elucidated with reference to the embodiments described hereinafter.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The invention proposes the design of a text detection algorithm, together with a post-processing block, for text enhancement. It will be shown that the invention significantly improves the performance in terms of content readability and leads to good perceptual results of the whole displayed signal, while keeping really low the computational complexity of the total scaling system.

The organization of the remainder of this document is as follows. First the general scaling problem and the current available algorithms are briefly summarized. Thereafter concepts concerning format conversion by a non-integer factor will be introduced. Successively, the post-processing block, characterized by the thresholding operation and the morphological filter, will be summarized and its features will be described. Finally the text search strategy will be presented and the detection algorithm and its cooperation with the previously introduced post-processing block will be elucidated.

The General Framework

Resizing pictures into a different scale requires format conversion. This operation involves well-known re-sampling theory, and classical filter procedures are currently used to accomplish it. Filters avoid aliasing problems in frequency, freeing room for the repetitions introduced by the sampling operation in the original domain. Among the interpolation filter families, polynomial interpolators of first order are commonly used, in which the reconstructed pixel is a weighted mean of the nearest pixels values. These kinds of filters are also called Finite Impulse Response (F.I.R.) filters.

Inside standard display devices, the format conversion problem is usually faced with linear filtering too. A particularly simple class of F.I.R. filters reconstructs pixels in between two available ones tacking the value on the line joining these two adjacent points.

There are many other possible techniques. For example, pixel repetition or polynomial interpolation with more complex weighting functions. The quality perception of images processed with these different solutions is generally not really high, there are impairments and artifacts that are not completely avoidable. This consideration implies that some compromise is due in order to reach an acceptable or, at best, a satisfactory cost/performance ratio.

In the past, the simplest solution solved the problem using pixel repetition. A more recent solution, see the Philips scaler PS6721, still uses linear filtering but with a slight different shape of the impulse response, to improve the transition steepness.

Measuring the rise time of the step response is a classical way to assess the performance of the interpolator in presence of an edge. In fact, low-pass filters affect edge steepness and a smooth steepness is perceived as a blurring effect.

Moreover, the actual impact of this annoying artifact depends on the kind of displayed signal. Actually, in case of natural images, a blurring effect could be tolerated in a certain measure.

Whereas, for artificial patterns, a slight smoothness effect is recommended only when the content requires approaching a natural impression (this is the case of virtual reality and 3D games). In this case, filtering is used as an anti-aliasing process. For the same reason, these kinds of filters are used on text/characters to avoid the pixellation effect, also know as the seesaw effect, on diagonals. Interpolation filters are anti-aliasing filters too, because they reduce the highest frequency of the input signal. Moreover, supposing to have a black text on a white background, the amount of gray levels introduced by this kind of filters should be a less percentage of the black quote. If it is not the case, we have an artifact instead of a picture improvement, and images are perceived as blurred. For instance, when bilinear interpolation as well more sophisticated filters, like the bicubic ones, are used on small characters (the commonly used size 10.12 points) and thin lines, they appear defocused. In all these cases, it seems better to use no filters at all, at least no low-pass filters as are actually available.

Starting from the above consideration, we can conclude that, because format conversion requires resampling, so that the filtering process is unavoidable, to accomplish with the above issue we have to find out some other solution. In case of text, a simple idea is to apply a post-processing block after the scaler to clean all the gray levels where characters are detected. Because of the scale change, this operation could not be performed using only a simple threshold block. In fact, threshold is a non-linear operator that introduces non-uniform patterns when it converts gray levels characters to binary values, another kind of artifact that is highly noticeable. Morphological filters are an interesting class of operators that are able to change non-regular patterns into more regular ones. They will be introduced in a following section.

Format Conversion by a Rational Factor

In today's digital display devices, images are frequently represented with a matrix of pixels requiring a fixed picture format. When a signal with a different format arrives at the input of a matrix display, format conversion is unavoidable. If a graphic card had generated the signal, then selecting a different graphic format, instead of the one used by the display, depends on the requirement of the software application running. At the moment, it is not advisable to constraint the graphic card output only with the requirement of the display.

We recall that standard today's graphic formats are VGA, SVGA, XGA, SXGA and higher. Format conversion between these raster sizes requires, in almost all cases, a resealing by a rational factor. This, by itself, leads to a sensible degradation of the resampled picture. In fact when, for example, we need to change format from VGA at display's input to XGA at display's output, the factor involved would be 8/5, equal to 1.6 times the size of the original picture. This format conversion ratio would clearly require a sub-pixel resolution, but with standard linear filtering techniques, this is not possible without paying a high blurring cost.

Let s(i,j) be the input signal at position (i,j) in the input grid, and ŝ(ĩ,{tilde over (j)}) be the signal after format conversion at position (ĩ,{tilde over (j)}) in the thicker output grid. In the case of a resealing from VGA to XGA, i.e., by an 8/5 factor, for every 5 pixels at the input of the sampler there will be 8 pixels at its output. A resealing by a rational factor conceptually relies on an intermediate “super-resolution” grid obtained using a zooming factor equal to the numerator, in the example 8. In this case, the “super-resolution” grid will be eight times thicker than the original one. Tacking two input values, s(i,j) and s(i+1,j), on the same line j at position i and i+1, the interpolated value ŝ(ĩ,{tilde over (j)}) will be positioned in between the two original values in the super-resolution gird, i.e., in one of the eight possible positions available on the grid. This fact is expressed by the following equation:

s^⁡(i+k8,j)=w1·s⁡(i,j)+w2·s⁡(i+1,j)⁢⁢∀⁢k∈[0⁢⁢…⁢⁢7]
Where, for the linear interpolator:

{w1=δw2=1-δ
k is the position of the pixel in the dense grid, the position also being called filter phase. In a linear filter, the position is δ∝k, and δ is the distance between the pixel to be interpolated with respect to the two adjacent original ones. The signal at the output grid will be obtained tacking values on a grid 5 times weaker. The sub-sampled signal at the output is expressed as follows:

s*⁡(i+5·k8,j)=w1·s^⁡(i+k_8,j)⁢⁢k_∈⁢[0⁢⁢…⁢⁢7]
Because the output grid is not a multiple of the input grid, often original pixel values will be lost and they will be replaced with an average value according to the above. If the input pattern is a black and white text, its pixels will be frequently replaced by a weighted average of their values, a gray level.
Text Improvement Via Thresholding

A threshold operator placed at the output of the scaling filter will recover a black and white pattern, or, more generally, a bicolor one, choosing the threshold nearest value according to the following relationship:

It should be noted that, in case of black/white and bicolor patterns, the threshold function could be integrated in the filter operator, setting lkand lwin accordance with the actual filter phase. In this way, the threshold operation recovers original bicolor levels from the interpolated ones according with theirs new positions. In regions where the amount of gray levels introduced is too high, this simple operator improves the sharp edge perception. Anyway, this is paid with the introduction of irregular patterns. In the next section, a solution to this problem is presented.

Morphological Filtering Algorithms

The introduction of mathematical morphology to solve the problem of text deblurring is due to the fact that a morphological filter, working both as a detector and as a non-linear operator, is able to eliminate gray levels without destroying the character regularity. Moreover, in case of bicolor patterns, a morphological filter is able to recover a specified regularity where required.

In general, the detector, called structuring element, is a small matrix (usually 2×2 or 3×3). It can recognize a particular pattern on the data, in our case, the rasterized image's pixels at the display output, and substitute that pattern with a different set of requested values.

When the morphological filter is used after the threshold block, on a bi-level pattern, the structuring element will work as a binary mask on the underlying data, performing a set of logical operations between the bit of the running matrix and the bit of the scanned data. An output equal to 1 will signify that a specified pattern has been identified.

A particular operator belonging to the morphological filter family, also called “diagonal” filter, applies the following set of logical operations to the data:

Y=X4⋃(P1⋃P2⋃P3⋃P4)P1=(X4c⋂X7⋂X6c⋂X3)P2=(X4c⋂X3⋂X0c⋂X1)P3=(X4c⋂X1⋂X2c⋂X5)P4=(X4c⋂X5⋂X8c⋂X7)
Here, X0. . . X8is the set of data currently analyzed by the structuring element. In addition, in case of binary data, ∪ is the classic logical OR operator and ∩ is the classic logical AND operator. The structuring element orders the data in its framework as shown inFIG. 1.

The output, y, after the set of logical operations introduced above, replaces the previous value at the origin of the data matrix, X4inFIG. 1. It should be noted that, if the result of P1∪P2∪P3∪P4is 0, then X4remains unchanged, if, instead, the result if 1, then X4is always replaced by 1.

Looking carefully, it will be evident that the set P1, P2, P3, P4of logical operations corresponds to the detection of the patterns shown inFIG. 2. Patterns inFIG. 2are diagonal patterns of black and white pixels, in case of binary images. In accordance with the above relations, when one of these configurations is found, then, in the origin of the detected region identified by a circle inFIG. 2, a 0 value is substitute by a 1. This operation, in terms of pattern effect, fills holes in diagonal configurations.

It should be noted that the same operation could be done, instead of using logical operators, with a LUT addressed by the configuration of bits in the structuring element. When the cells of the element are ordered according toFIG. 2, this configuration has the following address:

where each Xiis correspondingly equal at 1 or 0 according with the value in the ithposition of the matrix. To fill holes, the LUT at position XXX10X01X, 01X10XXX, X10X01XXX, XXXX01X10, will be set at 1, in all of the other positions, it will be set at 0. Here X means “don't care”.

From a conceptual point of view, because of the holes filling function of the “diagonal” structuring element, the set of operations described above on a structuring element, are equivalent to changing a diagonal patterns, anyhow oriented in a matrix, with a uniform block. This concept is clarified inFIG. 3.

Block Diagram of System Embodiment

FIG. 4shows a block diagram of the total system in which the main concept of the architecture for the detector and the post-processing block are drawn. An input image InIm s is applied to a Search Window part SW and Text Detector part Det. The input image InIm s, possibly modified in some region by the text detector part Det, is applied to a scaler Scal, if recognized as text by the text detector part Det, such as the commercially available scaler PS6721. The scaled image from the scaler Scal is applied to a post-processing part Post-proc that produces the output image OutIm s*.

Search Window and Text Detector

The search window and text detector is a key operator. In fact, it depends on if the input signal will be binarized and further processed or simply filtered with the linear scaler. According to what was previously stated, detection is specifically designed to recognize text patterns. When the required constraint imposed at the detector are not satisfied, the signal does not eventually benefit from further processing step. Detection is performed with a local sensor that recognizes the amount of colors in a small region. So, in principle, it works as a search window that scan the raster image to discover text areas.

To design it, satisfying a low memory cost, a fixed vertical width was used, equal to 3 lines on the domain of the original signal. Instead, its horizontal depth varies according to the image characteristics, and it is based on a simple growth criterion defined using some intuitive assumptions on the text properties. Currently assumptions on graphic text are as follows:

1. A text area is a two-color region in which text is one color and the other color is the background.

2. In a text area, a text color is perceptually fewer present than a background color.

3. A text region has a reasonable horizontal extension.

These assumptions determine the constraints on the patterns the detector recognizes as text regions. As can be seen, neither filtered text nor not-uniform background are recognized as text regions. This is a reasonable assumption because the threshold operator in these cases would introduce more artifacts than benefits. Furthermore, the imbalanced percentage of the two colors prevents the detector from identifying, as text, two color regions with potentially dangerous patterns. An example is the chess pattern, quite recurrent, for example, in window folder background. Finally, the third condition prevents identifying as text regions small bicolor fragments of the raster signal, that could presumably be border or other small pieces of graphic objects.

The conditions introduced above are used to define some parameters to adjust the behavior of the detector such that it may reach the best performances. Consider now the above introduced input raster signal s(r,c) at position (r,c). The search window will be indicated with q(r,c), with (r,c) being the coordinates of the block's origin that identify its reference pixel in the image; the relative coordinates, identifying a cell in the search window, are referred to the block origin and they will be noted as (i,j). Furthermore, the detector height and width will be indicated with h and w. While w is a varying parameter, on the contrary, h is fixed, to satisfy line memory constraints, and its value is currently h={overscore (h)}=3.

Let Ncbe the number of colors detected in the search window. According to the previously described block growing, the width w will increase following this search strategy:

{w⁡(k+1)=w⁡(k)+1if⁢⁢Nc≤2w⁡(k+1)=w⁡(k)=wif⁢⁢Nc>2
Nc>2 is the exit condition from the growing search strategy. When the exit condition is verified, the system will return the final block width w.

Together with the block growing process, two color counters will be incremented at each new step k. It should be noted that a step k corresponds to the evaluation of a new input pixel in the horizontal direction. Calling y1the number of pixels with color c1and y2the number of pixels with color c2, the counters will be upgraded in accordance with the corresponding block growing step in the following manner:

{γ1⁡(τ+1)=γ1⁡(τ)+1if⁢⁢q⁡(i+w⁡(k+1),j+h)=c1⁢⁢for⁢⁢h=1⁢…⁢⁢3γ1⁡(τ+1)=γ1⁡(τ)otherwise
and

{γ2⁡(τ+1)=γ2⁡(τ)+1if⁢⁢q⁡(i+w⁡(k+1),j+h)=c1⁢⁢for⁢⁢h=1⁢…⁢⁢3γ2⁡(τ+1)=γ2⁡(τ)otherwise
τ=3·w(k+1)+h is a new counting step in the search window, a new pixel evaluated using the growing window at item k.

Finally, the last parameter ξ, representing the ratio between the two colors counters, is introduced once the background is identified, according to the following relationship:

Once the algorithm is exited from the search strategy, the detection window is available to identify its content.

As mentioned above, a first condition to be satisfied, so that a region can be recognized as text, is that the block has a reasonable extension. Let:
{overscore (ε)}=min w
the minimum value, in terms of pixels, allowed for a region to be recognized as text region. The condition to be satisfied by a text region will be:
w≧{overscore (ε)}
The current value fixed for the parameter {overscore (ε)} is: {overscore (ε)}=300.

Recalling that ξ is the ratio between the background and the text colors, a second condition to be satisfied, so that the block would be recognized as a text area, will be:
ξ≧{overscore (ξ)}
where {overscore (ξ)} is a modifiable parameter actually fixed as {overscore (ξ)}=1.2. In other words:
if ξ<{overscore (ξ)}q[•] not a text window

The block will be discarded as not a text block when one of the above conditions are not satisfied. The new search window will be q(r,c+w) and it will start at position (r,c+w) in the original image, or (r+3,c) depending if, in the previous step, the end of line was reached.

Following this strategy, the entire image will be scanned by the search window and text region will be detected. As text is detected, the previously described post-processing operations will be applied.

Going back toFIG. 4, an input image is first subjected to a block-growing process BlGr based on whether the number of different colors does not exceed 2 (Nc<2), a first indication for the presence of text. As soon as the number of colors exceeds 2, the block growing process BlGr is stopped, and the other parameters Outpar are determined, which represent the three criteria for text listed above. Based on these parameters Outpar, it is determined whether there is a text region (Txt reg ?). If so, the background color cbackgroundis set to white, and the text color ctextis set to black.

The resulting image is subjected to the scaling operation SCAL.

After the scaling operation SCAL, the text region is subjected to a thresholding operation (threshold), the output of which is applied to a morphological filter (Morph. Filt.). Thereafter, white is set back to the background color cbackground, and black is set back to the text color ctext. The result of this operation forms the output image OutIm s* that is displayed on a matrix display D.

A primary aspect of the invention can be summarized as follows. A novel technique is suggested which is able to take into account the image content and to apply an ad-hoc scaler post-processing only where it is requested. A viable area of application of this invention is the text readability improvement in the case of LCD devices, when, as is usually the case, we do not want to affect other part of the displayed signal. It is, inter alia, an object of the invention to provide an ad hoc simple text detector. The invention proposes the design of a text detection algorithm, together with a post-processing block, for text enhancement. The invention significantly improves the performance in terms of content readability and leads to good perceptual results of the whole displayed signal, while keeping really low the computational complexity of the total scaling system. The invention is preferably applied in LCD scaler ICs.

REFERENCES