The colour reconstruction method of colour filter array in the digital camera
Technical field
The present invention relates to the colour reconstruction method of colour filter array in the digital camera.
Background technology
The image device of present common digital camera is a charge-coupled device (CCD), it is that the full light-sensitive element of a piece of cloth is the photographic plate of charge-coupled device, digital camera activates charge coupling device sensor with shutter, light signal is converted to the signal of telecommunication, the intensity-conversion of illumination is become corresponding numerical value, the signal of telecommunication is converted into digital signal and handles then, at last the digital picture that obtains is kept in the memory.
In fact charge-coupled device (CCD) itself can not be differentiated color, so need use colour filter when practical application, generally coats different colors at the filter layer of CCD device exactly.Color lumps different on the filter are arranged as mosaic by the order of G-R-G-B (green-R-G-B), make the different color of pixel induction under each sheet " mosaic ", when light passes from the red, green, blue filter, just can obtain the response value of every kind of coloured light, colour filter is arranged (CFA) as shown in Figure 1.Like this, each picture element in the original image has only a three primary colors component: red R, green G, or blue B, but in picture reproducer, each picture element needs red, green, blue three components, this will ask for help from raw information interpolation go out the color component that is lacked, Here it is CFA color interpolation.
The company and the personnel that research and develop digital camera at home are considerably less, and about the patent or the blank out of digital camera CFA color rendition interpolation algorithm.
Summary of the invention
The object of the present invention is to provide a kind of interpolation of can reducing to go out the three primary colors component value that is lacked in each picture element, make the clear wash rice of the image that restores, and the colour reconstruction method of the colour filter array (CFA) of the brightness of energy true reappearance original image and colourity.
The colour reconstruction method of colour filter array in the digital camera, its characteristics are:
The green component of green pixel point represented by itself, its red component and blue component by its up and down 2 average or about 2 average represent;
The red component of red pixel point represented by itself, and its blue component is by upper left, the lower-left, and the mean value of upper right four the amount of blue adjacent with the bottom right is represented; Its green component is by last, and down, the intermediate value of the amount of green color that a left side and the right side are 4 is represented;
The blue component of blue picture element point represented by itself, and its red component is by upper left, the lower-left, and the mean value of upper right four the amount of red adjacent with the bottom right is represented; Its green component is by last, and down, the intermediate value of the amount of green color that a left side and the right side are 4 is represented;
Median computation methods is: the component value with four points sorts by size earlier, gets the intermediate value of the mean value of its middle two values as this four number again.
Because in the colour reconstruction method that the present invention relates to, when rebuilding green component, adopt median method, can consider its information on every side, it is image blurring to prevent that again mean value method from making, mean value for not crucial redness and blue component employing consecutive points can have smoothing effect to a certain extent, eliminates noise, its brightness and colourity are more near its reality, can make the clear wash rice of image of reconstruction like this, color is accurate, can guarantee the speed of handling again.
Description of drawings
Fig. 1 is the distribution map of colour filter (CFA)
Fig. 2 is 16 * 16 colour filter matrix diagram
Fig. 3 is the reconstruction flow chart of colour filter array of the present invention (CFA)
Embodiment
In the colour filter array (CFA) of charge-coupled device (CCD), red, green, the distribution of blue three look filters has certain rule, and wherein red and blue filter accounts for whole 1/4th respectively, and green filter accounts for whole 1/2nd, it is relatively responsive to green that this has taken into full account human eye, and three primary colors to other color system (as YUV, YCrCb, YIQ etc.) in the transformational relation, the shared proportion of green component is also bigger.So the quality that green component is rebuild in each picture element will directly influence clear wash rice degree of image and color.
Can not simply adopt mean value method and linear interpolation method when rebuilding green component, when rebuilding, will take into full account the information of its consecutive points simultaneously.In this algorithm, when rebuilding green component, adopt median method, can consider its information on every side, it is image blurring to prevent that again mean value method from making, mean value for not crucial redness and blue component employing consecutive points, can have smoothing effect to a certain extent, eliminate noise, can make the clear wash rice of image of reconstruction like this, color is accurate, can guarantee the speed of handling again.
The method for reconstructing of colour filter array involved in the present invention (CFA) adopts diverse ways at different picture elements.For a width of cloth original image, its CFA distributes as shown in Figure 2, if during green point, the green component of this point represented by itself, red component and blue component adopt up and down 2 average or about 2 average represent; If during red point, the red component of this point represented by itself, and blue component is by upper left, the lower-left, and the mean value of upper right four the amount of blue adjacent with bottom right represents that green component is by last, down, the intermediate value of the amount of green color that a left side and the right side are 4 is represented; If during blue dot, the blue component of this point represented by itself, and red component is by upper left, the lower-left, and the mean value of upper right four the amount of red adjacent with the bottom right represents, and green component is by last, and down, the intermediate value of a left side and right 4 s' amount of green color is represented.Median computation methods is as follows: the component value with four points sorts by size earlier, gets the intermediate value of the mean value of its middle two values as this four number again.
As shown in Figure 3, treatment step of the present invention is as follows:
(1) judges whether picture element into G? be execution in step 2 then, otherwise execution in step 4;
(2) determine the average of B picture element in the adjacent image point point;
(3) determine the average of R picture element in the adjacent image point point, jump to step 8;
(4) intermediate value of G picture element in the calculating adjacent image point point;
(5) judge whether picture element into B? be execution in step 6 then, otherwise execution in step 7;
(6) determine the average of R picture element in the adjacent image point point;
(7) determine the average of B picture element in the adjacent image point point;
(8) rebuild the RGB three-component of this picture element;
(9) judge whether to also have untreated picture element? be execution in step 1 then, otherwise finish.