Abstract:
A color image processing provides a thin-line enhancement module for a color image for finding and keeping thin lines in the color image. A boundary enhancement module is provided for finding and keeping the boundary in the color image. A de-background module is provided for removing noise pixels from white background. The color image is processed to avoid missing and/or twisting the thin lines, boundary, background, and texts in the color image after the scanning procedure.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a color image processing method with thin-line detection and enhancement. 
     2. Description of the Related Art 
     Nowadays, computers are widely used to process color images generated as a result of scanning pictures by scanners. A normal procedure includes scanning a picture by a scanner and then using image-editing software(s) to edit the color image generated as a result of scanning. Nevertheless, it is often found that the color image is not clear and in disagreement with the picture in a certain degree, particularly in thin lines, boundary, background, and texts. More specifically, thin lines, boundary, background, and texts in the picture are often missing or twisted in the color image after the scanning procedure. This provides a poor ground for the subsequent color image editing. 
     The present invention is intended to provide a color image processing method that mitigates and/or obviates the above problems. 
     SUMMARY OF THE INVENTION 
     It is the primary object of the present invention to provide a color image processing that provides a thin-line enhancement module for a color image, thereby finding and keeping thin lines in the color image. 
     Other objects, advantages, and novel features of the invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a flow chart illustrating a method in accordance with the present invention for processing a color image as a result of scanning a picture. 
     FIG. 2 is a 5×5 pixel window generated for discriminating purposes. 
     FIG. 3 is a 3×5 pixel window generated for discriminating purposes. 
     FIG. 4 is a 3×3 pixel window generated for discriminating purposes. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     Referring to FIG. 1, a method in accordance with the present invention is provided for enhancing a color image generated as a result of scanning a picture. Namely, a picture is scanned by a scanner connected to a computer to generate a color image. A first step of the method in accordance with the present invention includes detecting thin lines in the color image by a thin-line enhancement module  10 . In this step, a 3×5 (or 5×3) pixel window (or array) and a 5×5 pixel window are created for each pixel in the color image. The 3×5 (or 5×3) pixel window and the 5×5 pixel window are based and centered on a selected pixel in the color image. 
     Definition 
     For a 5×5 pixel window shown in FIG. 2, the sum of color values of the left two columns (P 1 , P 6 , P 11 , P 16 , P 21 , P 2 , P 7 , P 12 , P 17 , P 22 ) is defined as L 55 , the sum of color values of the middle column (P 3 , P 8 , P 13 , P 18 , P 23 ) is defined as V 5 , and V 55 =2*V 5 , and the sum of color values of the right two columns (P 4 , P 9 , P 14 , P 19 , P 24 , P 5 , P 10 , P 15 , P 20 , P 25 ) is defined as R 55 . It is noted that the selected pixel on which the 5×5 pixel window is based is located in the center of the middle column. The sum of color values of the upper two rows (P 1 ˜P 10 ) is defined as U 55 , the sum of color values of the middle row (P 11 ˜P 15 ) is defined as H 5 , and H 55 =2*H 5 , and the sum of color values of the lower two rows (P 16 ˜P 25 ) is defined as D 55 . The term “color value” referred to herein means the hue value for each pixel. 
     For a 3×5 pixel window shown in FIG. 3, the sum of color values of the left column (P 1 , P 4 , P 7 , P 10 , P 13 ) is defined as L 3 , and L 35 =2*L 3 , the sum of color values of the middle column (P 2 , P 5 , P 8 , P 11 , P 14 ) is defined as V 3 , and V 35 =2*V 3 , and the sum of color values of the right column (P 3 , P 6 , P 9 , P 12 , P 15 ) is defined as R 3 , and R 35 =2*R 3 . It is noted that the selected pixel on which the 3×5 pixel window is based is located in the center of the middle column. For a 5×3 pixel window shown in FIG. 4, the sum of color values of the upper row (P 1 ˜P 5 ) is defined as U 3 , and U 53 =2*U 3 , the sum of color values of the middle row (P 6 ˜P 10 ) is defined as H 3 , and H 53 =2*H 3 , and the sum of color values of the lower row (P 11 ˜P 15 ) is defined as D 3 , and D 53 =2*D 3 . 
     For a 5×5 pixel window, the sum of color values of three pixels P 3 , P 7 , P 11  (FIG. 2) is defined as LU 45 _ 3 ; the sum of color values of three pixels P 9 , P 13 , P 17  is defined as LV 45 _ 3 ; and the sum of color values of three pixels P 15 , P 19 , P 23  is defined as LD 45 _ 3 . In addition, the sum of color values of three pixels P 3 , P 9 , P 15  is defined as RV 45 _ 3 ; the sum of color values of three pixels P 7 , P 13 , P 19  is defined as RU 45 _ 3 ; and the sum of color values of three pixels P 11 , P 17 , P 23  is defined as RD 45 _ 3 . 
     A thin line is defined as a line with a one (1)-pixel width. 
     Since the red, green, and blue channels are digitized and thus all fall in the range of 0˜255, two thresholds, e.g., 30 (T 45 ) and 225 (T 46 ) are selected for determining the values for txcount and bgcount (both of which will be described later). For the twenty-five points in the 5×5 pixel window, distribution of each of the 25 points is considered. The txcount is added by one (1) if all of the hue values of the red, green, and blue channels fall in a range of 0˜30. The txcount is reset to be zero when considering another pixel in the color image based on which another pixel window is created. The bgcount is added by one (1) if all of the hue values of the red, green, and blue channels fall in a range of 225˜255. The bgcount is reset to be zero when considering another pixel in the color image based on which another pixel window is created. 
     Thin-Line Detection 
     Since there are three primary colors (red, green and blue, the so-called three channels), separate considerations are required. Namely, the hue value for each primary color for each pixel must be considered. For the red channel of each pixel, the maximum hue value is 255 for red and 0 for black. Equation (1) is given below to determine whether a thin-line exists when taking the red channel into considerations. 
     
       
         (L 55 r−V 55 r)≧T 1  and (R 55 r−V 55 r)≧T 2   (1) 
       
     
     wherein T 1  and T 2  are predetermined thresholds. 
     Similarly, Equation (2) is given below to determine whether a thin-line exists when taking the green channel into consideration. 
     
       
         (L 55 g−V 55 g)≧T 3  and (R 55 g−V 55 g)≧T 4   (2) 
       
     
     wherein T 3  and T 4  are predetermined thresholds. 
     Similarly, Equation (3) is given below to determine whether a thin-line exists when taking the blue channel into consideration. 
     
       
         (L 55 b−V 55 b)≧T 5  and (R 55 b−V 55 b)≧T 6   (3) 
       
     
     wherein T 5  and T 6  are predetermined thresholds. 
     It is discriminated that a vertical thin line exists if any one of Equations (1), (2), and (3) is fulfilled. 
     Similarly, it is discriminated that a horizontal line exists if any one of the following Equations (4), (5), and (6) is fulfilled. 
     
       
         (U 55 r−H 55 r)≧T 7  and (D 55 r−H 55 r)≧T 8   (4) 
       
     
     wherein T 7  and T 8  are predetermined thresholds for the red channel. 
     
       
         (U 55 g−H 55 g)≧T 9  and (D 55 g−H 55 g)≧T 10   (5) 
       
     
     wherein T 9  and T 10  are predetermined thresholds for the green channel. 
     
       
         (U 55 b−H 55 b)≧T 11  and (D 55 b−H 55 b)≧T 12   (6) 
       
     
     wherein T 11  and T 12  are predetermined thresholds for the blue channel. 
     It is appreciated that T 1 ˜T 12  are preferably of the same value, e.g., 512. 
     The following Equations (7), (8) (9) are used to discriminate existence of a thin-line of a slope of 1. 
     
       
         (LU 45 _ 3 r−LV 45 _ 3 r)≧T 13  and (LD 45 _ 3 r−LV 45 _ 3 r)≧T 14   (7) 
       
     
     wherein T 13  and T 14  are predetermined thresholds for the red channel. 
     
       
         (LU 45 _ 3 g−LV 45 _ 3 g)≧T 15  and (LD 45 _ 3 g−LV 45 _ 3 g)≧T 16   (8) 
       
     
     wherein T 15  and T 16  are predetermined thresholds for the green channel. 
     
       
         (LU 45 _ 3 b−LV 45 _ 3 b)≧T 17  and (LD 45 _ 3 b−LV 45 _ 3 b)≧T 18   (9) 
       
     
     wherein T 17  and T 18  are predetermined thresholds for the blue channel. 
     It is discriminated that a thin line having a slope of 1 exists if any one of Equations (7), (8), and (9) is fulfilled. 
     The following Equations (10), (11) (12) are used to discriminate existence of a thin-line of a slope of −1. 
     
       
         (RU 45 _ 3 r−RV 45 _ 3 r)≧T 19  and (RD 45 _ 3 r−RV 45 _ 3 r)≧T 20   (10) 
       
     
     wherein T 19  and T 20  are predetermined thresholds for the red channel. 
     
       
         (RU 45 _ 3 g−RV 45 _ 3 g)≧T 21  and (RD 45 _ 3 g−RV 45 _ 3 g)≧T 22   (11) 
       
     
     wherein T 21  and T 22  are predetermined thresholds for the green channel. 
     
       
         (RU 45 _ 3 b−RV 453 b)≧T 23  and (RD 45 _ 3 b−RV 45 _ 3 b)≧T 24   (12) 
       
     
     wherein T 23  and T 24  are predetermined thresholds for the blue channel. 
     It is discriminated that a thin line having a slope of −1 exists if any one of Equations (10), (11), and (12) is fulfilled. 
     It is appreciated that T 13 ˜T 24  are preferably of the same value. 
     If a thin line is detected, then a thin-line enhancing procedure is applied to the data inspected to thereby make the thin line vivid; if not, the data is then passed to a boundary enhancement module. The thin-line enhancing procedure is accomplished by a thin-line enhancement means  12 . If no thin line is detected, the data is passed to a boundary enhancement module  20 . 
     Black and White Boundary Detection 
     A boundary is defined as a transition between two blocks of different colors that has no thin-line. The following Equations (13), (14), and (15) are used to detect whether a vertical boundary exists. 
     
       
         |(L 55 r−R 55 r)|≧T 25  and |(L 35 r−R 35 r)|≧T 26   (13) 
       
     
     wherein T 25  and T 26  are predetermined thresholds for the red channel. 
     
       
         |(L 55 g−R 55 g)|≧T 27  and |(L 35 g−R 35 g)|≧T 28   (14) 
       
     
     wherein T 27  and T 28  are predetermined thresholds for the green channel. 
     
       
         |(L 55 b−R 55 b)|≧T 29  and |(L 35 b−R 35 b)|≧T 30   (15) 
       
     
     wherein T 29  and T 30  are predetermined thresholds for the blue channel. 
     It is discriminated that a vertical boundary exists if any one of Equations (13), (14), and (15) is fulfilled. 
     Similarly, Equations (16), (17), (18) are used to detect whether a horizontal boundary exists. 
     
       
         |(U 55 r−D 55 r)|≧T 31  and |(U 53 r−D 53 r)|≧T 32   (16) 
       
     
     wherein T 31  and T 32  are predetermined values for the red channel. 
     
       
         (U 55 g−D 55 g)|≧T 33  and |(U 53 g−D 53 g)|≧T 34   (17) 
       
     
     wherein T 33  and T 34  are predetermined values for the green channel. 
     
       
         |(U 55 b−D 55 b)|≧T 35  and |(U 53 b−D 53 b)|≧T 36   (18) 
       
     
     wherein T 35  and T 36  are predetermined values for the blue channel. 
     If any one of Equations (16), (17), and (18) is fulfilled, it is discriminated as existence of a horizontal boundary. 
     Preferably, T 25 ˜T 36  are of the same value, e.g., 192. 
     In Equations (13)˜(15), both 5×5 and 3×5 pixel windows are used to discriminate existence of a vertical boundary. It is noted that it is possible to discriminate existence of a vertical boundary by only one pixel window (5×5 or 3×5), i.e., Equation (13) becomes 
     
       
         |(L 55 r−R 55 r)|≧T 25   (13a) 
       
     
     or 
     
       
         |(L 35 r−R 35 r)|≧T 25   (13b) 
       
     
     Equations (14) and (15) may be modified similarly. Nevertheless, it is found that misdiscrimination of the vertical boundary can be avoided by means of using Equations (13)˜(15). The same situations exist in Equations (16)˜(18), which will not be described in detail to avoid redundancy. 
     If a boundary is detected, then the boundary enhancement module  20  checks if it is a black-white boundary (i.e., one side is black and the other side is white). If a black-white boundary is detected, then a strong sharpness filter  22  is applied; otherwise, a weak sharpness filter  24  is used. The strong sharpness filter  22  causes the output to be sharper than that by the weak sharpness filter  24 . If no boundary is detected, the data are then passed to a de-background module  30 . Discrimination standards for the black-white boundary for a 5×5 pixel window are as follows: 
     If any one of Equations (13)(15) is fulfilled, the weak sharpness filter  24  is activated. If all of Equations (13)˜(15) are fulfilled, the strong sharpness filter  22  is activated if the following Equation (19) is fulfilled (i.e., a black-white vertical boundary is detected): 
     
       
         bgcount≧T 37  andtxcount≧T 38   (19) 
       
     
     wherein T 37  (e.g., 0) and T 38  (e.g., 15) are predetermined values and wherein 0≧txcount≧25, 0≧bgcount≧25, and 0≧(txcount+bgcount)≧25. 
     If the bgcount is greater than T 37  and the txcount is greater than T 38 , the strong sharpness filter  22  is activated. T 37  and T 38  are both adjustable. 
     Similarly, if any one of Equations (16)˜(18) is fulfilled, the weak sharpness filter  24  is activated. If all of Equations (16)˜(18) and Equation (19) are fulfilled (i.e., a black-white horizontal boundary is detected), the strong sharpness filter  22  is activated. 
     White or Black Background Detection 
     The de-background module  30  deals with black texts on white backgrounds for removing noise pixels from a white background. If a white background is detected, it is checked whether there are black data on the white background. If yes, a de-background filter  32  is applied for removing the noise pixel from the white background; otherwise, nothing is done. If the background is not white, the data are then passed to a de-screen module  40 . 
     Equations (20) and (21) are used to determine whether to activate the de-background filter  32 : 
     
       
         bgcount≧T 39  and txcount&lt;T 40   (20) 
       
     
     
       
         bgcount≧T 41  and txcount&lt;T 42   (21) 
       
     
     In an embodiment of the invention, T 39 =10; T 40 =15; T 41 =8; and T 42 =8. 
     The de-background filter is activated if either one of Equations (20) and (21) is fulfilled while all of the hue values of the red, green, and blue channels of the center point for the 5×5 pixel window are greater than a predetermined threshold T 43  or smaller than a predetermined threshold T 44 . T 43  and T 44  are both adjustable. 
     De-Screen Module 
     The de-screen module  40  deals with non-black-and-white data. It removes artificial white lines on the color picture caused by screening. A smoothing filter  42  is applied to the data for smoothing the data. 
     Conclusion 
     According to the above description, it is appreciated that the thin-lines, boundary, background, and texts in the color image may be well processed to be as true as the color picture. Although a certain sequence is mentioned in the embodiment, it is appreciated that the steps of the method in accordance with the present invention can be arranged in a different sequence. Namely, the method for enhancing color images in accordance with the present invention includes any optional combinations of the above-mentioned steps. In addition, the Equations (1)˜(21) may be optionally modified according to needs. 
     Although the invention has been explained in relation to its preferred embodiment, it is to be understood that many other possible modifications and variations can be made without departing from the spirit and scope of the invention as hereinafter claimed.