1. Technical Field of the Invention
The present invention relates generally to digital image processing, and particularly to demosaicing methods for interpolating colors at each pixel location.
2. Description of Related Art
Digital color image sensors are predominately of two types: CCDs (Charge Coupled Devices) and CMOS—APS (Complimentary Metal Oxide Semiconductor—Active Pixel Sensors). Both types of sensors typically contain an array of photo-detectors (pixels), arranged in rows and columns, that sample color within an image. Each pixel measures the intensity of light within one or more ranges of wavelengths, corresponding to one or more colors.
In addition, both types of sensors may include a color filter array (CFA), such as the CFA described in U.S. Pat. No. 3,971,065 to Bayer (hereinafter referred to as Bayer), which is hereby incorporated by reference. With the Bayer CFA, each pixel sees only one color: red, green or blue. The sampling pattern is shown below.
                    G                    R                    G                    R                    G                            B                    G                    B                    G                    B                            G                    R                    G                    R                    G               
A sensor fitted with a Bayer CFA produces a mosaiced image that is sampled in both the color space and in the spatial domain. The sampling process produces aliasing artifacts in both the color space and in the spatial domain. For example, since the full color spectrum is sampled only at certain pixel locations (depending on the CFA colors), it is impossible to accurately reconstruct the true color of an image, thereby producing color space aliasing artifacts. In addition, since high spatial frequencies in the original image are sampled at too low of a frequency, the original high frequencies in the image cannot be restored later on through image processing, thereby producing spatial domain aliasing artifacts.
One solution to the color space and spatial domain aliasing artifact problems is demosaicing. Demosaicing is the process of interpolating colors of a digital image obtained from an image sensor to obtain all three primary colors at a single pixel location. When viewed, the resulting demosaiced image provides a better quality and more visually pleasing image than the mosaiced image.
Previous demosaicing methods have included, for example, pixel replication, bilinear interpolation and median interpolation. In pixel replication, each missing value is taken from the neighbor to the left, above, or diagonally above and left, whichever is nearest. Bilinear interpolation offers some improvement over pixel replication with a moderate increase in complexity. In the bilinear interpolation method, each missing value is calculated based on an average of the neighboring pixel values, horizontally, vertically and/or diagonally. Median interpolation, which is a nonlinear interpolation method, offers the best results among these three algorithms (pixel replication, bilinear and median), especially when there are defective pixels, but has the maximum complexity. Median interpolation has two steps. First, missing values having four diagonal neighbors are interpolated using the median of those four values. Second, the remaining missing pixels are interpolated by the median of north, south, east, and west neighbors.
However, with all of the above demosaicing methods, noticeable aliasing artifacts appear at edges within the image, producing a “zipper” effect in the demosaiced image. The “zipper” effect makes a straight edge in the image appear as a zipper. Solutions to the “zipper” effect have been proposed in U.S. Pat. No. 5,652,621 to Adams, Jr. et al. (hereinafter referred to as the Adams-Hamilton algorithm) and Kuno et al., “Aliasing reduction method for color digital still cameras with a single-chip charge-coupled device,” Journal of Electronic Imaging, Vol. 8, No. 4, October 1999, pp. 457–466 (hereinafter referred to as the Kuno algorithm), both of which are hereby incorporated by reference.
The Adams-Hamilton interpolation algorithm seeks to optimize the performance of image systems that sample images having horizontal and vertical edges. In the Adams-Hamilton interpolation algorithm, an interpolation method for interpolating a missing color value is selected. The interpolation direction is selected by calculating horizontal and vertical (or positive diagonal and negative diagonal) classifier values that are based on values taken from the color plane being interpolated and the color plane of the pixel location.
The two classifier values are compared with predefined thresholds and each other to select an interpolation method. For example, if one or more of the classifier values are greater than a predefined threshold, the missing color value is interpolated from both neighboring values of the same color as the missing color value and neighboring values of the color of the pixel location. The missing color value may be interpolated from horizontal neighboring values, vertical neighboring values or both horizontal and vertical neighboring values depending on which classifier values exceed the predefined threshold. The Adams-Hamilton algorithm does preserve detail and reduce the appearance of the “zipper” effect. However, with the Adams-Hamilton algorithm, some “zippering” is still visible.
The Kuno interpolation algorithm is based on the correlation of details assumption, expressed by Kodera et al. in “Method to display full-color image by using the correlation of color,” IIEEJ Annual Convention, Vol. 16(2), pp. 86–88 (1988), which is hereby incorporated by reference. The correlation of details assumption presumes that in a local region of an image, there is a high correlation amongst the colors. For example, using an image sensor fitted with a Bayer CFA, the correlation of details assumption predicts that the red, blue and green color values within a local region of an image will be relatively similar (e.g., if the red value of a red pixel location is 10, the correlation of details assumption predicts that the neighboring green and blue pixel locations will produce respective green and blue color values near 10).
The Kuno algorithm further postulates that even in regions with sharp color changes, a color correlation exists in one direction (i.e., either horizontal or vertical). Therefore, the Kuno algorithm uses a vertical interpolation orientation where only a low correlation in color values exists in the horizontal direction, and a horizontal interpolation orientation where only a low correlation in color values exists in the vertical direction. Specifically, the Kuno algorithm computes the horizontal and vertical gradients of the color plane associated with the missing color value and compares the horizontal and vertical gradients to a predefined threshold to determine the direction of interpolation. For example, if both the horizontal and vertical gradients are less than the predefined threshold, interpolation is performed both horizontally and vertically. However, if either of the gradients is greater than the predefined threshold, the direction of interpolation is in the smaller of the two gradients.
Once the direction of interpolation is determined, the Kuno algorithm uses a division operation to interpolate the missing color value. As with the Adams-Hamilton algorithm, the Kuno algorithm does reduce the “zipper” effect and improve color resolution as compared with previous demosaicing methods, such as pixel replication, bilinear interpolation and median interpolation. However, with the Kuno algorithm, some “zippering” is still visible. In addition, the Kuno algorithm requires a division operation to be carried out at every pixel location, which is expensive to implement. Therefore, what is needed is a demosaicing algorithm that further reduces the visibility of the “zipper” effect, as compared with the Adams-Hamilton algorithm and Kuno algorithm, and that can be implemented without the hardware complexity necessitated by the Kuno algorithm.