# Patent

## Title
System and method for enhancing the legibility of images

## Abstract

A system and method are described for enhancing readability of scanned document images by operating on each document individually. Via principle component analysis, edge detection and local color contrast computation, an automated method removes image background noise and improves sharpness of the scripts and characters.

## Background
BACKGROUND OF THE INVENTION
All documents that are not properly preserved suffer degradation over time, and even the most rigorous preservation techniques can only slow degradation of physical documents. Degradation can occur for a variety of reasons, such as time, improper storage, poor environmental conditions, damage, and so on. Documents vulnerable to such stresses and degradation can contain valuable information, as in the case of found military/terrorism-related documents, historical documents, scanned legal documents, etc. Computerized scanning and imaging of such documents can “freeze” the state of the document at the time of imaging. The invention described enhances the frozen state, that is, increases the legibility of the document.
Additionally, some, documents are not highly legible at creation. Such, conditions can occur due to improper typing, improper writing, or improper media. The legibility of these documents can likewise be enhanced.
SUMMARY OF THE INVENTION
Embodiments of the invention may be implemented by systems using one or more programmable digital computers and computer readable storage media. Disclosed are systems, methods, and computer readable storage products for performing a process on an image, the process being implemented by a computer system comprising at least one data storage device in which is stored image data, at least one computer and at least one computer readable medium storing thereon computer code which when executed by the at least one computer performs a method, the method comprising the at least one computer performing a set of operations on an image that renders the image from a first state to a second state, wherein the second state is more legible than then the first state. In an embodiment, the method comprises the at least one computer: converting the image into a grayscale image; isolating a plurality of pixels near an edge; isolating locally dark or light pixels; computing an intersection between the edge detected image output and the locally dark or light image output and outputting a combined black and white image; and cleaning the outputted combined image.
The isolating the plurality of pixels near an edge can further comprise: performing edge detection on the image; applying a smoothing operation to the image; computing the local color contrast for each pixel in the smoothed image; and isolating the pixels with high local color contrast.
The edge detection can be performed by any edge detection known in the art, including for example a Sobel operation, Canny, Canny-Deriche, Differential, or Prewitt Roberts Cross. The edge detection smoothing operation can be performed by any smoothing operation known in the art, including for example applying a Bilateral Filter.
The computation of the pixel's local color contrast from, the smoothed image can comprise: performing a local standard deviation (StdDev) operation on the smoothed image. The local StdDev operation can comprise, for each pixel of an image: identifying-a square window around a home pixel; computing the standard deviation (StdDev) of the color values within the window of pixels; storing the StdDev color value of the pixel, and normalizing the computed StdDev values such that the values range from 0 to 255. As will be appreciated, other statistical measures known in the art can be applied.
The isolating pixels with a high local color contrast can comprise: performing clustering on the locally contrasted image. The clustering operation can be any known clustering method in the art, for example such as Otsu's Method or K-means clustering.
The isolating pixels with locally dark or light pixels can comprise: for each pixel of the original grayscale image: identifying a square window of the pixels centered around a home pixel, wherein the window is larger than a square window used when isolating the plurality of pixels near an edge; perform a clustering operation to the defined square window of pixels; and save the black or white color value of the home pixel. For example, the square window used for isolating locally dark or light pixels can be about 25% larger than the square window used to isolate pixels that are near an edge. The clustering operation can be known clustering methods such as, for example, Otsu's Method or K-means clustering.
The cleaning of the outputted combined image can comprise: removing stray pixels from a black and white image; and correcting any erroneous plateaus.
The removing of stray pixels from the black and white image can comprise, for each window of at least 9 pixels: counting the number of black pixels within the window; counting the number of white pixels within the window; detecting if a threshold number of pixels within the window are the opposite color of the home pixel; and if so, changing the color value of the home pixel to the opposite color value. The color value threshold can be at least 7 pixels.
Correcting erroneous plateaus can comprise, for identified plateaus: computing the mean and standard deviation of the original pixel colors in an island portion of the identified plateau; computing the mean and standard deviation of the original pixel colors in a border portion of the identified plateau; performing a statistical test on the plateau to determine if the island portion of the plateau is part of the border portion of the plateau; and if the island portion of the plateau is a part of the border portion of the plateau, correcting the identified erroneous plateau so the island portion and the border portion of the plateau are the same color value.



BRIEF DESCRIPTION OF THE DRAWINGS
FIGS. 1A-1G are flow charts presenting a computerized image processing method of enhancing the legibility and clarity of image data for documents.
FIG. 2 shows an example of an original color image and a corresponding converted grayscale image.
FIGS. 3A-3D shows exemplary views of intermediate image inputs and outputs.
FIG. 4 shows a grayscale image and the set of locally dark pixels identified from that grayscale image.
FIG. 5 shows image outputs and the combination of the output images.
FIG. 6 shows a plateau and its surrounding boarder.
FIGS. 7A-7B show comparisons of an original image and processed enhanced images with a manually created goal solution image.
FIGS. 8A-8D show original images compared against final enhanced images.
FIG. 9 shows an exemplary computer system and architecture for carrying out the method for image enhancement.
FIG. 10 shows an exemplary network environment for carrying out the method for image enhancement.



