Method for eliminating a color edge and apparatus thereof
A method for eliminating a color edge on a digital color image includes finding a boundary between two color blocks on the digital color image, and finding a suitable parameter to adjust the color saturation of this boundary so as to prevent an undesired color from appearing on the boundary.
This application claims the benefit of Taiwan application Ser. No. 092120593, filed on Jul. 29, 2003, the subject matter of which is incorporated herein by reference.
BACKGROUND OF THE INVENTION1. Field of the Invention
The invention relates in general to a digital color image processing method and an apparatus thereof, and more particularly to a method for eliminating a color edge of a color image and an apparatus thereof.
2. Description of the Related Art
The sensor device, such as a CCD (charge coupled device) or a CMOS (Complementary Metal-Oxide Semiconductor) sensor device, is currently used in the digital still camera (DSC). A sensor module with 640×480 pixels will be described as an example.
Hence, when the light ray passes through the color filter and then reaches the sensor device 105 of the sensor module 100, each sensor device 105 can only sense the luminance of the monochromatic (R or G or B). In
Since each sensor device 105 can only sense one of the RGB light rays and generate the induction current, the luminance levels obtained by other sensor devices for sensing other colors of ambient light has to be used in conjunction with interpolation because the color of each pixel is composed by the R, G, and B values.
When some pixels are located on a junctional portion between color blocks of the digital color image, the color of the pixel derived using the interpolation method may include undesired colors. In this context, this phenomenon is defined as a color edge of the digital color image.
In the two color blocks 200 and 210, the color edge tends to appear at positions of B24, B44 and B64 on the junctional portion between the color blocks 200 and 210. Taking the B44 position as an example, when the color at the B44 position is calculated by way of interpolation, the R and G values around the B44 position are respectively averaged to determine the R and G values at the B44 position. The color at the B44 position may be determined according to the determined R and G values in conjunction with the B value at the B44 position.
Thus, the derived R, G and B values at the B44 position using the interpolation method are:
R=(255(R33)+0(R35)+255(R53)+0(R55))/4=152.5,
G=(0(G34)+0(G54)+0(G43)+255(G45))/4=63.75, and
B=0(B44).
Hence, the R, G, and B values which are determined by way of interpolation at the B44 position are 152.5, 63.75, and 0, respectively. That is, the color at the B44 position is close to the yellow color. Because the B44 position belongs to the block 200 to be formed into red, the R and G values of the block 200 to be formed into green are utilized when the R and G values at the B44 position are determined by way of interpolation. That is, R and G values represented at the R35, R55, and G45 positions cannot be the desired R and G values at the B44 position.
When the block 200 representative of red has the yellow color at the boundary of B44 position, the undesired color appears on the boundary of the red block 200 in the digital color image, which is referred to as the color edge.
Therefore, when the color edge appears at the junctional portion between the red block 200 and the green block 210 in the digital color image, the boundary between the blocks 200 are 210 is blurred. Similarly, when the color edges appear on each block in the digital color image, the smoothness of the overall digital color image becomes poor.
SUMMARY OF THE INVENTIONIt is therefore one of the objects of the invention to provide a method for eliminating a color edge on a digital color image and an apparatus thereof. According to the invention, the undesired color on the junctional portion between blocks in the color image is effectively eliminated, and the quality of the overall digital color image is enhanced.
The invention achieves the above-identified object by providing a method including the steps of finding a boundary at a junctional portion between two color blocks in a digital color image, and finding a suitable parameter to adjust the chrominance of the boundary.
According to a preferred embodiment of the invention, in the step of finding the boundary between two color blocks in the color image, the boundary is found according to luminance differences between a pixel and its ambient pixels in the digital color image, and then the chrominance on the boundary is adjusted to eliminate the color edge at the junctional portion between two color blocks.
Other objects, features, and advantages of the invention will become apparent from the following detailed description of the preferred but non-limiting embodiments. The following description is made with reference to the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
In the method of this invention, a boundary between two color blocks on a digital color image is found, and then the color of the boundary pixel representative of the color block is eliminated in order to avoid the color edge on the boundary pixel.
The boundary between two adjacent color blocks on the digital color image can be determined according to the luminance differences between the pixel and its ambient pixels on the digital color image by using a first-order or even a higher-order high-pass filter. Additionally, color conversion of R, G and B values of each pixel on the digital color image into the color luminance and chrominance (corresponding to the hue and saturation) of each pixel is well-known in the art. Thus, the preferred embodiment of the invention first applies a sensor device and an interpolation method to obtain the R, G and B values of each pixel corresponding to the digital color image. The R, G and B values of each pixel are then converted into the luminance (Y) and chrominance (Cb,Cr) of the pixel by way of color converting. Next, in this embodiment, the unit luminance differences between each pixel and its ambient pixels are derived according to the first-order derivative, thereby determining the boundary between the color blocks in the digital color image.
After the luminance level (Y) of each pixel on the digital color image is found, the boundary between adjacent color blocks on the digital color image can be found according to the luminance differences between each pixel and its ambient pixels. Taking the pixel with the luminance of Y11 of
E(Y11)==(|Y12−Y10|+|Y21−Y01|)÷2.
In a microscopic view, the E(Y11) value represents the luminance variation between the pixel and its adjacent pixels in the digital color image. In a macroscopic view, the E(Y11) value represents the boundary between the color blocks in the digital color image. In addition, the E(Y11) value will also represent the apparent degree of the boundary between two color blocks on the digital color image. In other words, the greater the E(Y11) value is, the more apparent the boundary between two adjacent color blocks is, while the smaller the E(Y11) value is, the smaller the color difference between two adjacent color blocks is.
Therefore, as the E(Y11) value gets greater, it is represented that the boundary does exist between two adjacent color blocks on the digital color image as well as that the more apparent color edge does exist between two adjacent color blocks, and vice versa.
As a result, according to the above-mentioned description, the magnitude of the E(Y11) value will determine the modification degrees of Cb and Cr. In the preferred embodiment of the invention, a smooth descending function such as a cosine function (Cos)n serves as the variable parameter (Gain) for modifying Cb and Cr, and the variable parameter varies to modify Cb and Cr according to the E(Y11) value. The modified Cb11 and Cr11 will be:
Cb11′=Cos((E(Y11)÷2Q)π)n×Cb11, and
Cr11′=Cos((E(Y11)÷2Q)π)n×Cr11.
In addition, the greater E(Y11) value represents that the boundary does exist between two adjacent color blocks on the digital color image and also that the more apparent color edge does appear on the two adjacent color blocks. Hence, when the E(Y11) value gets larger, the downward modification amounts for Cb11 and Cr11 are greater and the Gain is smaller.
The value of n in the variable parameter (Gain) also determines the modification degree of Cb11 and Cr11, as shown in
When the E(Yab) value gets greater, the downward modification amounts of Cbab and Crab are also greater and the Gain is smaller. Thus, when E(Yab)=255, Gain=0; or otherwise when E(Yab)=0, Gain=1. If the value of n in Gain is 1, the curve distribution of Gain is smooth. If the value of n in Gain is 4, the curve distribution of Gain is steeper as compared to that when the value of n is 1. In other words, if the value of n is greater, the curve of E(Yab) can vary with E(Yab) more rapidly. That is, the color edge represented by E(Yab) can be eliminated more quickly. In the preferred embodiment of the invention, the suitable value of n is 4.
Consequently, the boundary (edge) at the junctional portion between two color blocks on the digital color image is found according to the unit luminance difference amount (E(Yab)) between the pixel Yab and its ambient pixels on the digital color image. In addition, the degree of the color edge appears at the junctional portion between two color blocks on the digital color image is reduced because the color (Cbab, Crab) of the pixel Yab is eliminated according to E(Yab) such that the color of the boundary pixel Yab between two color blocks on the digital color image is extracted out. Thus, the undesired color and the color edge can be avoided.
It is to be noted that while the first and second color factors are adjusted on the basis of the cosine function in the above-mentioned embodiment, the invention is not limited thereto. Any smooth descending function that is properly functionally transferred may be applied to the invention. Besides, the first and second color factors can be adjusted by using a look-up-table, which also falls into the scope of the present invention.
The method disclosed in the embodiment of the present invention can be carried out by an apparatus including a sensor for determining the color representing by a red (R), a green (G), and a blue (B) value of each of the pixels; a converting logic for converting the red, the green, and the blue values into the luminance and the chrominance of each of the pixels; a boundary determining logic for determining a boundary between a first color block and a second color of the digital color image according to a luminance difference of at least a first pixel belonging to the first color block and at least a second pixel adjacent to the first pixel belonging to the second color block; and a chrominance adjusting logic for adjusting the chrominance of at least one of the first and the second pixels according to the luminance difference. It should be noted that the function of each device of the apparatus is described in this specification and people skilled in the art can easily implemented the devices according to the above description of this specification.
In summary, the invention discloses a method and an apparatus for eliminating the color edge by finding a boundary between two color blocks on the digital color image by a high-pass filter. In addition, a smooth descending function serves as a parameter to adjust the color saturation of the boundary pixel between two color blocks on the digital color image. Thus, the color edge on the digital color image is avoided, and the quality of the digital color image is enhanced.
While the invention has been described by way of example and in terms of a preferred embodiment, it is to be understood that the invention is not limited thereto. On the contrary, it is intended to cover various modifications and similar arrangements and procedures, and the scope of the appended claims therefore should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements and procedures.
Claims
1. A method for eliminating a color edge on a digital color image, which comprises a plurality of pixels, wherein the color of each pixel is represented by a luminance and a chrominance, the method comprising the steps of:
- determining a boundary between a first color block and a second color of the digital color image according to a luminance difference of at least a first pixel belonging to the first color block and at least a second pixel adjacent to the first pixel belonging to the second color block; and
- adjusting the chrominance of at least one of the first and the second pixels according to the luminance difference.
2. The method according to claim 1, further comprising the steps of:
- determining the color representing by a red (R), a green (G), and a blue (B) value of each of the pixels; and
- converting the red, the green, and the blue values into the luminance and the chrominance of each of the pixels.
3. The method according to claim 1, wherein the luminance difference of the first pixel is determined according to the luminance of the first pixel and the luminance of at least one of the pixels adjacent to the first pixel.
4. The method according to claim 3, wherein the luminance difference is determined according to the luminance of the first pixel and the luminances of a second pixel, a third pixel, a fourth pixel and a fifth pixel adjacent to the first pixel, wherein the luminance of the first to fifth pixels are represented by Y11, Y10, Y12, Y01, and Y21, and the luminance difference E (Y11) is: E(Y11)=(|Y12−Y10|+|Y21−Y01|)÷2.
5. The method according to claim 1, wherein the chrominance is adjusted according to a transfer function with the luminance difference serving as an independent variable.
6. The method according to claim 5, wherein the transfer function is a smooth descending function.
7. The method according to claim 5, wherein the transfer function is a cosine function.
8. The method according to claim 7, wherein the transfer function is a cosine function to an n-th power, and n>1.
9. The method according to claim 8, wherein the transfer function is cos((E(Y1)÷2Q)π)n, wherein E(Y1) represents the luminance difference of the first color pixel, Q represents the maximum possible value of the luminance difference of each pixel, and n represents the power of the cosine function.
10. The method according to claim 8, wherein n is 4 and Q is 255.
11. The method according to claim 1, wherein chrominance is adjusted according to a look-up-table.
12. The method according to claim 1, wherein the chrominance includes a first color factor (Cb) and a second color factor (Cr).
13. An apparatus for eliminating a color edge on a digital color image, which comprises a plurality of pixels, wherein the color of each pixel is represented by a luminance and a chrominance, the apparatus comprising:
- a sensor for determining the color representing by a red (R), a green (G), and a blue (B) value of each of the pixels;
- a converting logic for converting the red, the green, and the blue values into the luminance and the chrominance of each of the pixels;
- a boundary determining logic for determining a boundary between a first color block and a second color of the digital color image according to a luminance difference of at least a first pixel belonging to the first color block and at least a second pixel adjacent to the first pixel belonging to the second color block; and
- a chrominance adjusting logic for adjusting the chrominance of at least one of the first and the second pixels according to the luminance difference.
14. The apparatus according to claim 13, wherein the boundary determining logic is a low pass filter.
15. The apparatus according to claim 13, wherein the luminance difference is determined according to the luminance of the first pixel and the luminances of a second pixel, a third pixel, a fourth pixel and a fifth pixel adjacent to the first pixel, wherein the luminance of the first to fifth pixels are represented by Y11, Y10, Y12, Y01, and Y21, and the luminance difference E (Y11) is: E(Y11)=(|Y12−Y10|+|Y21−Y01|)÷2.
16. The apparatus according to claim 13, wherein the chrominance is adjusted according to a smooth descending function with the luminance difference serving as an independent variable.
17. The apparatus according to claim 16, wherein the smooth descending function is a cosine function to an n-th power, and n≧1.
18. The apparatus according to claim 17, wherein the transfer function is cos((E(Y1)÷2Q)π)n, wherein E(Y1) represents the luminance difference of the first color pixel, Q represents the maximum possible value of the luminance difference of each pixel, and n represents the power of the cosine function.
19. The apparatus according to claim 18, wherein n is 4 and Q is 255.
20. The apparatus according to claim 13, wherein chrominance is adjusted according to a look-up-table.
21. The apparatus according to claim 13, wherein the chrominance includes a first color factor (Cb) and a second color factor (Cr).
Type: Application
Filed: Jun 21, 2004
Publication Date: Feb 3, 2005
Inventor: Ting Ming-Jeu (Taichung City)
Application Number: 10/872,862