A kind of demosaicing device based on G pattern color filter arrays
Technical field
A kind of demosaicing device of image involved by the utility model is specifically a kind of based on G patterns color filter battle array
The demosaicing device of row.
Background technology
The optical sensor of digital picture sampling apparatus generally uses CCD (charge coupled device, electric charge coupling
Close element) or CMOS (Complementary Metal-Oxide Semiconductor, metal oxide semiconductor device) skill
Art, a two-dimensional matrix being made up of the photo-sensitive cell (CCD or CMOS) of both direction dense arrangement anyhow, and CCD or
Cmos sensor is a monochromatic electronic original part in itself, can only respond the intensity of light, it is impossible to respond the color information of light.
Therefore, it is necessary to carry out primary colours separation to light before the photosensitive array of imaging sensor is entered in light.By primary colours separation come
Filter the light of other colors so that the light of particular color projects the photosensitive array of imaging sensor.Conventional primary colours point
From method be before imaging sensor plus lastblock color filter array (Color Filter Array, abbreviation CFA), it is each
One pixel of individual colour filter unit correspondence, only allows a kind of light of color to pass through so that each pixel of sensor capture
Only retain a color component.
Color filter array can use different patterns, and conventional CFA is Bayer pattern CFA Bayer colors at present
Color filter array, is its four kinds different pixel arrangement forms, it is used alternatingly one as shown in Fig. 1 a, Fig. 1 b, Fig. 1 c and Fig. 1 d
Group red and green filter and one group of green and blue filter, every one 2 × 2 array is by 2 greens (G), 1 red (R) and 1
Individual blueness (B) unit composition, therefore 1/2 green glow, 1/4 feux rouges and 1/4 blue light can be captured.
However, after Bayer color filter array, what imaging sensor was obtained be each pixel only have it is red, blue,
A kind of image of the mosaic of color component in green three kinds of colors.In order to rebuild complete coloured image so that each pixel
Point includes red, blue, green three kinds of color components, it is necessary to carry out interpolation algorithm to remove mosaic to CFA image.Existing interpolation
Algorithm is a lot, including arest neighbors duplication, bilinear interpolation, cubic spline interpolation, gradient interpolation etc..
Due to be not based in existing utility model patent G pattern color filter arrays demosaicing device it is special
Profit, therefore a kind of demosaicing device based on G pattern color filter arrays of the utility model has great importance.
Utility model content
The purpose of this utility model is, in order to overcome the shortcomings of above-mentioned background technology, and to provide and a kind of be based on G pattern colors
The demosaicing device of filter array, by the interpolation method based on walking direction, first carries out G component interpolation, then carries out R/B
Component interpolation, simplifies the step flow of demosaicing, and causes image more to press close to the visual standards of human eye, improves image
Definition.
To achieve these goals, the utility model is adopted the following technical scheme that:
A kind of image demosaicing device based on G pattern color filter arrays, including the original image being sequentially connected are defeated
Enter the image output unit after unit, G components interpolating unit, R/B components interpolating unit and demosaicing;
The original image input block is used for the original for the imaging sensor capture for inputting collocation G pattern colour filter arrays
Beginning image;
The G components interpolating unit is used to carry out G component interpolation to original R, B pixel, according in R, B neighborhood of pixel points
G components recover R, B pixel G component values;
The R/B components interpolating unit is used to carry out original R/B pixels B/R components interpolation and to original G pixels
Point carries out R, B component interpolation, including one to the submodules of R/B pixel point interpolation B/R components and one to G pixel point interpolations R,
The submodule of B component;
Image output unit after the demosaicing is used to export the coloured image removed after mosaic.
Further, the G components interpolating unit includes gradient direction judge module and directional interpolation module, gradient direction
Judge module is used to judging R or B central pixel points level, vertical, 45 ° and 135 ° of diagonally opposing corner this four direction difference Grad most
Small direction;Directional interpolation module is used for the output according to gradient direction judge module, takes two neighboring G values on the interpolation direction
Average as the pixel point interpolation G components.
Further, the R/B components interpolating unit includes the B/R component interpolation subelements and G pictures on R/B pixels
R, B component interpolation subelement on vegetarian refreshments;
The B/R components that B/R component interpolation subelement on R/B pixels is used on the original R or B pixels of interpolation, it is wrapped
Include gradient direction judge module and directional interpolation module, gradient direction judge module be used to judging R or B central pixel points level and
The minimum direction of difference Grad in vertical direction;Directional interpolation module is used for the output according to gradient direction judge module, takes
On the interpolation direction average of most two neighboring B/R components as the R/B pixels B/R components;
R, B component interpolation subelement are used for R, the B component of the original G pixels of interpolation on G pixels, that is, obtain R (G), B
(G)。
Further, R, B component interpolation subelement include the G pixels in R, B horizontal or vertical direction on the G pixels
G pixels point interpolation subelement on point interpolation subelement and R, B diagonally opposing corner:
G pixel point interpolations subelement in R, B horizontal or vertical direction is used for interpolation and is located at the level of R, B pixel or hangs down
R, the B component of the upward G pixels of Nogata, the subelement only one of which directional interpolation module, this module take the pixel to have R/B
The average of two neighboring R/B components on the direction of component as the pixel R/B components;
G pixels point interpolation subelement is used for the G pixels that interpolation is located on R, B pixel diagonally opposing corner direction on R, B diagonally opposing corner
R, the B component of point, the subelement are equally divided into gradient direction judge module and directional interpolation module, and wherein gradient direction judges mould
Block is used for the direction for judging that the difference Grad in 45 ° and 135 ° diagonally opposing corner directions of the G pixels is minimum;Directional interpolation module is used
In the output according to walking direction module, the average of R/B components on the interpolation direction is taken as the R/B components of the pixel.
The beneficial effects of the utility model are:The utility model is innovatively on the basis of G pattern color filter arrays
Image demosaicing device is carried out, the apparatus structure is simple, and the green filter in filter array is improved into accounting, makes image more
Definition, it is easier to received by human eye and certain protective effect is played to human eye.
Brief description of the drawings
Fig. 1 a, Fig. 1 b, Fig. 1 c and Fig. 1 d are CFA Bayers color filter array of figure in the prior art.
Fig. 2 is a kind of G patterns color filter array of the present utility model.
Fig. 3 is a kind of dot structure unit of G patterns color filter array of the present utility model.
Fig. 4 is a kind of structural representation of embodiment of the utility model G pattern color filter arrays.
Fig. 5 is the structural representation of image demosaicing device of the present utility model.
Fig. 6 is a kind of structural representation of embodiment of the utility model image demosaicing device.
Embodiment
Embodiment of the present utility model is further described below.Following examples only carry out further to the application
Illustrate, should not be construed as the limitation to the application.
Such as a kind of G patterns color filter array that Fig. 2 shows, it includes several sizes, shape identical dot structure list
First (shown in Fig. 3), dot structure unit arrangement form G pattern color filter arrays.
Fig. 3, the construction unit shown in 4, dot structure unit 1 include the first basic filter of basic filter unit 11 and second
Unit 12, one 4 × 4 array of formation by mixing the first basic filter unit 11 and second basic filter unit 12 of arrangement
Minimum structural unit, the utility model passes through the arrangement to green, blueness and red filter in the matrix of dot structure unit 1
Mode is changed, and realizes the technique effect greatly improved of the filter ratio of overall color filter array green, and distribution
It is simple with arrangement mode, it is easy to uniformly to be formed and realized.
The basic filter unit 12 of the basic filter unit 11 or the second of each two identical first in the dot structure unit
Paired linea angulata arrangement mode, is significantly increased the filter ratio of whole color filter array Green, improves image definition.
First basic filter unit 11 of the present utility model is 2 × 2 array, including 3 G filters and 1 R filter;
Second basic filter unit 12 is equally 2 × 2 arrays, including 3 G filters and 1 B filter, the R in the first basic filter unit
The same position of 2 × 2 arrays where B filters in filter and the second basic filter unit are respectively positioned on, such as in 2 × 2 arrays
The upper left corner, the lower right corner, the upper right corner or the lower left corner.Illustrated below so that R, B filter are in the lower right corner in 2 × 2 arrays as an example.
4 × 4 array minimum structural units of G pattern color filter arrays are not limited to above-mentioned example.For example change the first base
The location of R, B filter in this filter unit and the second basic filter unit, the left side for making it be respectively positioned on 2 × 2 arrays of place
Upper angle or optional position, then can be arranged in different array structures, and its principle of compositionality is identical.
The ratio that G filters in the dot structure unit account for total filter is 3/4, and R, B filter account for the 1/ of total filter respectively
8, the eight neighborhood of each R, B filter in addition to corner is G filters.Dot structure unit of the present utility model it is spaced two
The filter of two capable, spaced row is green, and remaining filter is mutually spaced in a line or a row where it
Red or blueness is presented in ground, that is, ensure that green filter at high proportion, and can simply and effectively realize G patterns color filter battle array
The image definition of row.
As shown in figure 5, a kind of image demosaicing device of G patterns color filter array, including be sequentially connected it is original
Image output unit after image input units, G components interpolating unit, R/B components interpolating unit and demosaicing;
The original image input block is used for the original for the imaging sensor capture for inputting collocation G pattern colour filter arrays
Beginning image;
The G components interpolating unit is used to carry out G component interpolation to original R, B pixel, according in R, B neighborhood of pixel points
G components recover R, B pixel G component values;
The R/B components interpolating unit is used to carry out original R/B pixels B/R components interpolation and to original G pixels
Point carries out R, B component interpolation, including one to the submodules of R/B pixel point interpolation B/R components and one to G pixel point interpolations R,
The submodule of B component;
Image output unit after the demosaicing is used to export the coloured image removed after mosaic.
Further, the G components interpolating unit includes gradient direction judge module and directional interpolation module, gradient direction
Judge module is used to judging R or B central pixel points level, vertical, 45 ° and 135 ° of diagonally opposing corner this four direction difference Grad most
Small direction;Directional interpolation module is used for the output according to gradient direction judge module, takes two neighboring G values on the interpolation direction
Average as the pixel point interpolation G components.
Further, the R/B components interpolating unit includes the B/R component interpolation subelements and G pictures on R/B pixels
R, B component interpolation subelement on vegetarian refreshments;
The B/R components that B/R component interpolation subelement on R/B pixels is used on the original R or B pixels of interpolation, it is wrapped
Include gradient direction judge module and directional interpolation module, gradient direction judge module be used to judging R or B central pixel points level and
The minimum direction of difference Grad in vertical direction;Directional interpolation module is used for the output according to gradient direction judge module, takes
On the interpolation direction average of most two neighboring B/R components as the R/B pixels B/R components;
R, B component interpolation subelement are used for R, the B component of the original G pixels of interpolation on G pixels, that is, obtain R (G), B
(G)。
Further, R, B component interpolation subelement include the G pixels in R, B horizontal or vertical direction on the G pixels
G pixels point interpolation subelement on point interpolation subelement and R, B diagonally opposing corner:
G pixel point interpolations subelement in R, B horizontal or vertical direction is used for interpolation and is located at the level of R, B pixel or hangs down
R, the B component of the upward G pixels of Nogata, the subelement only one of which directional interpolation module, this module take the pixel to have R/B
The average of two neighboring R/B components on the direction of component as the pixel R/B components;
G pixels point interpolation subelement is used for the G pixels that interpolation is located on R, B pixel diagonally opposing corner direction on R, B diagonally opposing corner
R, the B component of point, the subelement are equally divided into gradient direction judge module and directional interpolation module, and wherein gradient direction judges mould
Block is used for the direction for judging that the difference Grad in 45 ° and 135 ° diagonally opposing corner directions of the G pixels is minimum;Directional interpolation module is used
In the output according to walking direction module, the average of R/B components on the interpolation direction is taken as the R/B components of the pixel.
Embodiment 1:
The original image that accompanying drawing 6 is obtained for a width of input by G pattern colour filter arrays, is carried out as example below
Demosaicing methods are demonstrated, and detailed step is as follows:
(1) G component interpolation is carried out to the R/B pixels of original image, with B in Fig. 544Exemplified by central pixel point, that is, calculate G
(B44), algorithm is as follows:
Wherein, B44Pixel horizontal direction difference gradient | DH|=| G43-G45|, vertical direction difference gradient | DV|=|
G34-G54|, 45 ° of diagonally opposing corner direction difference gradients | D45°|=| G35-G53|, 135 ° of diagonally opposing corner direction difference gradients | D135°|=|
G33-G55|。
Similarly, the G component values on R pixels can be calculated using above-mentioned algorithm, with R in Fig. 546Exemplified by pixel:
Wherein, R46Pixel horizontal direction difference gradient | DH|=| G45-G47|, vertical direction difference gradient | DV|=|
G36-G56|, 45 ° of diagonally opposing corner direction difference gradients | D45°|=| G37-G55|, 135 ° of diagonally opposing corner direction difference gradients | D135°|=|
G35-G57|。
(2) R (B) component interpolation is carried out to B (R) pixel for having carried out G component interpolation, equally with B in Fig. 544Middle imago
Exemplified by vegetarian refreshments, that is, calculate R (B44), algorithm is as follows:
Wherein, B44Pixel horizontal direction difference gradient | DH|=| G43-G45|+α|2G(B44)-G(R42)-G(R46) |, hang down
Nogata is to difference gradient | Dv|=| G34-G54|+α|2G(B44)-G(R24)-G(R64) |, 0 < α < 1.G(B44)、G(R42)、G(R46)
Deng being calculated by step (1).
Similarly, the B component value on R pixels can be calculated using above-mentioned algorithm, with R in Fig. 546Exemplified by pixel:
Wherein, R46Pixel horizontal direction difference gradient | DH|=| G45-G47|+α|2G(R46)-G(B44)-G(B48) |, hang down
Nogata is to difference gradient | Dv|=| G36-G56|+α|2G(R46)-G(B26)-G(B66) |, 0 < α < 1.
(3) R, B component interpolation are carried out to the G pixels of original image, following three kinds of situations can be divided into:
1. when original R, B pixel is distributed in the G pixel horizontal directions of center, with G in Fig. 545Pixel
Exemplified by, that is, calculate R (G45) and B (G45), algorithm is as follows:
Wherein, R (B44) and B (R46) calculated by step (2).
2. when original R, B pixel is distributed in the G pixel vertical direction of center, with G in Fig. 554Pixel
Exemplified by, that is, calculate R (G54) and B (G54), algorithm is as follows:
3. when original R, B pixel is distributed on 45 ° and 135 ° diagonally opposing corner directions of center G pixels, with Fig. 5
Middle G55Exemplified by pixel, that is, calculate R (G55) and B (G55), algorithm is as follows:
Wherein, G5545 ° of diagonally opposing corner direction difference gradients of pixel | D45°|=| G (R46)-G(R64) |, 135 ° of diagonally opposing corner sides
To difference gradient | D135°|=| G (B44)-G(B46)|。
By the interpolation arithmetic of above three step, the RGB component of each pixel of full image has recovered, so as to obtain
The full width coloured image with higher resolution based on G pattern colour filter arrays.
It is a kind of going based on G pattern colour filter arrays corresponding to the utility model embodiment method as shown in Figure 6
The structured flowchart of mosaic device, including original image input block, G components interpolating unit, R/B components interpolating unit and go
Image output unit after mosaic, wherein:
Original image input block is used to input each in the original image based on G pattern colour filter arrays, original image
Colored pixels ratio is:3/4 G pixels, 1/8 R pixels, 1/8 B pixels.
G components insertion unit is used for original RM, nOr BM, nPixel carries out G component interpolation, obtains G (RM, n) or G
(BM, n), realize the G component interpolation to R, B pixel.The unit is divided into gradient direction and judged and the two moulds of directional interpolation again
Block.Wherein, gradient direction judge module is used to judge RM, nOr BM, nCentral pixel point level, vertical, 45 ° and 135 ° of diagonally opposing corners this
The minimum direction of four direction difference Grad;Directional interpolation module is used for the output according to gradient direction judge module, takes this
On interpolation direction the average of two neighboring G values as the pixel point interpolation G components.
R/B components interpolating unit is used to realize two functions, can be divided into the B/R component interpolation subelements on R/B pixels
And R, B component interpolation subelement on G pixels:
1. the B/R component interpolation subelement on R/B pixels is used for the original R of interpolationM, nOr BM, nB/R points on pixel
Amount, that is, obtain B (RM, n) or R (BM, n).This subelement is equally divided into gradient direction judge module and directional interpolation module.Wherein,
Gradient direction judge module is used to judge RM, nOr BM, nCentral pixel point both horizontally and vertically goes up the minimum side of difference Grad
To;Directional interpolation module is used for the output according to gradient direction judge module, takes most two neighboring B/R components on the interpolation direction
Average as the R/B pixels B/R components.
2. R, B component interpolation subelement are used for the original G of interpolation on G pixelsM, nR, the B component of pixel, that is, obtain R
(GM, n)、B(GM, n).R, B component interpolation on the difference being distributed according to original R, B pixel around the G pixels of center, G pixels
Subelement can be divided into again on the G pixels point interpolation in R, B horizontal or vertical direction and R, B diagonally opposing corner G pixels point interpolation the two
Subelement:
G pixel point interpolations subelement in i.R, B horizontal or vertical direction be used for interpolation be located at R, B pixel level or
R, the B component of G pixels in vertical direction.The subelement only one of which directional interpolation module, this module takes the pixel to have
The average of two neighboring R/B components on the direction of R/B components as the pixel R/B components.
G pixels point interpolation subelement is used for the G pictures that interpolation is located on R, B pixel diagonally opposing corner direction on ii.R, B diagonally opposing corner
R, the B component of vegetarian refreshments.This subelement is equally divided into gradient direction judge module and directional interpolation module.Wherein, gradient direction is sentenced
Disconnected module is used for the direction for judging that the difference Grad in 45 ° and 135 ° diagonally opposing corner directions of the G pixels is minimum;Directional interpolation mould
Block is used for the output according to walking direction module, takes the average of the R/B components on the interpolation direction to divide as the R/B of the pixel
Amount.
Image output unit after demosaicing is used to export the coloured image for removing mosaic.
It the above is only preferred embodiment of the present utility model, protection domain of the present utility model is not limited merely to above-mentioned
Embodiment, all technical schemes belonged under the utility model thinking belong to protection domain of the present utility model.It should be pointed out that pair
For those skilled in the art, some improvements and modifications under the premise of the utility model principle is not departed from,
These improvements and modifications also should be regarded as protection domain of the present utility model.