DETAILED DESCRIPTION OF EMBODIMENTS
Embodiments of a system and method for enhancing readability of scanned document images are described herein. Embodiments as described herein operate on each document image individually, hence are completely data parallel. In certain embodiments of the disclosed invention no training data or document model is required unlike other approaches that require training data or a document model. Via principle component analysis, edge detection and a local color contrast computation, an automated (namely, user independent) method removes image background noise and improves sharpness of the scripts and characters.
In embodiments disclosed herein, document image enhancement is training set independent, document model independent, and document language agnostic. Embodiments are applicable to any application that processes scanned documents. These include the processing of found military/terrorism-related documents, historical documents, scanned legal documents, etc. In short, this method can be applied to any corpus of documents that are degraded. In various embodiments, at least one degraded image (e.g., due to degradation over time and/or due to improper storage) is provided as input and at least one black and white image clearly showing the content of the pre-degraded input image, including content intended to be readable or legible is derived as output.
It is to be understood that the figures and descriptions of the present invention are simplified to illustrate elements that are relevant for a clear understanding of the present invention, while eliminating, for purposes of clarity, many other elements which are conventional in this art. Those of ordinary skill in the art will recognize that other elements are desirable for implementing the present invention. Since such elements are well known in the art and do not facilitate a better understanding of the present invention, a discussion of such elements is not provided herein.
The present invention will now be described in detail on the basis of exemplary embodiments.
One embodiment discloses a method comprising: performing an automated (user independent) process on an image that renders the image from a first state to a second state, wherein the second state is more legible than the first state, wherein the process segregates dark pixels from light pixels. The analysis includes methodology and system configuration that embodies the assumed “truths” that (1) “writing” or “script” will be darker than the local pixels (i.e., background), and (2) “writing” or “script” should generate a detectable edge. Therefore, the logic takes advantage of these truths to find pixels within the scanned images that are both (1) darker than their neighbors and (2) near an edge. As will be understood, the first truth can be inverted for “negative” images, such as images of lithographs or negatives, in which case script is lighter than local pixels and the script will generate a detectable edge. As used herein, script or writing is to be construed broadly as any land of symbol, figure, script, icon, drawing, and so on Intended to be legible.
FIGS. 1A-1G are flow charts presenting a method of enhancing the legibility and clarity of image data for documents according to an embodiment of the invention. The method is configured to work on an image, as for example a degraded image, that is input into an image database as an image file (e.g., by scanning, digital photograph, etc.). An image as used herein is discussed on an image by image basis, (e.g., page by page), where each image is a “page” of a document in an image database; however, an original image should be broadly understood as a conventional image consistent with that as understood in the art. At FIG. 1A is shown a high level flow for embodiments whereby the system and method is configured to isolate script pixels based that are (a) proximate to an edge and (b) are either locally dark or locally light. In the embodiments described herein, locally dark pixels are isolated, however, as will be appreciated, the methods and systems can be readily configured to isolate and filter locally light pixels (e.g., for a negative).
In an embodiment, the method for performing a process on an image, is implemented by a computer system performing the method, the method comprising the at least one computer performing a set of operations on an image that renders the image from a first state to a second state, wherein the second state is more legible than then the first state, the operations comprising:

    
    
        converting the image into a grayscale image 20;
        isolating a plurality of pixels near an edge 21;
        isolating locally dark (or light) pixels 33;
        computing an intersection between the edge detected image output and the locally dark (or light) image output and outputting a combined image 34; and
        cleaning the outputted combined image 35.
    
    


With reference to FIG. 1A, at block 20, if the original image is in color, the image is first prepared by rendering into a grayscale image using methods and techniques known to ordinarily skilled artisans. For example, a conventional technique for converting a color image to a grayscale image is using the standard Linear Algebra technique known as Principle Component Analysis (PCA). Note that other techniques known in the art can be used to produce viable grayscale images. This step need not be implemented if the original image is in grayscale. An original image has Width w and Height h, resulting in n total pixels (n=w*h) for the image. For a color image, each pixel is a 3-dimentional (3-d) vector: Pixel, =(redi, greeni, bluei). The system is configured to flatten or compress the n 3-d vectors into n 1-d vectors, that is, into numerical values. The result is n numbers, one for each pixel. If PCA is used to generate the corresponding grayscale, image, namely to compute n numbers, PCA is performed on the n 3-d vectors of the image retaining only the first component (i.e., retaining only the most significant dimension). The resulting numbers are normalized to range from 0 to 1. These normalized numbers are then scaled from “black” to “white,” resulting in a grayscale image of the original color image. An example of an original color image 200 being converted to a grayscale image 202 by PCA is shown at FIG. 2. As noted before, other transformations known in the art can be used.
Referring to FIG. 1A, at block 21 a pixel area for each pixel of the image is processed to isolate a plurality of pixels near an edge. In an embodiment shown in FIG. 1B, the method for isolating the plurality of pixels near an edge further comprises:

    
    
        performing edge detection on the image 22;
        applying a smoothing operation to the image 23;
        computing the local color contrast for each pixel from the smoothed image 24; and
        isolating the pixels with high local color contrast 29.
    
    


