Brief Description of the Drawings
FIG. 1 is a block diagram showing an embodiment of a color image processing apparatus according to the present invention;
FIG. 2 is a u'-v' chromatically diagram wherein a skin color region and a reference skin color line are defined;
FIG. 3 shows an example of a matrix arrangement of the skin color region shown in FIG. 2;
FIG. 4 is a block diagram showing another embodiment of a color image processing apparatus according to the present invention;
FIG. 5 is a flowchart explaining the operation of the color image processing apparatus shown in FIG. 4;
FIG. 6 is a block diagram showing another embodiment of the color image processing apparatus;
FIG. 7 shows an example of an image having a skin color;
FIG. 8 is a u'-v' chromaticity diagram wherein skin color region and a reference skin color are defined;
FIG. 9 shows a quantized matrix arrangement of the skin color region shown in FIG. 8;
FIG. 10A illustrates a mutual position between the skin color region and an adjustment region;
FIG. 10B shows an example of a weight graph; and
FIG. 11 illustrates a correction quantity determining method according to another embodiment.
Detailed Description of the Preferred Embodiments
The invention will be described in detail with reference to the accompanying drawings. FIG. 1 is a block diagram showing a first embodiment of the present invention. A brief description of this embodiment will be given first
The color image processing apparatus of FIG. 1 is provided with an Luv conversion unit 1, a first skin color count unit 2, a second skin color count unit 3, a pixel number discrimination unit 4, a maximum value discrimination unit 5, a correction quantity operation unit 6, a color correction unit 7, an RGB conversion unit 8, and a signal line 10. The color image processing apparatus of FIG. 4 is provided with a CPU 40, a RAM 42, a ROM 41, an image data input unit 43, and a color correction data output unit 44.
With the construction as above, first, red, green and blue (hereinafter referred to as RGB) values are obtained from an unrepresented image input device. The RGB values are converted into L*, u' and v' values at the Luv conversion unit 1. The number of pixels, which pixels fall within the skin color region of a u'-v' chromaticity diagram, is counted by the first skin color count unit 2. Next, the numbers of pixels, which fall within respective elements of a matrix arrangement of the-skin color region of the u'-v' chromaticity diagram, are counted by the second skin color count unit 3. Then, the number of pixels falling within the skin color region is compared with a threshold value .alpha. at the pixel number discrimination unit 4. If the pixel number is less than .alpha., it is assumed that no skin color exists in the original or that the number of pixels of the skin color is small enough to terminate the procedure. If the pixel number is greater than or equal to .alpha., the element of the matrix arrangement, within which pixels fell at a maximum, is identified at the maximum value discrimination unit 5. A color difference between a reference skin color and the skin color corresponding to the element having a maximum number of pixels is determined to calculate a correction quantity at the correction quantity operation unit 6. This correction quantity is passed to the color correction unit 7 over the signal line 10. The color correction of the image is then performed using the correction quantity. The RGB values are obtained by an unrepresented image input device to convert them into L*, u' and v' values at the Luv conversion unit 1. At the color correction unit 7, L* among the L*, u' and v' values is used as it is, and the remaining u' and v' are corrected as u'.rarw.u'-.DELTA..sup.u, and v'.rarw.v'-.DELTA..sup.v. The corrected L*, u' and v' values are converted back into RGB values at the RGB conversion unit 8 to obtain a color corrected image. The procedure is thus terminated.
The block diagram of FIG. 4 shows an alternative using a computer in place of the first skin color count unit 2 through the correction quantity operation unit 6 in FIG. 4. Based on the L*, u' and v' components input from the image data input unit 43, a correction quantity is calculated in accordance with a program as described with FIG. 5 under control of the CPU 40 using the RAM 42. The correction quantity is output to the color correction unit 7 via the color correction data output unit 44 over the signal line 10.
The brief description of the first embodiment has been given as above. The following is a detailed description therefor. FIG. 1 is a block diagram showing the first embodiment image processing apparatus. An image is assumed to be composed of RGB values. The circuit portion of FIG. 1 including the units 1 to extracts a skin color from an image and obtains a correction quantity, while the circuit portion including the units 7 and 8 performs color correction in accordance with the obtained correction quantity. First, the description will be directed to a procedure for extracting a skin color and obtaining a correction quantity.
First, RGB values are obtained from an original image using an unrepresented image input device. In this case, all of the pixels of the original are not needed, but the center portion of the original omitting its periphery can suffice even on the condition that every second or third pixel within the center portion be used. The reason for this is that a skin color such as that of a human face is located at the middle of an original in most cases. The RGB values thus obtained are converted into L*, u' and v' values at the Luv conversion unit 1. Then the number of pixels, which fall within the skin color region of the u'-v' chromaticity diagram shown in FIG. 2, is counted by the first skin color count unit 2. The skin color region in this embodiment is defined by u'-v' coordinates of (0.22, 0.46), (0.26, 0.46), (0.32, 0.50), (0.32, 0.54), (0.28, 0.54) and (0.22, 0.56), at a range of 30.ltoreq.L*.ltoreq.80. The skin color region is not limited thereto, and different values may be incorporated. Next, the numbers of pixels which fall within respective elements of a matrix arrangement of the skin color region as shown in FIG. 3 are counted by the second skin color count unit 3. In the matrix arrangement of this embodiment, the skin color region is divided in units of 0.05 into intervals in both the u' and v' directions to obtain a matrix A of [16, 20]. Then, the number of pixels falling within the skin color region is compared with a threshold value .alpha. at the pixel number discrimination unit 4. The threshold value .alpha. is preferably 1/4 to 1/5 of the pixel number to be checked. If the pixel number is less than .alpha., it is assumed that no skin color exsits in the original or that the number of pixels of the skin color is small enough to terminate the procedure. If the pixel number is greater than or equal to .alpha., it is determined, at the maximum value discrimination unit 5 by obtaining the maximum values number of in the matrix A, which element of the matrix arrangement had maximum pixels. The values u' and v' of the element are represented using <max>u and <max>v, respectively. A color difference between a reference skin color and the skin color corresponding to the element <max>u, <max>v is obtainied at the correction quantity operation unit 6. The reference skin color is represented in this embodiment by a line, shown in FIG. 2, intersecting two coordinates 0.20, 0.46) and 0.32, 0.54). A color difference (.DELTA.u, .DELTA.v) is obtained by .DELTA.u=<max>.DELTA.u-su and .DELTA.v=<max>v-sv, wherein (su, sv) is an intersection of the reference skin color line with a perpendicular drawn from a coordinate <max>u, <max>v toward the line. The values su and sv are obtained from the following equations.
Assuming that the reference skin color line is represented by v=au+b.sub.1, a perpendicular drawn from a coordinate <max>u, <max>v toward the line is represented by v=1/au+b.sub.2, wherein b.sub.2 =<max>v-1/a<max>u. Accordingly, the equations are given by:
The obtained correction quantities .DELTA.u, .DELTA.v are transferred to the color correction unit 7 over the signal line 10. Next, the entire image is subjected to color correction. The RGB values are obtained from an original image using an unrepresented image input device to convert them into L*, u' and v' values. At the color correction unit 7, L* among the L*, u' and v' values is used as it is, and the remaining u' and v' are corrected as u'.rarw.u'-.DELTA.u, and v'.rarw.v'-.DELTA.v. The corrected L*, u' and v' values are converted back into RGB values at the RGB conversion unit 8 to obtain a color-corrected image. The procedure is thus terminated.
The block diagram of FIG. 4 shows an alternative using a computer in place of the first skin color count unit 2 through the correction quantity operation unit 6 in FIG. 4. Based on the L*, u' and v' components input from the image data input unit 43, a correction quantity is calculated in accordance with a program under control of the CPU 40 using the RAM 42. The correction quantity is output to the color correction unit 7 via the color correction data output unit 44 over the signal line 10.
The operation of calculating a correction quantity will be described with reference to the flowchart of FIG. 5.
First, the RAM 42 and the like are initialized at step S51. L*, u' and v' components of a single pixel are received from the image data input unit 43 at step S52. It is checked at step S53 if the received pixel falls within the skin color region. If not, the flow skips to step S56. If it is a skin color within the region, the counter counting the number of skin color pixels is counted up by one at step S54. At step S55, the appearance number of pixels at the corresponding element in the matrix A 16, 20 of the u'-v' chromaticity diagram of FIG. 3 is counted up. It is judged at step S56 if all the pixels have been checked. If there still remain pixels to be checked, then the flow returns to step S52 and hence to step S56. It is noted that all of the pixels constituting an image need not be checked, as described previously. A skin color appearance probability is calculated at step S57. If the appearance probability is smaller than the threshold value .alpha., then it is judged at step S58 that a skin color exists to a less degree. On the other hand, if the skin color appearance probability is larger than the threshold .alpha., a skin color having a maximum appearance number is discriminated at step S59 in the u'-v' chromaticity diagram formed at step S55. A correction value, which is a deviation of the skin color now concerned from the reference skin color, is calculated at step S60 to output it at step S61 to the color correction unit 7 via the color correction data output unit 44 over the signal line 10. The calculation method of a correction quantity is the same as previously described.
Next, a second embodiment of the present invention will be described. A basic block diagram is shown in FIG. 6 wherein units having a similar function to those in FIG. 1 have been represented using identical reference numerals, and the description, therefore is omitted.
Referring to FIG. 2, a first skin color count unit 2' counts the number of pixels falling within the skin color region defined on the u'-v' chromaticity diagram and outputs a signal for enabling color correction by a color correction unit 7' at a time when color correction is performed on the condition that the pixel concerned has been judged as a skin color. The color correction unit 7' performs color correction in response to a signal representative of a color correction quantity from the color correction quantity operaton unit 6 and in response to a signal from the first skin color count unit 2' which is representative of the fact that the pixel concerned has fallen within the skin color region. The color correction region 7' performs color correction with respect to the skin color region and its extended region, excluding the othner region.
The operation will be described below. First, the procedure of extracting a skin color and judging if color correction is to be performed will be described.
First, RGB values are obtained from an original image using an unrepresented image input device. In this case, all of the pixels of the original are not needed in judging if color correction is to be performed, but the center portion (e.g. region 50 of FIG. 7) of the original omitting its periphery can suffice even on the condition that every second or third pixel within the center portion be used. One of the reasons for this is that in the color image processing apparatus whose object is reproducing a skin color since a skin color such as that of a human face is located at the middle of an original in most cases, as shown in FIG. 7, it is possible to use as its object region only the region 50 including a skin color in judging if color correction is to be performed. Another reason is that since a skin color changes abruptly, every second or third pixel may suffice. On the contrary, if an object to be corrected is not located at the center of an original, it is then necessary to use as a judgment region the entire image or the portion upon which an object color concentrates.
The RGB values thus obtained are converted into L*, u' and v' values at the Luv conversion unit 1. Then, the number of pixels, which have a chromaticity within a skin color region 100 of the u'v' chromaticity diagram shown in FIG. 8, is counted by the first skin color count unit 2'. The counted number of pixels is used in judging if an image includes a number of pixels having a color to be corrected. The skin color region 100 in this embodiment is defined by u'-v' coordinates of 0.22, 0.46), 0.26, 0.46), 0.32, 0.50), (0.32, 0.54), (0.28, 0.54) and (0.22, 0.50), at a range of 30.ltoreq.=L*.ltoreq.80. The skin color region is not limited thereto, and different values may be incorporated.
Next, the numbers of pixels (u', v'), which fall within respective elements of a matrix arrangement 150 shown in FIG. 9 of the skin color region 100, is counted by the second skin color count unit 3 to obtain a frequency distribution of each pixel (u' v'). In the matrix arrangement shown in FIG. 9, the skin color region 100 is divided in units of 0.05 into in both the u' and v' directions to obtain a matrix A of [16, 20]. Then, the number of pixels falling within the skin color region 100, which number has been counted by the first skin color count unit 2', is compared with a threshold value .beta. at the pixel number discrimination unit 4. If the pixel number is less than .beta., it is assumed that no skin color exsits in the original or that the number of pixels of the skin color is small, so that it is not necessary to perform color correction. Thus, the correction quantity operation unit does not output any correction quantity on the signal line 10. The threshold value .beta. is preferably 1/4 to 1/5 of the pixel number to be checked.
In the case where the pixel number is greater than or equal to .beta., the image concerned includes a plurality of pixels having a color to be corrected. Then, the max value discrimination unit 5 determines, by obtaining a maximum value in the matrix A from the frequency distribution obtained from the second skin color count unit 3, which element of the matrix arrangement had a maximum number of pixels having a chromaticity within the skin color region of FIG. 9. The values u' and v' of the element are represented using <max>u and <max>v, respectively.
A color difference between a predetermined reference skin color 110 (stored color) and the skin color corresponding to the element <max>u, <max>v) is obtained at the correction quantity operation unit 6.
The reference skin color 110 is represented in this embodiment by a coordinate (u', v')=(0.2475, 0.4875). Then, the color difference (.DELTA.u, .DELTA.v) can be given by:
If an image is reproduced or printed as is, the skin color at pixel (<max>u, <max>v) becomes a color near to a skin color but apparently deteriorated in quality because of the characteristics of the image reading system. On the other hand the reference skin color represents a skin color in conformity with the printing-out system including the ink to be used. Consequently, the color difference (.DELTA.u, .DELTA.v) represents a distance between the potential skin color of an input image and the reference skin color. In this embodiment, the color difference (.DELTA.u, .DELTA.v) is used as a maximum correction quantity in performing color correction.
Color correction is effected as in the following. One correction method is to correct all the pixels within the region 100 using uniformly the same correction quantity (.DELTA.u, .DELTA.v) for all of them. This method, however, loses "smoothness" of an image. In view of this, according to another method, the region as an object to be corrected is broadened to an extended region (correction region) 200 which is broader than the region (skin color region) 100, as shown in FIG. 10A. It is preferable that the extended region has a substantially similar configuration as to the region 100, for example as defined by coordinates (0.20, 0.44), (0.28, 0.44), (0.34, 0.48), (0.34, 0.56), (0.26, 0.56)and (0.20, 0.52). Using the color difference (.DELTA.u, .DELTA.v) as a maximum correction quantity, the elements falling within the extended region 200 are corrected to have a desired weight to thereby achieve "smoothness". As an example of weighting, a change of weight (w) on a line X--X' in FIG. 10A is shown in FIG. 10B. In particular, the weight (w) within the region 100 is made "1", while the weight within the extended region 2 and outside the region 100 is made to gradually reduce. Outside the extended region, the weight is obviously "0". Accordingly, the pixel after color correction is calculated as follows:
where w(x, y) is an element of a matrix w [24, 28] having the same element interval as that of the matrix A [16, 20] described previously.
The first skin color count unit 2' outputs a signal indicating if a pixel concerned falls within the skin color region 100, the extended region 200, or the other region. Based on this signal, the color correction unit 7' performs color correction using the color difference (.DELTA.u, .DELTA.v) for those pixels falling within the skin color region 100, using another color difference for each of the other pixels within the extended region 200 and outside the region 100, which color difference becomes gradually smaller as the pixels go away from the region 100. Those pixels falling outside the extended region 200 are not subjected to color correction.
Next, still another correction method will be given below. With this method, a reference skin color
is not fixed at a coordinate (0.2475, 0.4875) but can have any color (su, sv) on a line intersecting two coordinates (0.20, 0.46) and (0.32, 0.54) as shown in FIG. 11. This line is a predetermined reference color line which can be considered experimentally as the most suitable line. A reference color on this line is determined based on the value (<max>u, <max>v) calculated from an input image. A color difference (.DELTA.u, .DELTA.v) is obtained by .DELTA.u=<max.DELTA.u-su and .DELTA.v=<max>v-sv, wherein (su, sv) is an intersection on the reference skin color line of a perpendicular drawn from a coordinate (<max>u, <max>v) toward the line. The values su and sv are obtained from the following equations.
Assuming that the reference skin color line is represented by v=au+b.sub.1, a perpendicular drawn from a coordinate (<max>u, <max>v) toward the line is represented by v=-(1/a)u+b.sub.2, wherein b.sub.2 =(<max>v-<max>u). Accordingly, the equations are given by:
The determined correction quantity together with the weight as explained in FIGS. 10A and 10B is used for color correction to obtain a natural skin color. As compared with the method using a fixed reference skin color shown in FIG. 8 wherein a correction quantity will become excessive in a certain input image, the correction quantity most suitable for the skin color of an input image can be calculated with the method of FIG. 11, and in addition, there is no case where the correction quantity becomes too large.
After determining the correction quantity (.DELTA.u, .DELTA.v), it is output via the signal line 10 to the RGB values are converted into L*, u' and v' by the Luv conversion unit 1. At the color correction unit 7, L* among the L*, u' and v' values is used as it is, and the remaining u' and v' of the pixels falling within the skin color region and the extended region are corrected as u'.rarw.u'-.DELTA.u, and v'.rarw.v'-.DELTA.v. The corrected L*, u' and v' values are converted back into RGB values at the RGB conversion unit 8 to obtain a color-corrected image. The procedure is thus terminated.
In the above embodiments, RGB values of an image are read twice at a time of determining a correction quantity and at a time of performing color correction. Since the color correction quantity can be considered as having a more or less fixed value to be determined from the characteristics of the image reading system and the image output system, it is possible to perform color correction in real time every time an image is input, without reading the image two times, by using a correction quantity obtained by a fixed reference color method of FIG. 8 or by a variable reference color method of FIG. 11 and stored in a ROM or the like.
As seen from the above description of the embodiments, by shifting a pixel location where pixels having a skin color of an image exist at a maximum to another pixel location of a skin color having a proper tone, it is possible to automatically perform color correction of a skin color to a proper skin color. Further, by incorporating the region outside the skin color region as an object region to be corrected, a smooth color correction can be achieved.
As an object color to be corrected in the color image processing apparatus, a skin color has been used since it is most sensitive and perceptible to humans and needs to be color-corrected. If color reproduction with high fidelity is desired, any desired color may be used as an object to be corrected.
In the above embodiments, color correction is performed through conversion between RGB values and L*, u' and v' values. However, instead of L*, u' and v', another color space coordinate system may be adopted. Also, RGB, YMC or other data may be used as input image data.
As above, the present invention can achieve a color image processing apparatus capable of judging a necessity of color correction of an image and obtaining a proper color correction quantity.
The present invention is not limited to the above embodiments, but various applications and modifications are possible without departing from the scope of the appended claims.