Abstract:
An original image is processed while permitting a user to control an amount of color cast removal and an amount of color contrast enhancement performed on the original image. A user interface, which includes a control element having a single degree of freedom, is provided. User adjustment of the control element is responded to by simultaneously varying the degree of color cast removal and the amount of color contrast enhancement performed on the original image. In a further embodiment, an original image is processed so as to automatically remove color cast from the original image. According to this embodiment contrast is reduced for certain very dark pixels and very bright pixels, and enhanced for the remainder. In a still further embodiment, an original image is processed so as to automatically enhance color contrast in the original image. According to this embodiment, a first mapping of intensity levels is performed if the image is not both highkey and lowkey, and a second mapping is performed if the image is both highkey and lowkey.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to computerized color image processing of digital color images, and more particularly to systems and techniques for automatic contrast enhancement, automatic color cast removal with contrast enhancement, and combined color cast removal and contrast enhancement where a user can adjust a single control for maximum color cast removal, maximum contrast enhancement, or any intermediate position. 
     2. Description of the Related Art 
     In many instances an original color image will include an undesirable color cast or tint. For example, as photographs age they often acquire a yellow cast. In addition, color casts may arise from a variety of circumstances, including the type of lighting or the quality/color sensitivity of photographic film used when taking a photograph. 
     Conventional techniques have been employed in order to reduce or eliminate color casts in original color images. However, in order to achieve good results, it has generally been necessary to have significant user input. This can be inconvenient in many instances, and can also lead to less than optimal results. 
     For example, in one conventional technique the user is required to identify the white point in the image, and then the image colors are adjusted accordingly. However, with such a technique, different users might disagree about which point in the image is the white point. Accordingly, the image processing parameters will generally be based upon a subjective determination, which might not always be desirable. Moreover, a user&#39;s determination of the white point might be skewed based on the color makeup of the image. For example, a point might erroneously appear to be the white point only because surrounding colors interfere with the user&#39;s perception of the point&#39;s true color. Finally, selecting the white point in each image can be very tedious and burdensome, particularly when many images are to be processed, and generally will be impractical if one wishes to process frame images on a real time basis. 
     Another common defect of color images is poor contrast. This problem can obscure image information, as well as negatively affect the general appearance of the image. Although conventional techniques exist for enhancing contrast, such conventional techniques generally do not provide optimal results in many situations. For example, many conventional contrast enhancement techniques do not provide acceptable results when the original image has both very dark and very bright pixels. 
     Moreover, it is often desirable to allow a user to have some control over the amount of contrast enhancement and color cast removal performed on the original image. For instance, a fully automatic color cast removal technique probably will be incapable of determining when a user subjectively wants the image to have a color cast, such as when a user has taken a photograph through a colored filter or when a user intentionally wishes to mimic an old and yellowed photograph. Similarly, a user might, for aesthetic reasons, want to vary the amount of color contrast in an image. Conventionally, however, in order to permit a user to adjust both the amount of contrast enhancement and the degree of color cast removal, at least two controls have been provided (one for color cast removal and one for contrast enhancement). Accordingly, simultaneous adjustment of both color cast removal and contrast enhancement using conventional techniques has not heretofore been possible. 
     SUMMARY OF THE INVENTION 
     The present invention addresses these problems by providing techniques for automatic color cast removal, automatic contrast enhancement, and combined color cast removal and contrast enhancement where a user can adjust a single control for maximum color cast removal, maximum contrast enhancement, or any intermediate position. 
     In one embodiment of the invention, an original image is digitally processed so as to automatically enhance color contrast in the original image. According to this embodiment, the original image is designated as highkey only if, for each color component in the original image, there exists a sufficient percentage of pixels having a pixel intensity level for that color component which is greater than or equal to a first threshold intensity value. The original image is designated as lowkey only if, for each color component in the original image, there exists a sufficient percentage of pixels having a pixel intensity level for that color component which is less than or equal to a second threshold intensity value. A first mapping is performed for each color component of the original image if the original image is not both highkey and lowkey, and a second mapping is performed, for each color component of the original image if the original image is both highkey and lowkey. The second mapping, which is different than the first mapping, enhances contrast for a range of the brightest pixels and a range of the darkest pixels and reduces contrast for pixels having an intensity between the ranges of darkest and brightest pixels for which contrast is enhanced. 
     By virtue of this arrangement, contrast enhancement is provided automatically and without user input. Moreover, the foregoing arrangement is designed to specifically address the situation where an original image contains both very dark and very bright pixels. Accordingly, the foregoing embodiment can provide good results in situations where conventional systems typically fail. 
     In a further embodiment, an original image is digitally processed so as to automatically remove color cast from the original image. According to this embodiment, pixel intensity levels for each color component i in an original image are obtained. The pixel intensity levels for each color component i are separately mapped to new pixel intensity levels for that color component by (a) determining a value d i ′ based on the darkest d i  percent of pixels, (b) mapping pixels darker than d i ′ to a small first range of dark intensity levels, (c) determining a value b i ′ based on the brightest b i  percent of pixels, (d) mapping pixels brighter than b i ′ to a small second range of bright intensity levels, and (e) mapping the remainder of the pixels to fall between the first and second ranges, where d i  and b i  are numbers pre-selected for each color component i. Finally, a new image is created using the new pixel intensity levels for each of the color components. 
     The foregoing arrangement thus provides for fully automatic color cast removal and can provide good results under a variety of circumstances without any user input. For example, the foregoing embodiment can provide good results without the necessity of requiring the user to designate a white point. 
     In a further embodiment, an original image is digitally processed while permitting a user to control an amount of color cast removal and an amount of color contrast enhancement performed on the original image. According to this embodiment, a user interface, which includes a control element having a single degree of freedom, is provided. The original image is digitally processed. User adjustment of the control element is responded to by simultaneously varying the degree of color cast removal and the amount of color contrast enhancement performed on the original image during the digital processing. 
     By virtue of this arrangement, a user can easily and without significant training or experience simultaneously adjust the amount of contrast enhancement and the degree of color cast removal performed on an original image. Moreover, these adjustments can be made with a single control, and generally without the necessity of significant user action, such as locating a white point. 
    
    
     This brief summary has been provided so that the nature of the invention may be understood quickly. A more complete understanding of the invention can be obtained by reference to the following detailed description of the preferred embodiments thereof in connection with the attached drawings. 
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a perspective view of computing equipment which embodies the present invention. 
     FIG. 2 is a block diagram of the computer workstation shown in FIG.  1 . 
     FIG. 3 is a flow diagram illustrating automatic contrast enhancement according to the present invention. 
     FIG. 4A is a histogram illustrating pixel intensity distributions for a single color component of an original image. 
     FIG. 4B is a histogram corresponding to the histogram in FIG. 4A after processing according to the process steps illustrated in FIG.  3 . 
     FIG. 5A is a histogram of pixel intensities for a single color component of an original image which is both highkey and lowkey. 
     FIG. 5B is a histogram corresponding to the histogram in FIG. 5A after processing according to the process steps illustrated in FIG.  3 . 
     FIG. 6 is a flow diagram illustrating process steps for performing automatic color cast removal with contrast enhancement according to the invention. 
     FIG. 7A is a histogram illustrating the pixel intensity distribution for a single color component in an original image. 
     FIG. 7B is a histogram corresponding to the histogram in FIG. 7A after processing according to the process steps illustrated in FIG.  6 . 
     FIGS. 8A through 8C are histograms for the red, green and blue color components, respectively, of an original image, and show pixel intensity distributions both before and after processing according to the process steps shown in FIG.  6 . 
     FIG. 9 is a view of a monitor display according to an embodiment of the invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 shows the outward appearance of a representative embodiment of the present invention. Shown in FIG. 1 is computing equipment  10 , such as a Macintosh or an IBM PC-compatible computer having a windowing environment, such as Microsoft® Windows. Provided with computing equipment  10  is a color display screen  11 , such as a color monitor, keyboard  12  for entering text data and user commands, and pointing device  14 , such as a mouse, for pointing to and manipulating objects displayed on display screen  12 . 
     Computing equipment  10  includes a mass storage device, such as computer disk  15 , for storing data files, which can include image data files, text data files, and other data files in compressed or uncompressed format, and for storing application programs such as image processing programs, including image processing programs for performing contrast enhancement and color cast removal according to the invention, and other information processing programs such as word and spreadsheet processing programs. 
     Such application programs contain stored program instructions by which computing equipment  10  manipulates and stores data files on disk  15  and presents data in those files to an operator via the display screen  11  or by printing to color printer  16 . 
     Image data is input from color scanner  17  which scans documents or other images and provides bit map images for each of the red, green and blue color components of those documents to computing equipment  10 . Document image data may also be input into computing equipment  10  from a variety of other sources, such as via local area network interface  18  or via facsimile/modem interface  19 . 
     It should be understood that, although a programmable general-purpose computer arrangement is shown in FIG. 1, a dedicated or stand-alone computer or other types of data processing equipment can be used in the practice of the present invention. 
     FIG. 2 is a detailed block diagram showing the internal construction of computing equipment  10 . As shown in FIG. 2, computing equipment  10  includes a central processing unit (CPU)  20  interfaced with computer bus  21 . Also interfaced with computer bus  21  is scanner interface  22 , printer interface  25 , display interface  27 , keyboard interface  28 , mouse interface  29 , main memory  30 , ROM  24 , and disk  15 . 
     Main memory  30  interfaces with computer bus  21  so as to provide random access storage for use by CPU  20  when executing stored program instructions, such as programs for performing contrast enhancement and color cast removal, other image processing programs, and various other applications programs. More specifically, CPU  20  loads those programs from disk  15  into main memory  30  and executes those stored programs out of main memory  30 . 
     The following embodiments are discussed with respect to a color image processing system which inputs and processes color images in the three color components red, green and blue. Moreover, in the preferred embodiments discussed below, the intensity level for each color component is represented by an eight bit binary number, which permits representation of intensity levels in the range of 0-255. However, it should be noted that the invention is not limited to any specific color space or to using eight bit words. 
     It should also be rioted that the invention is described as if it were a stand-alone image processing technique. Again, this should not be considered to limit the invention, since it is also possible to embody the invention as part of a more comprehensive image processing application program. 
     Automatic Contrast Enhancement 
     A method for automatic contrast enhancement will now be described with reference to FIG.  3 . FIG. 3 is a flow diagram showing process steps for performing automatic contrast enhancement according to a representative embodiment of the invention. The process steps are stored on computer readable medium, such as disk  15 , for execution by computing equipment  10 . 
     Briefly, according to FIG. 3, an original image is input and then analyzed to determine whether it is both highkey and lowkey. If the image is not both highkey and lowkey, then for each color component i, (1) an intensity level x 0  is determined based on the intensity level corresponding to the darkest d i  percent of the pixels, (2) an intensity level x 1  is determined based on the intensity level corresponding to the brightest b i  percent of the pixels, (3) pixels having an intensity level less than or equal to x 0  are mapped to 0, (4) pixels having an intensity greater than or equal to x 1  are mapped to an intensity level of 255, and (5) pixels having an intensity level between x 0  and x 1  are linearly mapped to the range 0 to 255. On the other hand, if the image is both highkey and lowkey, then for each color component, (1) the histogram of pixel intensities is segmented into five different intensity level ranges with the four dividing points being determined as the levels corresponding to: the darkest 3 percent of the pixels, the brightest 3 percent of the pixels, and the beginning and end points of a portion of the histogram where the histogram is likely to be relatively low and flat, and (2) the intensity levels for all pixels are mapped so that the darkest 3 percent are mapped to 0, the brightest 3 percent are mapped to 255, contrast in the low flat portion is reduced, and contrast in the remaining portions is enhanced. Finally, after all color components have been processed, a new image is formed using the new color components. 
     More specifically, in step S 301  pixel intensity levels for each of the red, green and blue color components of an original image are input. This step might be performed by scanning a document containing the original image using color scanner  17  or by retrieving a file containing red, green and blue bit maps for the original image from disk  15 , or by downloading from a computerized network or the internet. In any event each color pixel intensity is represented by 8 bits, providing a range of intensity values from 0 to 255 (0 being the darkest and 255 being the brightest). 
     In step S 302 , it is determined whether the image is highkey (i.e., whether it has a sufficient number of bright pixels) and whether it is lowkey (i.e., whether it has a sufficient number of dark pixels). In the preferred embodiment, the image is determined to be lowkey only if for each of the three color components (red, green and blue) the darkest 10 percent of the pixels have an intensity level from 0 to 35. Similarly, in the preferred embodiment, the image is determined to be highkey only if for each of the three color components the brightest 10 percent of the pixels have intensity levels from 230 to 255. The foregoing percentages and pixel ranges are not intended to be limiting. Moreover, it should be noted that a different percentage and/or different range can be used for each of the different color components. Similarly, these values can also be varied depending on other parameters. 
     Flow then proceeds to steps S 303  through S 330 , in which pixel reference values are calculated in accordance with whether the image is highkey, lowkey or both (four reference values are calculated if both highkey and lowkey, whereas only two reference values are calculated if not), and the image is processed in accordance with the calculated reference values. Thus, in step S 303 , the first color component (i=1) is selected. 
     In step S 304 , if the image is both highkey and lowkey then processing proceeds to step S 305 . Otherwise, processing proceeds to step S 320 . 
     In steps S 305  through S 310 , two pixel reference values, x 0  and x 1 , are calculated for each color component, and the color components are mapped in accordance with the pixel reference values. Thus, in step S 305 , an intensity level x 0  is determined. First, as an intermediate step, an intensity level x 0 ′ is determined as the lowest intensity level which is greater than or equal to the darkest d i  percent of the pixels. Preferably, d i =0.5% for all color components. If x 0 ′ is less than or equal to X d-safety  (preferably, x d-safely =100), then x 0  is set equal to x 0 ′ and processing proceeds to step S 306 . If, on the other hand, x 0 ′ is greater than x d-safety , then an intensity level x 0 ″ is determined as the lowest intensity level which is greater than or equal to the darkest d i ′ percent of pixels. Preferably, d i ′=0.25% for all color components. If x 0 ″ is also greater than x d-safety , then x 0  is set equal to x d-safety  and processing proceeds to step S 306 . otherwise, x 0  is set equal to x 0 ″. 
     Similarly, in step S 306  an intensity level x 1  is determined. First, as an intermediate step, an intensity level x 1 ′ is determined as the highest intensity level which is less than or equal to the brightest b i  percent of the pixels. Preferably, b i =0.5% for all color components. If x 1 ′ is greater than or equal to x b-safety  (preferably, x b-safety =155), then x 1  is set equal to x 1 ′ and processing proceeds to step S 307 . However, if x 1 ′ is less than x b-safety , an intensity level x 1 ″ is determined as the highest intensity level which is less than or equal to the brightest b i ′ percent of pixels. Preferably, b i ′=0.25% for all color components. If x 1 ″ is also less than x b-safety , then x 1  is set equal to x b-safety  and processing proceeds to step S 307 . Otherwise, x 1  is set equal to x 1 ″. 
     In step S 307  the pixel intensity levels for the current color component are mapped according to the following:        y   =     {           0   ,           x   &lt;     x   0                 255   ×       x   -     x   0           x   1     -     x   0                   x   0     ≤   x   &lt;     x   1                 255   ,           x   ≥     x   1                                      
     where x is an original pixel intensity and y is the corresponding new pixel intensity. 
     In step S 309 , if all color components have been processed then processing proceeds to step S 330 . Otherwise, the next color component is selected in step S 312  and then processed beginning at step S 304 . 
     In step S 330 , a new image is formed using the new pixel intensities for each of the red, green and blue color components. For example, the new image might be displayed using color monitor  11  or printed using color printer  16 . 
     For images which are both highkey and lowkey, steps S 320  through S 326  calculate four pixel reference values, x 0  through X 3 , for each color component and map the color components in accordance with the pixel reference values. Thus, in step S 320 , x 0  is determined as the lowest intensity level which is greater than or equal to the intensity levels of the darkest 3 percent of the pixels for the current color component. 
     In step S 321 , X 3  is determined as the highest intensity level which is lower than or equal to the intensity levels of the brightest 3 percent of the pixels. 
     In step S 322 , x 1  and x 2  are determined as the end points of the portion of the intensity distribution histogram for the current color component which is likely to be relatively low and flat. In the preferred embodiment, x 1  and x 2  are determined as follows. First, segmentation points t 1 , t 2 , . . . t 9  are located such that in each of the 10 intervals between 0 and t 1 , t 1  and t 2 , . . . , and t 9  and 255, the number of pixels is approximately 10 percent of the total number of pixels in the image. Next, starting from the left side, find the first interval which is more than 50 intensity levels long. If this interval is from t j  to t j+1 , then x 1 =t j +10. Similarly, starting from the right side, locate the first interval which is greater than 50 intensity levels long. If this interval is from t j  to t j+1 , then x 2 =t j+1 −10. 
     In step S 324 , the intensity levels are mapped according to the following:        y   =     {           0   ,           x   &lt;     x   0                   y   1     ×       x   -     x   0           x   1     -     x   0                   x   0     ≤   x   &lt;     x   1                     y   1     +       (       y   2     -     y   1       )     ×       x   -     x   1           x   2     -     x   1             ,             x   1     ≤   x   &lt;     x   2                 255   +       (       y   2     -   255     )     ×       x   -     x   3           x   2     -     x   3                     x   2     ≤   x   &lt;   x3               255   ,           x   ≥     x   3                                      
     where x is the pixel intensity of an original pixel and y is the corresponding new pixel intensity, y 1 =x 1 +(x 2 −x 1 )/3, and y 2 =x 2 . 
     In step S 325 , if all color components have been processed, then processing proceeds to step S 330  where the new image is formed. 
     Otherwise, the next color component is selected in step S 326  and processed beginning at step S 320 . 
     An example of the foregoing processing according to the preferred embodiment can be seen with reference to FIGS. 4A and 4B. FIG. 4A illustrates the envelope of an intensity distribution histogram for a single color component of an original image. It is assumed that the original image is not both highkey and lowkey. FIG. 4B illustrates a histogram for the same pixels shown in FIG. 4A, but after performing the contrast enhancement processing steps described above and shown in FIG.  3 . 
     In FIG. 4A, the intensity level corresponding to the darkest 0.5 percent of the pixels (x 0 ′), which is shown as point  40 , is greater than 100. Similarly, the intensity level corresponding to the darkest 0.25 percent of the pixels (x 0 ″), shown as point  41 , is also greater than 100. Accordingly, x 0  is set equal to 100. The intensity level corresponding to the brightest 0.5 percent of the pixels (x 1 ′), shown as point  44 , is greater than 155. Accordingly, x 1  is set equal to x 1 ′. 
     Thus, in FIG. 4B all pixels shown in FIG. 4A having an original intensity level lower than 100 (region  46 ) are mapped to 0 (shown in FIG. 4B as impulse  46 ′ at intensity level 0). Similarly, all pixels in FIG. 4A having an intensity level greater than x 1  (region  47 ) are mapped to level 255 (shown in FIG. 4B as impulse  47 ′ at intensity level 255). Finally, pixels between 100 and x 1  are linearly mapped to the range 0 to 255. Thus, point x 0  in FIG. A, which originally was found at intensity level 100, is mapped to intensity level 0 in FIG.  4 B. Likewise, point x 1  in FIG. 4A, which was originally found at an intensity level corresponding to the brightest 0.5% of the pixels, is mapped to intensity level 255 in FIG.  4 B. 
     FIGS. 5A and 5B depict a situation where the original image is both highkey and lowkey. Specifically, FIG. 5A shows a histogram for a single color component of the original image, and FIG. 5B shows a histogram for the same color component after applying the contrast enhancement process steps described above. 
     In FIG. 5A, x 0  is the intensity level corresponding to the darkest 3 percent of the pixels, x 3  is the intensity level corresponding to the brightest 3 percent of the pixels, and x 1  and x 2  are the intensity levels corresponding to the beginning and end of the low flat portion of the histogram. Also shown on FIG. 5A, y 1  is located one-third of the distance between x 1  and x 2 . 
     Comparing FIGS. 5A and 5B, pixels indicated in FIG. 5A as having an intensity level between 0 and x 0  are mapped to 0 (shown in FIG. 5B by an impulse at 0). Similarly, pixels having an intensity level greater than x 3  in FIG. 5A are mapped to level 255 (also shown in FIG. 5B by an impulse). Each of the remaining intervals A, B and C in FIG. 5A are linearly mapped to corresponding intervals A, B and C in FIG.  5 B. That is, the interval in FIG. 5A from x 0  to x 1  is linearly mapped to the interval in FIG. 5B from 0 to y 1 . The interval from x 1  to x 2  is linearly mapped to the interval y 1  to y 2 . Finally, the interval from x 2  to x 3  is linearly mapped to the interval y 2  to 255. Thus, point x 0  is mapped to the 0 intensity level, point x 1  is mapped to intensity level y 1 , intensity level x 2  is mapped to intensity level y 2  (no intensity change), and intensity x 3  is mapped to intensity level 255. 
     Thus, summarizing the results of the processing by comparing FIG. 5A with FIG. 5B, contrast is eliminated for intensity levels below x 0  and above x 3 , contrast is enhanced between x 0  and x 1  (interval A) and between x 2  and x 3  (interval C), and contrast is reduced between x 1  and x 2  (interval B). Therefore, other than very dark and very bright levels, to which the human eye is not very sensitive, contrast is automatically enhanced for those intensity levels where most of the image information is concentrated and reduced for intensity levels which contain relatively little image information. 
     Automatic Color Cast Removal With Contrast Enhancement 
     A method for automatic color cast removal with contrast enhancement will now be discussed with reference to FIG.  6 . FIG. 6 is a flow diagram showing process steps for performing color cast removal according to a representative embodiment of the invention. The process steps are stored on a computer readable medium, such as disk  15 , for execution by computing equipment  10 . 
     Briefly, according to FIG. 6, pixel intensities are obtained for each color component of an original image. Then, for each color component: (1) an intensity level x 0  is determined based on the intensity level corresponding to the darkest d i  percent of the pixels, (2) an intensity level x 1  is determined based on the intensity level corresponding to the brightest b i  percent of the pixels, (3) pixels having an intensity level less than or equal to x 0  are mapped to 0, (4) pixels having an intensity greater than or equal to x 1  are mapped to an intensity level of 255, and (5) pixels having an intensity level between x 0  and x 1  are linearly mapped to the range 0 to 255. 
     More specifically, in step S 601  pixel intensities corresponding to red, green and blue color components of an original image are input. This might be accomplished by scanning a document containing the image using color scanner  17 , or by retrieving red, green and blue bit maps for the image from disk  15 , or by downloading from a computerized network or the internet. 
     In step S 602 , the first of the three color components is selected. 
     In step S 604 , an intensity level x 0  is determined. First, as an intermediate step, an intensity level x 0 ′ is determined as the lowest intensity level which is greater than or equal to the intensity levels of the darkest d i  percent of the pixels. Preferably, d i =5% for all color components. If x 0 ′ is less than or equal to x d-safety  (preferably, x d-safety =128), then x 0  is set equal to x 0 ′ and processing proceeds to step S 605 . Otherwise, x 0  is set equal to x d-safety . 
     Similarly, in step S 605  an intensity level x 1  is determined. First, as an intermediate step, an intensity level x 1 ′ is determined as the highest intensity level which is less than or equal to the intensity levels of the brightest b i  percent of the pixels. Preferably, b i =3% for all color components. If x 1 ′ is greater than or equal to x b-safety  (preferably, x b-safety =128), then x 1  is set equal to x 1 ′ and processing proceeds to step S 606 . Otherwise, x 1  is set equal to x b-safety . 
     In step S 606 , the pixel intensity levels for the current color component are mapped according to the following:        y   =     {           0   ,           x   &lt;     x   0                 255   ×       x   -     x   0           x   1     -     x   0                   x   0     ≤   x   &lt;     x   1                 255   ,           x   ≥     x   1                                      
     where x is an original pixel intensity and y is the corresponding new pixel intensity. 
     In step S 607 , if all color components have been processed, then processing proceeds to step S 609 . Otherwise, the next color component is selected in step S 608  and then processed beginning with step S 604 . 
     In step S 609 , a new image is formed using the new pixel intensities for each of the red, green and blue color components. For example, the new image might be displayed using color monitor  11  or printed using color printer  16 . 
     An example of the foregoing processing will now be discussed with reference to FIGS. 7A and 7B. FIG. 7A illustrates the envelope of a pixel intensity distribution histogram for a single color component of an original image. FIG. 7B illustrates the envelope of a histogram of the pixels depicted in FIG. 7A after processing according to the color cast removal processing steps described above and shown in FIG.  6 . 
     In FIG. 7A, x 0 ′, the intensity level corresponding to the darkest 5% of the pixels, is less than 128. Accordingly, x 0 =x 0 ′. Similarly, x 1 ′, the intensity level corresponding to the brightest 3% of the pixels, is greater than 128, so x 1 =x 1 ′. 
     Thus, in FIG. 7B all pixels in FIG. 7A having an original intensity level lower than x 0  (region  50 ) are mapped to 0 in FIG.  7 B. Pixels having an intensity level greater than x 1  (region  51 ) are mapped to 255 in FIG. 7B, and pixels between x 0  and x 1  in FIG. 7A are linearly mapped to the range 0 to 255 in FIG.  7 B. Thus, intensity level x 0  is mapped to intensity level 0 and intensity level x 1  is mapped to intensity level 255. 
     Comparing FIGS. 7B to  7 A, it can be seen that the color component represented by the histograms is intensified after processing. That is, the center of the intensity distribution for the color component is shifted from a low intensity level to a mid-level value. As will be seen from the next example, color cast can be removed by strengthening the weak color components, as well as by weakening the strong color components. In addition, other than the very darkest and brightest pixels, contrast is enhanced in the image. That is, the band of intensities in the original image from x 0  to x 1  is mapped to the interval from 0 to 255. Because information is mapped to a wider range of intensity levels, contrast within that region is enhanced. 
     FIGS. 8A through 8C show an example of the results of color cast removal according to the invention. Solid line histograms  101  (FIG.  8 A),  102  (FIG. 8B) and  103  (FIG. 8C) respectively represent the envelopes of histograms showing pixel intensity distributions for the red, green and blue color components of an original image. As can be seen from FIGS. 8A through 8C, the original image has a strong red component, a weak green component and a medium blue component, resulting in an overall reddish cast in the image. Actually, due to the weak green component, the cast is somewhere between red and magenta. 
     However, after color cast removal processing as described above, the reddish cast is reduced. Specifically, after applying the above processing, the interval between x 0  and x 1  for each of histograms  101 ,  102  and  103  is linearly mapped to the interval 0 to 255. The results are shown as dashed line histograms  111 ,  112  and  113 , respectively. 
     As a result of the mappings, peak  105  of histogram  101 , which was originally in the very high intensity levels, is shifted toward the middle intensity levels to new peak  115 . Similarly, after processing, peak  106  of histogram  102  for the green color component, which was originally in the lower intensity levels, is also shifted toward the middle intensity levels to new peak  116 . However, because peak  106  was not originally as far from the middle intensity levels as peak  105 , peak  106  is not shifted as much as peak  105 . Finally, blue peak  107 , which was originally very close to middle intensity level, moves only slightly toward the center, resulting in new peak  117 . 
     Because each of the color components is shifted toward the center of the intensity scale, a better color balance is achieved, thereby reducing the reddish color cast of the original image. In this regard, the color cast is reduced not only by suppressing the red color component, but also by enhancing the green color component. That is, because color cast is caused by an imbalance in the color components (since overall color depends upon the intensities of the color components relative to each other), color cast reduction can be achieved by enhancing weak color components, as well as by attenuating strong color components. In addition, because in each case the pixel intensities are mapped to a wider range than in the original image, a certain amount of contrast enhancement also is provided. 
     In the above two embodiments, preferred values are given for certain variables. However, it should be noted that the invention is not limited to those values, except as expressly defined by the claims. For instance, the values need not be the same for each color component, and need not even be fixed, but might be made variable based on other parameters. 
     Moreover, the above preferred values apply when the foregoing technique is implemented in a fully automatic mode. However, when implemented in the adjustable combined contrast enhancement and color cast removal embodiment described below, different values are specified for certain of the above variables. 
     Adjustable Combined Contrast Enhancement and Color Cast Removal 
     The following describes combined contrast enhancement and color cast removal where the user can adjust the amount of contrast enhancement and the degree of color cast removal by adjusting a single control. 
     In this embodiment, a user is provided with a control having a single degree of freedom. Preferably, the control is a sliding bar included within a graphical user interface. However, the control might consist of a knob, a physical sliding bar, a pair of buttons (one for adjusting up and one for adjusting down), or any of the like. 
     By varying the control the user can select automatic contrast enhancement, automatic color cast removal with contrast enhancement, or an intermediate position. Specifically, adjusting the control causes a variable L to vary in the range between 0 and 100. When L&lt;50, automatic contrast enhancement is performed as described above in connection with FIGS. 3 through 5B. When L≧50, automatic color cast removal with contrast enhancement is performed as described above in connection with FIGS. 6 through 8C. 
     In addition to controlling which process steps are performed, L is used to control the values of the variables used in those processing steps as follows: 
     d i =(0.5%)*(1−L/100)+(5%)*(L/100) 
     d i ′=d i /2 
     b i =(0.5%)*(1−L/100)+(3%)*(L/100) 
     b i ′=b i /2                 x     d   -   safety       =       100   *     (     1   -     L   /   50       )       +     128   *     (     L   /   50     )           ,           L   &lt;   50               128   ,           L   ≥   50                           x     b   -   safety       =       155   *     (     1   -     L   /   50       )       +     128   *     (     L   /   50     )           ,           L   &lt;   50               128   ,           L   ≥   50                                
     It should be noted that while the automatic contrast enhancement steps described above use all of the above variables, the automatic color cast removal discussed above uses all of them except d i ′ and b i ′. 
     FIG. 9 illustrates a representative monitor display for this embodiment. Displayed on monitor  11  is an image to be processed and a GUI including various controls for adjusting image processing parameters, including control  81  which can be adjusted using a printing device such as mouse  14 , and when so adjusted varies the value of L. More specifically, when control  81  is moved, the new position is sensed using conventional techniques, and the value of L is changed. At one extreme L is set equal to 0, and at the other extreme L is set equal to 100. In between, L varies continuously as the position of control  81  changes. According to this embodiment, a user can select within the range between maximum color cast removal and maximum contrast enhancement to be performed on image  80  merely by dragging sliding bar  81  using mouse  14 . 
     The invention has been described with respect to particular illustrative embodiments. However, it is to be understood that the invention is not limited to the above described embodiments and that various changes and modifications may be made by those of ordinary skill in the art without departing from the spirit and scope of the invention. 
     For example, the above embodiments use linear mapping. However, except as defined in the claims, the invention is not limited to linear mapping. Other mapping techniques, such as cube root mapping to mimic human visual perception, might instead be employed.