Turning to FIG. 1B, taking the grayscale image, at block 22, the method comprises determining if a pixel is proximate to an edge, an embodiment of which is shown at FIG. 1C. As shown at block 22 of FIG. 1B, the determination comprises performing edge detection on the grayscale image 202. Edge detection can be carried out using edge detection techniques known to ordinarily skilled artisans. As will be appreciated, image edge detection is a well-documented image processing topic, and includes techniques such as Sobel Operators, Canny Edge Detection, including Canny, Canny-Deriche, Differential, Sobel, Prewitt Roberts Cross, and others. In one embodiment, a Sobel Operation is performed. Edge detection works by computing or estimating a local color gradient for pixel areas. If the gradient is steep, edge detection proceeds on the basis that as colors or shades are changing quickly, there is an “edge.” FIG. 3A shows a magnified view of a portion of the image input of grayscale image 202a, and the image output 206 after the determination edge detection is run using Sobel Edge detection. The resulting image lightens the areas where the shades are not changing quickly; it retains “edge” areas where shades are changing quickly. Consequently, in the output image 206, the pixels for script take an outlined appearance and the rest of the image having a “washed out” appearance. The result is that dark pixels typically form the boundary between text and non-text.
Next, as shown at block 23 of FIG. 1B, a smoothing operation is applied to the image. As shown in FIG. 3B in an exemplary embodiment of a smoothing function, a BiLateral Filter (BLF) is applied to the image 206 on which the Sobel Edge Detection was performed resulting in a smoothed image 208.
At block 24 of FIG. 1B, once the smoothing operation is performed, the system computes the local color contrast for each pixel. In an embodiment, the local color contrast for each pixel from the smoothed image is computed by performing a local standard deviation (StdDev) operation on the smoothed image. As shown in FIG. 1C, the local StdDev operation comprises for each pixel of the smoothed image: identifying a square window around a home pixel 25; computing the StdDev of the color values within the window of pixels 26; and storing the StdDev color valise of the pixel 27.
Accordingly, starting at a block 25 of FIG. 1C, the local color contrast of the smoothed image 208 is computed. At block 25 of FIG. 1C, for each pixel of the smoothed image, a square window of pixels centered around a home pixel is identified. In one embodiment, a window of neighboring pixels is a square or pixels centered around a home pixel such as a “center” pixel. The number of pixels in the window is quadratic. That is to say a window size of 9 corresponds to a pixel area containing 81 pixels. This pixel area contains the home pixel, h and 80 neighboring pixels). A window size of 7 corresponds to a pixel area containing 49 pixels. A window size can take on the values of 3, 5, 7, 9, and so on. Each pixel is identified as a “home” pixel for an area including a plurality of pixels. For example, in an embodiment a 15 by 15 square pixel window is centered around a home pixel (i.e., 7 pixels on each of the sides of the home pixel). As will be appreciated, the area of the square about the home pixel can be enlarged (e.g., 17, 21) or reduced (e.g., 9, 13). However, as described at the appropriate section below, this window size will, be smaller than a window sized established when isolating locally dark pixels during the process. As will be noted, the pixel length for the window is an odd number as the number includes the home pixel and the even number of pixels surrounding the home pixel.
At block 26, the standard deviation of the colors within the window of pixels is calculated, and at block 27, the value is saved as a standard deviation value (StdDev). Once all the pixels are computed thus, at block 28 the stored StdDev values are normalized such that the values range from 0 to 255. As shown in the example of FIG. 3C, the resulting image depicts local color contrast 210 and is computed from the smoothed image 208 using the local StdDev operation.
At block 29 of FIG. 1B, the method comprises isolating pixels that have a high local color contrast. The system can be configured to apply a clustering algorithm such as Otsu's Method, which is a computerized technique known to ordinarily skilled artisans for computer vision and image processing, which automatically performs histogram shape-based image thresholding, namely, the reduction of a grayscale image to a strictly black and white image (0,1). As shown at FIG. 3D, the application of Otsu's method to the Local StdDev output 210 of the smoothed image 208 outputs a high contrast black, and white binary image 212. As will be appreciated, clustering methods other than Otsu's Method can be used, as for example K-means clustering.
Returning to FIG. 1A, at block 33 the method comprises isolating script pixels based on a filter criterion that filters pixels that are locally dark (or light). Again, in the embodiments described herein, locally dark pixels are isolated, however, as will be appreciated, the methods and systems can be readily configured to isolate and filter locally light pixels (e.g., for a negative). In an embodiment, FIG. 1D shows a flow for computing the locally dark pixels. At block 30, with the original grayscale image 202 as input, for each pixel of the original grayscale image 202, a square window of the pixels centered around a home pixel is identified. The window is larger than a square window identified for a smoothed image during a Local StdDev operation at (as shown at block 25 of FIG. 1C). At block 31, the clustering operation such as Otsu's method or K-means clustering is applied to the defined square window of pixels, resulting in a binary values for each pixel, namely either black or white. At block 32, the system saves the black or white color value of the home pixel. The Otsu's method is applied thus to every pixel of the image 202.
As noted above the square window for the smoothed image as computed at blocks 25 of FIG. 1C when isolating pixels near an edge is smaller than the square window for the original grayscale image computed at block 30 of FIG. 1D when isolating locally dark or light pixels. For example, the square window computed at block 30 for the grayscaled image 202 can be about 25% larger than that computed at block 25. According to an embodiment, at block 30 the system can be configured to highlight a 21 by 21 square window of pixels centered around each home pixel of the grayscaled image 202, whereas a 15 by 15 window is employed as described above at block 25 of FIG. 1C. As will be appreciated, the size of these windows may vary, as the image cleaning process described below improves image legibility. It is the case, however, that the pixel window for the image processing at block 30 must be larger than that of blocks 25 as described above, for example between 20-40% larger.
At block 31 of FIG. 1D, a clustering method is applied to a window of pixels, and the white/black color of the home pixel is saved. This process is carried out for each pixel of the original image. As noted herein, while the clustering of the exemplary embodiment applies Otsu's method, any clustering method known in the art can be applied. As shown at FIG. 4, the application of Otsu's method to the original grayscale image 202 outputs a high contrast black and white binary image 214. In the image 214 is such that the script is black and has the appearance of stark white highlighting, while the remaining “background” is speckled in high contrast black and white depending on the grey shade values of the original grayscale image 202.
Returning to FIG. 1A, at block 34 the system is configured to compute an intersection between the edge detected image output 212 and the locally dark/light image output 214 and outputting a combined image 216. As shown at FIG. 5, in one embodiment, this is achieved by combining the image with the isolated edge detected output 212 (as described herein with respect to block 21 of FIG. 1A and FIGS. 1B-1C) with the pixels segregated into light pixels and dark pixels as output 214 (as shown at block 33 of FIG. 1A and FIG. 1D). FIG. 6 shows a magnified view of portions of the image inputs of the segregated image 212 and the image 214 and the resulting enhanced image output 216. The resulting enhanced image 216 cross-references the locally dark pixels segregated in image 214 and the script that is proximate to an edge from the clustered image 212. Only pixels that meet both criteria are shown in black in the enhanced image 216, and the rest of the image is white, resulting in a crisp, highly legible image.
Returning again to FIG. 1A, at block 35 the system is configured to clean the combined image 216. As shown at FIG. 1E, the cleaning comprises removing stray pixels 36; and correcting plateaus 41.
As shown in the embodiment described at FIG. 1F, the removal of stray pixels from the black and white image comprises, for each window of pixels: counting the number of black pixels within the window; counting the number of white pixels within the window; detecting if a threshold number of pixels within the window are the opposite color of the home pixel; and if so, changing the color value of the home pixel to the opposite color value for each center or home pixel of a window. In accord with the description herein, a window size can take on the values of 3, 5, 7, 9, and so on. Each pixel is identified as a “home” pixel for an area including a plurality of pixels. In the embodiment described below, the exemplary number of pixels in the window is at least 9 (a window size of 3), however the pixel window can have any odd number of pixels depending on the size of the window around a home or center pixel.
In an embodiment with a window size of at least 3, the removal of stray pixels comprises detecting color values of the home pixel (1) and a number (at least 8) of nearest surrounding pixels (together equaling at least 9 pixels) 37; and detecting if a threshold number of pixels is an opposite color value than the color value of the home pixel 38 by counting the number of black pixels within the window and counting the number of white pixels within the window. If the detected opposite color values of the pixels meets or exceeds the threshold number 39, the system if configured to change color value of the center pixel to the opposite color value 40, As will be appreciated, as the combined image 216 has only binary colors of black and white (dark and light) pixels, the color value is in every case one or the other, that is, black or white.
In an embodiment where a home pixel and its nearest surrounding neighbors are be a count of 9 pixels, that is, the center or home pixel b and the eight (8) neighboring pixels that surround it on ail sides (a window size of 3), the color value threshold is at least 7 pixels as lower thresholds, while possible, can result in more degraded image results. This is because a window size of 3 having 9 pixels is arranged 3×3 in a grid-like arrangement in the square window, in which case a simple majority of 6 same-color values can leave the 3 opposite color pixels occupying the same row of pixels or one column of pixels, as shown in Table 1. Thus, by setting the threshold to require at least 7 pixels, the risk of degradation due is reduced. For example, in a window of 9 pixels (window size 3) with a color value threshold of 7, if there are 7-8 black pixels, the center pixel h is changed to black if the center or home pixel were previously white, as shown in Table 2 Contra, if 7-8 of the pixels are white, then the center pixel b is changed to white if the center or home pixel b were previously black. If, on the other hand, the color threshold is not met (i.e., 6 pixels or under are an opposite color) then the center pixel is left unchanged, as shown in Table 3.

















