The present invention relates to the Digital Image Processing neighborhood, relate in particular to a kind of data interpolating method and device, image output method and device.
Summary of the invention
The invention provides a kind of data interpolating method and device, image output method and device, the present invention can solve image after the processing and color occur and become bright or deepening, and the not good problem of picture quality such as edge blurry is unclear.
In order to address the above problem, the present invention adopts following technological means:
A kind of data interpolating method comprises:
When the interpolation pixel satisfies when pre-conditioned, determine the first kind chromatic component that described interpolation pixel is default;
Obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the described first kind chromatic component of two pixels on first diagonal;
Obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the described first kind chromatic component of two pixels on second diagonal;
Obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the described first kind chromatic component of two pixels up and down;
Obtain described first difference, described second difference first pixel corresponding with minimum value in described the 3rd difference;
With the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel.
Preferably, describedly obtain described first difference, described second difference first pixel corresponding with minimum value in described the 3rd difference comprises:
If contain a minimum value in described first difference, described second difference and described the 3rd difference, then obtain with corresponding two pixels of described minimum value as described first pixel;
If contain two minimum values in described first difference, described second difference and described the 3rd difference, then obtain with corresponding four pixels of described two minimum values as described first pixel;
If described first difference, described second difference are big or small consistent with described the 3rd difference, then obtain with corresponding six pixels of described first difference, described second difference and described the 3rd difference as described first pixel.
Preferably, described pre-conditioned comprising:
Empty condition; Or
Described interpolation pixel is non-edge pixel.
A kind of data interpolation device comprises:
Determining unit is used for satisfying when pre-conditioned when the interpolation pixel, determines the first kind chromatic component that described interpolation pixel is default;
First acquiring unit is for first difference of the first kind chromatic component of two pixels on eight neighborhood territory pixels, first diagonal that obtains described interpolation pixel;
Second acquisition unit is for second difference of the first kind chromatic component of two pixels on eight neighborhood territory pixels, second diagonal that obtains described interpolation pixel;
The 3rd acquiring unit is for the 3rd difference of the first kind chromatic component of two pixels about the neighbours territory pixel of obtaining described interpolation pixel;
The 4th acquiring unit is used for obtaining described first difference, described second difference first pixel corresponding with described the 3rd difference minimum value;
Computing unit is used for mean value with described first pixel as the default first kind chromatic component of described interpolation pixel.
Preferably, described the 4th acquiring unit comprises:
First performance element is used for then obtaining with corresponding two pixels of described minimum value as described first pixel if described first difference, described second difference and described the 3rd difference contain a minimum value;
Second performance element is used for then obtaining with corresponding four pixels of described two minimum values as described first pixel if described first difference, described second difference and described the 3rd difference contain two minimum values;
The 3rd performance element is used for then obtaining with corresponding six pixels of described first difference, described second difference and described the 3rd difference as described first pixel if described first difference, described second difference are big or small consistent with described the 3rd difference.
A kind of image output method comprises:
When the interpolation pixel satisfies when pre-conditioned, determine the first kind chromatic component that described interpolation pixel is default;
Obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the first kind chromatic component of two pixels on first diagonal;
Obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the first kind chromatic component of two pixels on second diagonal;
Obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the first kind chromatic component of two pixels up and down;
Obtain described first difference, described second difference first pixel corresponding with minimum value in described the 3rd difference;
With the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel;
Travel through each interpolation pixel as stated above, and obtain each pixel after the interpolation;
With the data of described each pixel transitions for default form;
The data of described default form are exported.
Preferably, the data of described default form comprise:
Yuv format data or rgb format data.
Preferably, described pre-conditioned comprising:
Empty condition; Or
Described interpolation pixel is non-edge pixel.
Preferably, when adopting the neighbor method during for edge pixel, described interpolation pixel carries out interpolation.
A kind of image output device comprises:
Interpolating unit, be used for satisfying when pre-conditioned when the interpolation pixel, determine the first kind chromatic component that described interpolation pixel is default, obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the first kind chromatic component of two pixels on first diagonal, obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the first kind chromatic component of two pixels on second diagonal, obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the first kind chromatic component of two pixels up and down, obtain described first difference, first pixel that described second difference is corresponding with minimum value in described the 3rd difference, with the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel, travel through each interpolation pixel as stated above, and obtain each pixel after the interpolation;
Converting unit is used for the data of described each pixel transitions for default form;
Output unit is used for the data of described default form are exported.
The present invention is directed to the default first kind chromatic component of interpolation pixel, obtain first difference of the first kind chromatic component on first diagonal in interpolation pixel eight neighborhood territory pixels respectively, second difference of the first kind chromatic component on second diagonal, the 3rd difference of first kind chromatic component in two pixels up and down in the pixel of interpolation pixel neighbours territory, and obtain first difference, second difference, first pixel corresponding with minimum value in the 3rd difference, with the mean value of first pixel as the default first kind chromatic component of interpolation pixel.
The present invention is divided into diagonal and vertical direction with the pixel that contains first kind chromatic component in eight neighborhood territory pixels of interpolation pixel, calculate first difference of the first kind chromatic component on the diagonal and second difference of first kind chromatic component respectively, with first kind chromatic component the 3rd difference (eight neighborhood vertical direction are neighbours territory above-below direction in the present invention) on the vertical direction, choose corresponding first pixel of minimum value in three differences, and with the mean value of first pixel as the default first kind chromatic component of interpolation pixel.
Not only considered the gradient (i.e. first difference, second difference and the 3rd difference) of first kind chromatic component on all directions of interpolation pixel among the present invention, also choose the mean value of first pixel of Grad minimum as the default first kind chromatic component of interpolation pixel, therefore make and carry out the clearer of the edge of image that obtains after the interpolation, and the situation that image becomes bright or deepening can not occur, and then make that the quality of image is more excellent.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, this neighborhood those of ordinary skill all belongs to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Be described in detail in the application scenarios that the present invention is answered below:
As shown in Figure 1, the structural representation for image processing system comprises: data outputting module 100, and analog-to-digital conversion module 200, processing module 300, wherein processing module 300 comprises brightness calculation unit 301, colourity computing unit 302, interpolating unit 303.
As shown in Figure 2, schematic diagram for data outputting module inside implementation, after ccd image sensor is gathered image chroma, the signal that obtains the CMYG color filter array comprises: the G green, Cy is dark green, the Ye yellow, the Mg pink has (G+Cy), (Mg+Ye), (Mg+Cy) and (G+Ye) through the signal of exporting behind the horizontal shifting register in the ccd image sensor.Wherein first odd-numbered line is got and obtained to the row of two shown in the A1 among Fig. 2, two line displays shown in the A2 get and after obtain second odd-numbered line, first even number line is got and obtained to shown in the B1 two row, two line displays shown in the B2 get and after obtain second even number line, by that analogy, obtain each odd-numbered line and each even number line, all odd-numbered line pixels are formed strange, all even number line pixels are formed the idol field, and the output of odd-numbered line pixel and even number line pixel is the raw image data output of ccd image sensor.
The view data of data outputting module 100 outputs obtains accessible digital signal through behind the analog-to-digital conversion module 200, digital signal is input in the processing module 300 handles.
In processing module 300: brightness calculation unit 301 calculates the brightness signal Y of each pixel according to formula Y=((Cy+G)+(Ye+Mg))/2, and colourity computing unit 302 calculates the carrier chrominance signal of each pixel respectively according to R-Y=((Ye+Mg)-(Cy+G)) with (B-Y)=((Cy+Mg)-(G+Ye)).
Concrete computational process is: second element (Ye+Mg) adjacent with this row as first element (Cy+G) of first odd-numbered line among Fig. 2, obtain (R-Y) component of first pixel according to R-Y=((Ye+Mg)-(Cy+G)), equally, for (R-Y) component of second pixel of this row also by this point with it adjacent next element value adopt identical account form to obtain, obtain (R-Y) component of this each pixel of row successively; And for second odd-numbered line, adopt the processing mode identical with first odd-numbered line according to (B-Y)=((Cy+Mg)-(G+Ye)), obtain (B-Y) value of each pixel.The dual field data are also adopted and are obtained carrier chrominance signal in a like fashion.
After the processing by described brightness calculation unit 301 and colourity computing unit 302, data processed result as shown in Figure 3, strange first row all lacks the B-Y component among Fig. 3, and strange second row all lacks the R-Y component, and be same, idol first row all lacks the B-Y component, second row lacks the R-Y component, for convenience, and as shown in Figure 4, to strange field and even occasion also, and adopt the form of coordinate to represent each pixel.
For the chromatic value that lacks in each pixel, therefore the chromatic value that must adopt interpolation method to obtain to lack in the data input interpolating unit 303 with each pixel among Fig. 4, obtains the chromatic value that lacks in each pixel.
As shown in Figure 5, the invention provides a kind of interpolation method, comprising:
Step S101: when the interpolation pixel satisfies when pre-conditioned, determine the first kind chromatic component that described interpolation pixel is default;
For clear description implementation of the present invention, the present invention carries out detailed presentations with specific embodiment.As shown in Figure 6, in the present embodiment the interpolation pixel be (x y), contains the B-Y component in this pixel, default colourity is R-Y, thus the interpolation pixel (x, y) default first kind chromatic component is R-Y.Be understandable that, and if the interpolation pixel (x contains the R-Y component in y), default colourity B-Y component, and then (x, y) default first kind chromatic component is B-Y to the interpolation pixel.
Step S102: obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the described first kind chromatic component of two pixels on first diagonal;
The interpolation pixel (x, eight neighborhood territory pixels y) be respectively (x-1, y+1), (x, y+1), (x+1, y+1), (x-1, y), (x+1, y), (x-1, y-1), (x, y-1), (x+1, y-1).As shown in Figure 6, pixel (x-1, y), (x+1 does not contain pixel R-Y component in y), therefore not considered pixel (x-1, y), (x+1, y).
Two diagonal are arranged in eight neighborhood territory pixels, and first diagonal is that (x-1 is y+1) with (second diagonal is that (x+1 is y+1) with (x-1, y-1) two pixels for x+1, y-1) two pixels.
Obtain two pixel (x-1 on first diagonal in this step, y+1) and (x+1, y-1) first kind chromatic component R-Y, it is poor the first kind chromatic component R-Y of two pixels to be got again, and with the absolute value of difference first difference as first kind chromatic component.
Step S103: obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the described first kind chromatic component of two pixels on second diagonal;
Obtain two pixel (x+1 on second diagonal in this step, y+1) and (x-1, y-1) first kind chromatic component R-Y, it is poor the first kind chromatic component R-Y of two pixels to be got again, and with the absolute value of difference second difference as first kind chromatic component.
Step S104: obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the described first kind chromatic component of two pixels up and down;
Interpolation pixel (x, y) neighbours territory pixel is (x, y+1), (x-1, y), (x+1, y) and (x, y-1), because of (x-1, y) and (x+1, y) do not contain the R-Y component in two pixels, therefore do not consider this two pixels, only consider two the pixel (x up and down in the pixel of neighbours territory, y+1) and (x, y-1), as shown in Figure 6, two pixels up and down in the pixel of neighbours territory, be identical pixel with pixel on the vertical orientation in eight neighborhood territory pixels, so the above-below direction of neighbours territory pixel can be seen as eight neighborhood vertical orientation.
Obtain (x, y+1) and (it is poor the first kind chromatic component R-Y of two pixels to be got again for x, the y-1) first kind chromatic component R-Y in the pixel, and with the absolute value of difference the 3rd difference as first kind chromatic component.
Above-mentioned steps has been obtained interpolation pixel aberration gradient on diagonal and the vertical orientation in eight neighborhoods, and the aberration gradient is above-mentioned first difference that calculates, second difference and the 3rd difference.
Step S105: obtain described first difference, described second difference first pixel corresponding with minimum value in described the 3rd difference;
First difference is only considered minimum value in second difference and the 3rd difference, and three kinds of situations are arranged, first kind of situation: a minimum value is arranged, second kind among the three: two minimum values are arranged among the three, the third: the size of three differences is consistent.The first pixel difference under the different situations, therefore separately treat:
First kind of situation:
If contain a minimum value in described first difference, described second difference and described the 3rd difference, then obtain with corresponding two pixels of described minimum value as described first pixel;
Second kind of situation:
If contain two minimum values in described first difference, described second difference and described the 3rd difference, then obtain with corresponding four pixels of described two minimum values as described first pixel;
The third situation:
If described first difference, described second difference are big or small consistent with described the 3rd difference, then obtain with corresponding six pixels of described first difference, described second difference and described the 3rd difference as described first pixel.
First difference, second difference or the 3rd difference, no matter but be which difference, there are two pixels corresponding with this difference (in step S102-step S103, corresponding description to be arranged, namely calculate first difference, the pixel of second difference and the 3rd difference), therefore when minimum value has one, choose two pixels corresponding with this minimum value as first pixel, when minimum value has two, choose with corresponding four pixels of these two minimum values as first pixel, when minimum value has three, when namely three difference sizes are consistent, then directly choose with three corresponding six pixels of difference as first pixel.
What comprise in first pixel all is first kind chromatic component.
Step S106: with the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel.
First pixel of obtaining among the step S105 is averaged, with average as interpolation pixel (x, y) default first kind chromatic component R-Y.
Among the present invention pre-conditioned for empty condition or described interpolation pixel be non-edge pixel.
Employed method has certain pre-conditioned among the present invention, be because because using eight neighborhood territory pixels of interpolation pixel among the present invention, when if the interpolation pixel is edge pixel, then eight neighborhood territory pixels are incomplete, but do not influence the interpolation pixel and use the present invention, but in order to guarantee the quality of interpolation image afterwards, the non-edge pixel of prior applicability of the present invention (generally all containing eight neighborhood territory pixels in the non-edge pixel).
Among the present invention the pixel that contains first kind chromatic component in eight neighborhood territory pixels of interpolation pixel is divided into diagonal and vertical direction in fact, calculate first difference of the first kind chromatic component on the diagonal and second difference of first kind chromatic component respectively, with first kind chromatic component the 3rd difference (eight neighborhood vertical direction are neighbours territory above-below direction in the present invention) on the vertical direction, choose corresponding first pixel of minimum value in three differences, and with the mean value of first pixel as the default first kind chromatic component of interpolation pixel.
Not only considered the gradient (i.e. first difference, second difference and the 3rd difference) of first kind chromatic component on all directions of interpolation pixel among the present invention, also choose the mean value of first pixel of Grad minimum as the default first kind chromatic component of interpolation pixel, therefore make and carry out the clearer of the edge of image that obtains after the interpolation, and the situation that image becomes bright or deepening can not occur, and then make that the quality of image is more excellent.
As shown in Figure 7, the present invention also provides a kind of data interpolation device, comprising:
Determining unit 101 is used for satisfying when pre-conditioned when the interpolation pixel, determines the first kind chromatic component that described interpolation pixel is default;
First acquiring unit 102 is for first difference of the first kind chromatic component of two pixels on eight neighborhood territory pixels, first diagonal that obtains described interpolation pixel;
Second acquisition unit 103 is for second difference of the first kind chromatic component of two pixels on eight neighborhood territory pixels, second diagonal that obtains described interpolation pixel;
The 3rd acquiring unit 104 is for the 3rd difference of the first kind chromatic component of two pixels about the neighbours territory pixel of obtaining described interpolation pixel;
The 4th acquiring unit 105 is used for obtaining described first difference, described second difference first pixel corresponding with described the 3rd difference minimum value;
Computing unit 106 is used for mean value with described first pixel as the default first kind chromatic component of described interpolation pixel.
Described pre-conditioned comprising:
Empty condition or described interpolation pixel are non-edge pixel.
Further, as shown in Figure 8, described the 4th acquiring unit 105 comprises:
First performance element 1051 is used for then obtaining with corresponding two pixels of described minimum value as described first pixel if described first difference, described second difference and described the 3rd difference contain a minimum value;
Second performance element 1052 is used for then obtaining with corresponding four pixels of described two minimum values as described first pixel if described first difference, described second difference and described the 3rd difference contain two minimum values;
The 3rd performance element 1053 is used for then obtaining with corresponding six pixels of described first difference, described second difference and described the 3rd difference as described first pixel if described first difference, described second difference are big or small consistent with described the 3rd difference.
As shown in Figure 9, the present invention also provides a kind of image output method, comprising:
Step S201: when the interpolation pixel satisfies when pre-conditioned, determine the first kind chromatic component that described interpolation pixel is default;
Step S202: obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the first kind chromatic component of two pixels on first diagonal;
Step S203: obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the first kind chromatic component of two pixels on second diagonal;
Step S204: obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the first kind chromatic component of two pixels up and down;
Step S205: obtain described first difference, described second difference first pixel corresponding with minimum value in described the 3rd difference;
Step S206: with the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel;
Step S207: S201-step S206 method travels through each interpolation pixel set by step, and obtains each pixel after the interpolation;
Described by above-mentioned steps S201-step S206, travel through required each interpolation pixel of carrying out interpolation, and obtain the pixel after each interpolation, contain brightness signal Y, R-Y component and B-Y component in each pixel after the interpolation.
Step S208: with the data of described each pixel transitions for default form;
The data of default form include but not limited to the data of following three kinds of forms: yuv format data or rgb format data.
A kind of colour coding method that YUV is adopted by the eurovision system, by the brightness signal Y that obtains among the step S207, R-Y component (being U), B-Y component (being V), Y, R-Y and B-Y are the yuv format data of 4:4:4.
Rgb format is a kind of color standard of industrial quarters, and wherein R represents the Red redness, and G represents the Green green, B represents the Blue blueness, by the brightness signal Y that obtains among the step S207, and the R-Y component, the B-Y component can be converted to the rgb format data through known computing formula, does not repeat them here.
Step S209: the data of described default form are exported.
With the output of the data of described default form, carry out for the external interface of back that image shows and other images are handled.
Among the present invention pre-conditioned for empty condition or described interpolation pixel be non-edge pixel.
Employed method has certain pre-conditioned among the present invention, be because because using eight neighborhood territory pixels of interpolation pixel among the present invention, when if the interpolation pixel is edge pixel, then eight neighborhood territory pixels are incomplete, but do not influence the interpolation pixel and use the present invention, but in order to guarantee the quality of interpolation image afterwards, the non-edge pixel of prior applicability of the present invention (generally all containing eight neighborhood territory pixels in the non-edge pixel), carry out interpolation when described interpolation pixel adopts the neighbor method during for edge pixel, thereby guaranteed the quality of pixel.
Neighbor method: for certain pixel, its carrier chrominance signal that lacks obtains from the carrier chrominance signal of neighbor, as the R-Y signal of the R-Y signal in first row of strange field among Fig. 3 as next line, the pixel of up-downgoing is corresponding mutually, equally, the B-Y signal of strange second row is as the B-Y signal of first row, and even processing method is with strange.
The present invention is carrying out interpolation with each pixel, and each pixel transitions after the interpolation exported for default form, because having adopted novel interpolation method in the interpolation, not only considered gradient (i.e. first difference of first kind chromatic component on all directions of interpolation pixel, second difference and the 3rd difference), also choose the mean value of first pixel of Grad minimum as the default first kind chromatic component of interpolation pixel, therefore make and carry out the clearer of the edge of image that obtains after the interpolation, and the situation that image becomes bright or deepening can not occur, and then make that the quality of image is more excellent.
As shown in figure 10, the invention provides a kind of image output device, comprising:
Interpolating unit 400, be used for satisfying when pre-conditioned when the interpolation pixel, determine the first kind chromatic component that described interpolation pixel is default, obtain in eight neighborhood territory pixels of described interpolation pixel first difference of the first kind chromatic component of two pixels on first diagonal, obtain in eight neighborhood territory pixels of described interpolation pixel second difference of the first kind chromatic component of two pixels on second diagonal, obtain in the neighbours territory pixel of described interpolation pixel the 3rd difference of the first kind chromatic component of two pixels up and down, obtain described first difference, first pixel that described second difference is corresponding with minimum value in described the 3rd difference, with the mean value of described first pixel as the default first kind chromatic component of described interpolation pixel, travel through each interpolation pixel as stated above, and obtain each pixel after the interpolation;
Converting unit 500 is used for the data of described each pixel transitions for default form;
Output unit 600 is used for the data of described default form are exported.
Described pre-conditioned comprising:
Empty condition; Or described interpolation pixel is non-edge pixel.
If the described function of present embodiment method realizes with the form of SFU software functional unit and during as independently production marketing or use, can be stored in the computing equipment read/write memory medium.Based on such understanding, the part that the embodiment of the invention contributes to prior art or the part of this technical scheme can embody with the form of software product, this software product is stored in the storage medium, comprise that some instructions are with so that a computing equipment (can be personal computer, server, mobile computing device or the network equipment etc.) carry out all or part of step of the described method of each embodiment of the present invention.And aforesaid storage medium comprises: various media that can be program code stored such as USB flash disk, portable hard drive, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD.
Each embodiment adopts the mode of going forward one by one to describe in this specification, and what each embodiment stressed is and the difference of other embodiment that same or similar part is mutually referring to getting final product between each embodiment.
To the above-mentioned explanation of the disclosed embodiments, make this neighborhood professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be apparent concerning the professional and technical personnel of this neighborhood, and defined General Principle can realize under the situation that does not break away from the spirit or scope of the present invention in other embodiments herein.Therefore, the present invention will can not be restricted to these embodiment shown in this article, but will meet the wideest scope consistent with principle disclosed herein and features of novelty.