Black
White
Black



Black
White
Black



Black
White
Black










Table 1, showing a simple majority (6) of Black pixels leaves a row of same colored White pixels, including the center pixel, that are not in the majority.


















Black
Black
Black



Black
White to
Black




Black




Black
White
Black










Table 2, showing an example where for a threshold of 7, the system is configured to change the center White pixel to a Black pixel where there are at least 7 Black pixels in the window.


















Black
White
White



Black
White
White




(no change)




Black
White
White










Table 3, snowing an example where for a threshold of 7, the system is configured to not to change a center White pixel where there are at least 6 White pixels in the window.
As will be appreciated, if the window grows to encompass more than the minimum 8 pixels of pixels around the home pixel than the threshold will also grow beyond the value of 7 or greater. As noted above, while a simple majority can be employed, a threshold should be configured such that every row and column of the pixels includes at least one pixel having the same black or white color-value as the majority number of pixels in the square. That is to say, system should be configured such that no row or column can have all the same black or white colored pixel values if those black or white color values are in the minority. For example for a window size of 5 encompassing a grid of 25 pixels or a window size of 7 encompassing a grid of 49 pixels, the threshold can be configured to be at thresholds of at least: 21 and 43 pixels respectively. Hence for every window size n, having a grid of a*n pixels, the threshold can be at least (n*n−1)+1 pixels.
As shown in the embodiment described at FIG. 1G, the correction of plateaus comprises, for the identified plateaus:

    
    
        computing the mean and standard deviation of the original pixel color in an island portion of the identified plateau 42;
        computing the mean and standard deviation, of the original pixel color m a border portion of the identified plateau 43;
        performing a statistical test, for example a two-sample z-test or other statistical tests as known in the art, on the plateau to determine if the island portion of the plateau is part of the border portion of the plateau 44; and
        if the island portion of the plateau is a part of the border portion of the plateau 45, correcting the identified plateau so the island portion and the border portion of the plateau are the same color value 46.
    
    


As shown at FIG. 6, a combined image 216 may have “island” portions inside script that are opposite the black or white color value of the border script 215, which are identified as plateaus. Plateaus can be the result of, for example, large fonts in a given image. In such an instance, as shown in FIG. 1F, when, a font is large the center of a letter may not be “near an edge,” thus the processing can leave the island 215. Accordingly, in an embodiment the system is configured to determine if an island of a plateau is anomalous and if so, correct it, or determine if the island is in fact a correct representations of the original image 200. At block 42, the mean and standard deviation of the pixel color of the original pixel color from the original grayscale image 202 is computed. At block 43 a mean and standard deviation of the original pixel color of the border portion of the identified plateau is computed. At block 44, a two-sample z-test (a statistical operation) is performed on the plateau using the computed standard deviations from the original grayscale image 202 to determine if the island portion of the plateau is part of the border portion of the plateau. At block 45 if the island portion of the plateau is determined to be a part of the border portion of the plateau 45, the identified plateau is corrected so the island portion and the border portion of the plateau are the same color value 46.
The system and method described herein show exemplary novel advantages. For example, a test set of comparative images can be drawn from the Document Image Binarization Contest (DIBCO). Held in 2009 and 2011 at the International Conference on Document Analysis and Recognition (ICDAR), the contest provided “difficult case” input images to be processed for legibility. A particularly difficult original image 200x is shown at FIG. 7A, in which the original image 200x is highly texturized, a dark brown background, and has faded script. The imaged texture makes it very difficult for image processing systems to achieve correct binarization results that can distinguish, and make legible script from the texturized and colored background. FIG. 7A also shows an exemplary, manually produced “goal solution” 217 provided by DIBCO against which systems for binarizing images for legibility were to have image results judged. As shown in FIG. 7B the manually produced exemplary “goal solution” 217 provided by the latest DIBCO is placed side-by-side with an image result 218 for the original document 200x processed by the present system and method. The side-by-side for comparison shows the image result 218 nigh mirrors the target solution 217.











TABLE 4









Described



1st
2nd
3rd
image



Place
Place
Place
processing



















Mean F1
80.9
85.2
88.7
88.9


Median F1
92.3
92.1
90.6
89.7


Variance F1 
794
302 
49.7
19.2









Table 4 presents a comparison of documents processed by the 1st, 2nd and 3rd place winners of the latest DIBCO competition as compared to the same documents processed using an embodiment of the system and method as described herein. DIBCO competitions score document results via the following criteria: (1) Recall, which measured the percentage of truly black pixels that were predicted to be black and (2) Precision, which measures the percentage of predicted black pixels that, are truly black. An F1 Measure is the primary measure for judging, which measures in accord with the equation

F1=2·(Precision·Recall)/(Precision+Recall)

As will be appreciated, higher Mean F1 values and higher Median F1 values represent better images. As shown in Table 1, the present system processed documents as well as or better than the winning systems with, respect to Mean and Median F1 scores. However with a variably F1 of 19.2, the present system did so with significantly less variability, at an order of magnitude less than the 1st and 2nd place winners (792 and 304) and significantly less than the 3rd place winner (49.7). This means the present system produced images of high legibility at equivalent quality of the winners of the competition, and did so while processing documents with greater consistency, and hence, far fewer failures. In contrast, while latest DIBCO competition awards points for each test image, 1st and 2nd place frequently do very well but sometime fail outright (hence their mean performance is significantly lower than their median performance).
As shown at FIGS. 8A-8D, another dataset shows original images 200a-200d compared against final enhanced images 218a-218d. A dataset of processed images is a collection of World War II era document images, the originals residing at the Yad Vashem Holocaust Memorial in Israel. FIGS. 8A-8D are further examples of original images 200a-200d and enhanced images 218a-218d, which show that a wide variety of script and symbols can be enhanced and made more legible, readable, and clear. For instance, FIGS. 8C and 8D show original historical documents 200c, 200d with highly degraded script which is handwritten. The output enhanced images 218c and 218d show highly readable and legible document images. As will be noted, degraded script that was faded or obscured in the original image is clearly legible enhanced script, and the enhanced script is even and consistent with the script of the whole image in the enhanced image 218c, 218d. FIGS. 8B and 8D show original images 200b, 200d and enhanced images 218b, 218d having both handwriting and typeset in the same image, and in FIG. 8D, the typeset has handwritten edits. As shown in FIG. 8C, the original image 200c and enhanced image 218c includes photos; the presence of the photos does nothing to impede the script enhancement, although the photo is treated by it. Thus in one embodiment the system could be configured to identify photos either before or after the script enhancement method for the purpose of reincorporating the original image or grayscale image back into the enhanced image (not shown).
Embodiments of the invention may be implemented by systems using one or more programmable digital computers and computer readable storage media. In one embodiment, FIG. 9 depicts an example of one such computer system 100, which includes at least one processor 110, such as, e.g., an Intel or Advanced Micro Devices microprocessor, coupled to a communications channel or bus 112. The computer system 100 further includes at least one input device 114 such as, e.g., a keyboard, mouse, touch pad or screen, or other selection or pointing device, at least one output device 116 such as, e.g., an electronic display device, at least one communications interface 118, at least one computer readable medium or data storage device 120 such as a magnetic disk or an optical disk and memory 122 such as Random-Access Memory (RAM), each coupled to the communications channel 112. The communications interface 118 may be coupled to a network 142.
One skilled in the art will recognize that many variations of the system 100 are possible, e.g., the system 100 may include multiple channels or buses 112, various arrangements of storage devices 120 and memory 122, as different units or combined units, one or mote, computer-readable storage medium (CRSM) readers 136, such as, e.g., a magnetic disk drive, magneto-optical drive, optical disk drive, or flash drive, multiple components of a given type, e.g., processors 110, input devices 114, communications interfaces 118, etc.
In one or more embodiments, computer system 100 communicates over the network 142 with at least one computer 144, which may comprise one or more host computers and/or server computers and/or one or more other computers, e.g. computer system 100, performing host and/or server functions including web server and/or application server functions. In one or more embodiments, a database 146 is accessed by the at least one computer 144. The at least one computer 144 may include components as described for computer system 100, and other components as is well known in the computer arts. Network 142 may comprise one or more LANS, WANS, intranets, the Internet, and other networks known in the art. In one or more embodiments, computer system 100 is configured as a workstation that communicates with the at least one computer 144 over the network 142. In one or more embodiments, computer system 100 is configured as a client in a client-server system in which the at least one other computer comprises one or more servers. Additional computer systems 100, any of which may be configured as a work station and/or client computer, may communicate with the at least one computer 144 and/or another computer system 100 over the network 142.
For example, one or more databases 146 may store the scanned image data as described herein. In various embodiments, the processing disclosed herein may be performed by computer(s)/processor(s) 144 in a host arrangement with computer system 100, or in a distributed arrangement in computer system 100 and computer(s)/processor(s) 144, or by computer system 100 in cooperation with data stored in database 146. Computer(s)/Processor(s) 144 may perform the processing disclosed herein, based on computer code stored in a storage device or device(s) 120, 136, 138 and/or memory 122.
FIG. 10 shows an exemplary network environment 400 adapted to support embodiments as disclosed herein, as for example for data parallel processing of images. The exemplary environment 400 includes a network 142, and a plurality of computers 100, or computer systems 100(a) . . . (k) (where “k” is any suitable number). Computers could include, for example one or more SQL servers. Computers 100 can also include wired and wireless systems as described herein. Data storage, processing, data transfer, and program, operation can occur by the inter-operation of the components of network environment 400. For example, a component including a program in server 100(a) can be adapted and arranged to respond to data stored in server 100(b) and data input from server 100(c). This response may occur as a result of preprogrammed instructions and can occur without intervention of an operator. As described herein, in certain embodiments the automated method is configured to process images individually on an image-by-image basis, where each image is a “page” of a document in an image database. Accordingly, the system can be configured for data parallel processing of images and pages. Pages or images from a given document or set of documents can be partitioned and distributed among the computer systems 100(a) . . . (k) for parallel processing and the document or document set recombined after processing. Again, this response may occur as a result of preprogrammed instructions and can occur without intervention of an operator.
The network 142 is, for example, any combination of linked computers, or processing devices, adapted to access, transfer and/or process data. The network 142 may be private Internet Protocol (IP) networks, as well as public IP networks, such as the Internet that can utilize World Wide Web (www) browsing functionality, or a combination of private networks and public networks of any type.
A computer 100(a) for the system can be adapted to access data, transmit data to, and receive data from, other computers 100(b) . . . (k), via the network or network 142. The computers 100 typically utilize a network service provider, such as an Internet Service Provider (ISP) or Application Service Provider (ASP) (ISP and ASP are not shown) to access resources of the network 142.
The computers 100 may be operatively connected to a network 142, via bi-directional communication channel, or inter connector, 118, which may be for example a serial bus such as IEEE 1394, or other wire or wireless transmission media. Examples of wireless transmission media include transmission between a modem (not shown), such as a cellular modem, utilizing a wireless communication protocol, or wireless service provider or a device utilizing a wireless application protocol and a wireless transceiver (not shown). The interconnector 118 may be used to feed, or provide data.
The terms “operatively connected” and “operatively coupled”, as used herein, mean that the elements so connected or coupled are adapted to transmit and/or receive data, or otherwise communicate. The transmission, reception or communication is between the particular elements, and may or may not include other intermediary elements. This connection/coupling may or may not involve additional transmission media, or components, and may be within a single module or device or between one or more remote modules or devices.
The terms “client” and “server” may describe programs and running processes instead of or in addition to their application to computer systems described above. Generally, a (software) client may consume information and/or computational services provided by a (software) server.
Various embodiments of the invention are described herein with respect to scanned image databases and systems related thereto. However, it is to be understood that the invention has application to other image data where, inter alia, legibility and readability of obscured image files are desired.
While the invention has been described and illustrated with reference to certain preferred embodiments herein, other embodiments are possible. Additionally, as such, the foregoing illustrative embodiments, examples, features, advantages, and attendant advantages are not meant to be limiting of the present, invention, as the invention may be practiced according to various alternative embodiments, as well as without necessarily providing, for example, one or more of the features, advantages, and attendant advantages that may be provided by the foregoing illustrative embodiments.
Systems and modules described herein may comprise software, firmware, hardware, or any combination(s) of software, firmware, or hardware suitable for the purposes described herein. Software and other modules may reside on servers, workstations, personal computers, computerized tablets, PDAs, scanners (including handheld scanners), digital cameras and camcorders, and other devices suitable for the purposes described herein. Software and other modules may be accessible via local memory, via a network, via a browser or other application in an ASP context, or via other means suitable for the purposes described herein. Data structures described herein may comprise computer files, variables, programming arrays, programming structures, or any electronic information storage schemes or methods, or any combinations thereof, suitable for the purposes described herein. User interface elements described herein may comprise elements from graphical user interfaces, command line interfaces, and other interfaces suitable for the purposes described herein. Except to the extent necessary or inherent in the processes themselves, no particular order to steps or stages of methods or processes described in this disclosure, including the Figures, is implied. In many cases the order of process steps may be varied, and various illustrative steps may be combined, altered, or omitted, without changing the purpose, effect or import of the methods described.
Accordingly, while the invention has been described and illustrated in connection with preferred embodiments, many variations and modifications as will be evident to those skilled in this art may be made without departing from the scope of the invention, and the invention is thus not to be limited to the precise details or methodology or construction set forth above, as such variations and modification are intended to be included within the scope of the invention. Therefore, the scope of the appended claims should not be limited to the description and illustrations of the embodiments contained herein.

## Claims

1. A method for performing a process on an image, the process being implemented by a computer system comprising at least one data storage device in which is stored image data for images, at least one computer and at least one computer readable medium storing thereon computer code which when executed by the at least one computer performs the method, the method comprising:
performing a set of operations on the image that renders the image, from a first state to a second state, wherein the second state is more legible than the first state, the operations comprising:
converting the image into a grayscale image;
isolating a plurality of pixels near an edge to generate an edge detected image output;
isolating locally dark or light pixels to generate a locally dark or light image output;
computing an intersection between the edge detected image output and the locally dark or light image output and outputting a combined black and white image;
cleaning the outputted combined image;
correcting an erroneous plateau comprising computing a mean and standard deviation of original pixel colors of the image in an island portion of the erroneous plateau;
computing a mean and standard deviation of the original pixel colors in a border portion of the erroneous plateau;
performing a statistical test on the erroneous plateau to determine if the island portion of the erroneous plateau is part of the border portion; and
if the island portion is a part of the border portion, correcting the erroneous plateau so the island portion and the border portion are a same color value.

2. The method of claim 1, wherein isolating the plurality of pixels near an edge further comprises:
performing edge detection on the image to generate an edge image;
applying a smoothing operation to the edge image to produce a smoothed edge image;
computing a local color contrast for each pixel in the smoothed edge image to produce a locally contrasted image; and
isolating the pixels with high local color contrast.

3. The method of claim 2, wherein the edge detection is selected from a Sobel operation, Canny, Canny-Deriche, Differential, or Prewitt Roberts Cross.

4. The method of claim 2, wherein the edge detection smoothing operation comprises applying a Bilateral Filter.

5. The method of claim 2, wherein a computation of a pixel's local color contrast from the smoothed image comprises:
performing a local standard deviation (StdDev) operation on the smoothed image.

6. The method of claim 5, wherein the local StdDev operation comprises, for each pixel of the smoothed image:
identifying a square window around a home pixel;
computing the local standard deviation (StdDev) values of the color values within the square window of pixels;
storing a StdDev color value of the pixel, and
normalizing the computed local StdDev values such that the values range from 0 to 255.

7. The method of claim 5 wherein the isolating pixels with locally dark or light pixels comprises:
for each pixel of the grayscale image:
identify a square window of pixels centered around a home pixel, wherein the window is larger than a square window used when, isolating the plurality of pixels near an edge,
perform an clustering operation to the square window of pixels; and
save the black or white color value of the home pixel.

8. The method of claim 7 wherein, the square window used for isolating locally dark or light pixels is about 25% larger than the square window used to isolate pixels that are near an edge.

9. The method of claim 2 wherein isolating pixels with a high local color contrast comprises: performing clustering on the locally contrasted image.

10. The method of claim 1 wherein cleaning the outputted combined image comprises:
removing stray pixels from a black and white image.

11. The method of claim 10 wherein removing stray pixels from the black and white linage comprises, for each, window of at least 9 pixels:
counting a number of black pixels within the window;
counting a number of white pixels within the window;
detecting if a threshold number of pixels within the window are the opposite color of a home pixel; and
if so, changing the color value of the home pixel to the opposite color value.

12. The method of claim 11 wherein a color value threshold is at least 7 pixels.

13. A computer system comprising at least one data storage device in which is stored image data, at least one computer and at least one computer readable medium storing thereon computer code which when executed by the at least one computer performs a method, the method comprising:
performing a set of operations on an image that renders the image from a first state to a second state, wherein the second state is more legible than the first state, the operations comprising:
converting the image into a grayscale image;
isolating a plurality of pixels near an edge to generate an edge detected image output;
isolating locally dark or light pixels to produce locally dark or light image output;
computing an intersection between the edge detected image output and the locally dark or light image output and outputting a combined black and white image; and
cleaning the outputted combined image including correcting any erroneous plateaus by performing a statistical test on an erroneous plateau to determine if an island portion of the erroneous plateau is part of a border portion of the erroneous plateau and if the island portion of the erroneous plateau is a part of the border portion, correcting the erroneous plateau so the island portion and the border portion of the erroneous plateau are a same color value.

14. The computer system of claim 13, wherein isolating the plurality of pixels near an edge further comprises the at least one computer performing the operations comprising:
performing edge detection on the image to generate an edge image;
applying a smoothing operation to the edge image to produce a smoothed edge image;
computing a local color contrast for each pixel in the smoothed edge image to produce a locally contrasted image; and
isolating the pixels with high local color contrast.

15. The computer system of claim 14, wherein the edge detection, is selected from a Sobel operation, Canny, Canny-Deriche, Differential, or Prewitt Roberts Cross.

16. The computer system of claim 14, wherein the edge detection smoothing operation comprises applying a Bilateral Filter.

17. The computer system of claim 14, wherein the computing of the pixel's local color contrast from the smoothed image comprises the at least one computer performing the operation comprising:
performing a local standard deviation (StdDev) operation on the smoothed image.

18. The computer system of claim 17, wherein the local StdDev operation comprises, for each pixel of the smoothed image:
identifying a square window around a home pixel;
computing a standard deviation (StdDev) of color values within the window of pixels to compute StdDev values;
storing a StdDev value of the pixel, and
normalizing the computed StdDev values such that the values range from 0 to 255.

19. The computer system of claim 17 wherein the isolating pixels with locally dark or light pixels comprises the at least one computer performing the operation comprising:
for each pixel of the grayscale image:
identify a square window of pixels centered around a home pixel, wherein the window is larger than a square window used when isolating the plurality of pixels near an edge;
perform an Otsu's method operation to the square window of pixels; and
save the black or white color value of the home pixel.

20. The computer system of claim 19 wherein the square window used for isolating locally dark or light pixels is about 25% larger than the square window used to isolate pixels that are near an edge.

21. The computer system of claim 14 wherein isolating pixels with a high local color contrast comprises the at least one computer performing the operation comprising: performing clustering on the locally contrasted image.

22. The computer system of claim 13 wherein removing stray pixels the black and white image comprises the at least one computer performing the operation comprising, for each window of at least 9 pixels:
counting the number of black pixels within the window;
counting the number of white pixels within the window;
detecting if a threshold number of pixels within the window are the opposite color of the home pixel; and
if so, changing the color value of the home pixel to the opposite color value.

23. The computer system of claim 22 wherein a color value threshold is at least 7 pixels.

24. The computer system of claim 13 wherein correcting erroneous plateaus comprises further comprises:
computing a mean and standard deviation of original pixel colors in an island portion of the identified plateau;
computing a mean and standard deviation of the original pixel colors in a border portion of the identified plateau.

25. A method for performing a process on an image, comprising:
performing a set of operations on the image that renders the image, from a first state to a second state so as to make the image more legible, the operations comprising:
converting the image into a grayscale image;
isolating a plurality of pixels near an edge to generate an edge detected image output including:
performing edge detection on the image to generate an edge image;
applying a smoothing operation to the edge image to produce a smoothed image;
computing a local color contrast for each pixel in the smoothed image to produce a locally contrasted image; and
isolating the pixels with high local color contrast;

isolating locally dark or light pixels to generate a locally dark or light image output;
computing an intersection between the edge detected image output and the locally dark or light image output and outputting a combined image;
cleaning the outputted combined image.

26. A non-transitory computer-readable medium having instructions thereon for performing a method on an image, the method comprising:
performing a set of operations on the image to transform the image from a first state to a second state so as to make the image more legible, the operations comprising:
converting the image into a grayscale image;
isolating a plurality of pixels near an edge to generate an edge detected image output including:
performing edge detection on the grayscale image to generate a first edge image;
applying a smoothing operation to the first edge image to generate a smoothed edge image;
computing a local color contrast for each pixel in the smoothed edge image; and
isolating pixels with high local color contrast based on the computing of the local color;

isolating locally dark or light pixels to produce a locally dark or light image output;
computing an intersection between the edge detected image output and the locally dark or light image output and outputting a combined image; and
cleaning the outputted combined image.

27. The non-transitory computer-readable medium of claim 26, further including:
performing a statistical test on a plateau to determine if an island portion of the plateau is part of a border portion of the plateau; and
if the island portion of the plateau is a part of the border portion of the plateau, correcting the plateau so the island portion and the border portion of the plateau are a same color value.