Summary of the invention
The invention provides a kind of compensation method and device of enlarged image, to improve the sharpness at the edge of enlarged image, improve the effect of enlarged image.
The invention provides a kind of compensation method of enlarged image, comprising:
In original image, determine the First Eigenvalue that in described original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue, the First Eigenvalue corresponding for each described original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively;
According to the magnification ratio of enlarged image and described original image, respectively interpolation processing is carried out to described fisrt feature matrix and second characteristic matrix, generate the first interpolating matrix and the second interpolating matrix;
Generate the 3rd interpolating matrix according to described first interpolating matrix and described second interpolating matrix, according to described 3rd interpolating matrix, described enlarged image is compensated, generate the enlarged image after compensating.
The invention provides a kind of compensation system of enlarged image, comprising:
First processing unit, for determining the First Eigenvalue that in described original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, the First Eigenvalue corresponding for each described original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively;
Second processing unit, is connected with described first processing unit, for the magnification ratio according to enlarged image and described original image, carries out interpolation processing respectively to described fisrt feature matrix and second characteristic matrix, generates the first interpolating matrix and the second interpolating matrix;
Compensating unit, is connected with described second processing unit, for generating the 3rd interpolating matrix according to described first interpolating matrix and described second interpolating matrix, compensating, generate the enlarged image after compensating according to described 3rd interpolating matrix to described enlarged image.
As shown from the above technical solution, the compensation method of enlarged image provided by the invention and the compensation system of device enlarged image determine the First Eigenvalue that in original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, the First Eigenvalue corresponding for each original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively, according to the magnification ratio of enlarged image and original image, respectively interpolation processing is carried out to fisrt feature matrix and second characteristic matrix, generate the first interpolating matrix and the second interpolating matrix, the 3rd interpolating matrix is generated according to the first interpolating matrix and the second interpolating matrix, according to the 3rd interpolating matrix, enlarged image is compensated, generate the enlarged image after compensating.By compensating enlarged image, the edge of enlarged image can be made sharper keen, reduce fuzzy and crenellated phenomena, improve the effect of enlarged image.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
The compensation method process flow diagram of the enlarged image that Fig. 1 provides for the embodiment of the present invention.As shown in Figure 1, the compensation method of enlarged image that the present embodiment provides specifically can be applied to the compensation process through amplifying the enlarged image after process.Can be performed by the compensation system of enlarged image, the compensation system of this enlarged image can be integrated in the image processor of the equipment such as such as televisor, Set Top Box, video processor or graphics acceleration unit, also can arrange separately, the compensation system of this enlarged image can be realized by the mode of software and/or hardware.
The compensation method of the enlarged image that the present embodiment provides specifically comprises:
Step 10, in original image, determine the First Eigenvalue that in described original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue, the First Eigenvalue corresponding for each described original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively;
Step 20, magnification ratio according to enlarged image and described original image, carry out interpolation processing to described fisrt feature matrix and second characteristic matrix respectively, generate the first interpolating matrix and the second interpolating matrix;
Step 30, according to described first interpolating matrix and described second interpolating matrix generate the 3rd interpolating matrix, according to described 3rd interpolating matrix, described enlarged image is compensated, generate compensate after enlarged image.
Particularly, original image is and amplifies image before treatment, enlarged image is generated after original image being carried out amplification process, the resolution of such as original image is 720 × 480, when this original image to be zoomed into resolution be the enlarged image of 1440 × 960, the quantity of the pixel in enlarged image is four times of the quantity of the original image vegetarian refreshments in original image.
For each original image vegetarian refreshments in original image, the First Eigenvalue that this original image vegetarian refreshments is corresponding and Second Eigenvalue can be determined according to the pixel around this original image vegetarian refreshments.The First Eigenvalue is specifically as follows the maximal value of the pixel value of the pixel around this original image vegetarian refreshments, Second Eigenvalue can be the minimum value of the pixel value of pixel around this original image vegetarian refreshments, also first filtering process can be carried out to the pixel around this original image vegetarian refreshments, maximal value after filtering process is this First Eigenvalue, and minimum value is this Second Eigenvalue.For each original image vegetarian refreshments determines a First Eigenvalue and Second Eigenvalue, then all the First Eigenvalues form a fisrt feature value matrix, and the position of the First Eigenvalue in this fisrt feature value matrix that each original image vegetarian refreshments is corresponding is identical with this original image vegetarian refreshments position in original image.All Second Eigenvalues form a second feature value matrix, and the position of Second Eigenvalue in this second feature value matrix that each original image vegetarian refreshments is corresponding is also identical with this original image vegetarian refreshments position in original image.The resolution of original image is such as 720 × 480, and fisrt feature value matrix and second feature value matrix are the matrix of 720 row 480 row.
According to the magnification ratio of enlarged image relative to original image, respectively interpolation is carried out to fisrt feature value matrix and second feature value matrix and generate the first interpolating matrix and the second interpolating matrix.The resolution of such as enlarged image is 1440 × 960, then the first interpolating matrix and the second interpolating matrix are the matrix of 1440 row 960 row.The interpolation algorithm that interpolation processing adopts is specifically as follows bilinear interpolation and bi-cubic interpolation, also can adopt other interpolation algorithms of the prior art, not be limited with the present embodiment.
An element in first interpolating matrix is such as a1, in second interpolating matrix, the element of correspondence position is such as b1, the element of relevant position in the 3rd interpolating matrix is generated according to a1 and b1, such as can get the mean value of a1 and b1, also can finely tune on the basis of this mean value, as being multiplied by a coefficient, to obtain the element of relevant position in the 3rd interpolating matrix.According to the 3rd interpolating matrix, enlarged image is compensated again.
The compensation method of the enlarged image that the present embodiment provides, the compensation system of enlarged image determines the First Eigenvalue that in original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, the First Eigenvalue corresponding for each original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively, according to the magnification ratio of enlarged image and original image, respectively interpolation processing is carried out to fisrt feature matrix and second characteristic matrix, generate the first interpolating matrix and the second interpolating matrix, the 3rd interpolating matrix is generated according to the first interpolating matrix and the second interpolating matrix, according to the 3rd interpolating matrix, enlarged image is compensated, generate the enlarged image after compensating.By compensating enlarged image, the edge of enlarged image can be made sharper keen, reduce fuzzy and crenellated phenomena, improve the effect of enlarged image.
In the present embodiment, step 10, describedly determines the First Eigenvalue that in described original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, specifically can comprise:
Searched for by each described original pixels of search window to described original image, in described search procedure, determine the First Eigenvalue and the Second Eigenvalue of the original pixels that the center of described search window is corresponding according to the pixel value of the original pixels in described search window.
Particularly, the size of search window is that N × M, N and M are preferably odd number.The First Eigenvalue and the Second Eigenvalue of the original image vegetarian refreshments that the center of this search window is corresponding can be determined according to the pixel value of original image vegetarian refreshments each in search window.In actual process, can expand this original image according to the original image vegetarian refreshments of the outermost of original image, so that the First Eigenvalue and the Second Eigenvalue of each original image vegetarian refreshments can be determined in search procedure.
In the present embodiment, the described pixel value according to the original pixels in described search window determines the First Eigenvalue and the Second Eigenvalue of the original pixels that the center of described search window is corresponding, specifically can comprise:
Generate described the First Eigenvalue according to the maximal value of the pixel value of the original pixels in described search window, generate described Second Eigenvalue according to the minimum value of the pixel value of the original pixels in described search window.
In the present embodiment, in step 30, described according to described first interpolating matrix and described second interpolating matrix generation the 3rd interpolating matrix, specifically comprise:
Apply following formula and generate described 3rd interpolating matrix;
P
ij=(B
ij+C
ij)/2;
Wherein, P
ijfor the value of the i-th row jth row in described 3rd interpolating matrix, B
ijfor the value of the i-th row jth row in described first interpolating matrix, C
ijfor the value of the i-th row jth row in described second interpolating matrix.
In the present embodiment, in step 30, describedly according to described 3rd interpolating matrix, described enlarged image to be compensated, generates the enlarged image after compensating, specifically can comprise:
For each pixel determination gain in described enlarged image, form gain matrix;
Apply following formula and generate the enlarged image after compensating:
Y
ij=K[(X
ij-P
ij)×g
ij+P
ij];
Wherein, Y
ijfor the pixel value of the i-th row jth row in the enlarged image after described compensation, X
ijfor the pixel value of the i-th row jth row in described enlarged image, P
ijfor the value of described 3rd interpolating matrix i-th row jth row, g
ijfor the value of described gain matrix i-th row jth row, K is predetermined coefficient.
Particularly, in enlarged image, the gain of each pixel according to the difference of current region, can do self-adaptative adjustment, and namely the gain of each pixel can be different, and preferably, gain is greater than 1.
Further, in the present embodiment, after the following formula of described application generates the enlarged image after compensating, described method can also comprise:
If Y
ijbe greater than B
ij, then by Y
ijbe adjusted to B
ijif, Y
ijbe less than C
ij, then by Y
ijbe adjusted to C
ij.
In actual application, if Y
ijbe greater than B
ij, also can by Y
ijbe adjusted to B
ijneighbouring value, if Y
ijbe less than C
ij, then by Y
ijbe adjusted to C
ijneighbouring value.
By carrying out to enlarged image the gradient that above-mentioned compensation deals can increase enlarged image edge transition region, and then improve the acutance at enlarged image edge.
The compensation system structural representation of the enlarged image that Fig. 2 provides for the embodiment of the present invention.As shown in Figure 2, the compensation system of the enlarged image that the present embodiment provides specifically can realize each step of the compensation of the enlarged image that any embodiment of the present invention provides, does not repeat them here.The compensation system of the enlarged image that the present embodiment provides can by field programmable gate array (Field-Programmable Gate Array, be called for short FPGA) or application-specific IC (Application Specific Integrated Circuit, be called for short ASIC) etc. digital integrated circuit realize, also can be realized by other microcontroller chips, its way of realization is not limited with the present embodiment.
The compensation system of the enlarged image that the present embodiment provides specifically comprises: the first processing unit 11, second processing unit 12 and compensating unit 13.The First Eigenvalue corresponding for each described original image vegetarian refreshments and Second Eigenvalue, for determining the First Eigenvalue that in described original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, are formed fisrt feature matrix and second characteristic matrix by described first processing unit 11 respectively.Described second processing unit 12 is connected with described first processing unit 11, for the magnification ratio according to enlarged image and described original image, respectively interpolation processing is carried out to described fisrt feature matrix and second characteristic matrix, generate the first interpolating matrix and the second interpolating matrix.Described compensating unit 13 is connected with described second processing unit 12, for generating the 3rd interpolating matrix according to described first interpolating matrix and described second interpolating matrix, according to described 3rd interpolating matrix, described enlarged image is compensated, generate the enlarged image after compensating.
The compensation system of the enlarged image that the present embodiment provides, first processing unit 11 determines the First Eigenvalue that in original image, each original image vegetarian refreshments is corresponding and Second Eigenvalue in original image, the First Eigenvalue corresponding for each original image vegetarian refreshments and Second Eigenvalue are formed fisrt feature matrix and second characteristic matrix respectively, second processing unit 12 is according to the magnification ratio of enlarged image and original image, respectively interpolation processing is carried out to fisrt feature matrix and second characteristic matrix, generate the first interpolating matrix and the second interpolating matrix, compensating unit 13 generates the 3rd interpolating matrix according to the first interpolating matrix and the second interpolating matrix, according to the 3rd interpolating matrix, enlarged image is compensated, generate the enlarged image after compensating.By compensating enlarged image, the edge of enlarged image can be made sharper keen, reduce fuzzy and crenellated phenomena, improve the effect of enlarged image.
In the present embodiment, described first processing unit 11 is also for searching for by each described original pixels of search window to described original image, in described search procedure, determine the First Eigenvalue and the Second Eigenvalue of the original pixels that the center of described search window is corresponding according to the pixel value of the original pixels in described search window.
In the present embodiment, described first processing unit 11 is also for searching for by each described original pixels of search window to described original image, in described search procedure, generate described the First Eigenvalue according to the maximal value of the pixel value of the original pixels in described search window, generate described Second Eigenvalue according to the minimum value of the pixel value of the original pixels in described search window.
In the present embodiment, described compensating unit 13 also generates described 3rd interpolating matrix for applying following formula;
P
ij=(B
ij+C
ij)/2;
Wherein, P
ijfor the value of the i-th row jth row in described 3rd interpolating matrix, B
ijfor the value of the i-th row jth row in described first interpolating matrix, C
ijfor the value of the i-th row jth row in described second interpolating matrix.
In the present embodiment, described compensating unit 13, also for being each pixel determination gain in described enlarged image, forms gain matrix;
Apply following formula and generate the enlarged image after compensating:
Y
ij=K[(X
ij-P
ij)×g
ij+P
ij];
Wherein, Y
ijfor the pixel value of the i-th row jth row in the enlarged image after described compensation, X
ijfor the pixel value of the i-th row jth row in described enlarged image, P
ijfor the value of described 3rd interpolating matrix i-th row jth row, g
ijfor the value of described gain matrix i-th row jth row, K is predetermined coefficient.
Particularly, in enlarged image, the gain of each pixel according to the difference of current region, can do self-adaptative adjustment, and namely the gain of each pixel can be different, and preferably, gain is greater than 1.
In the present embodiment, the compensation system of described enlarged image can also comprise adjustment unit, if for Y
ijbe greater than B
ij, then by Y
ijbe adjusted to B
ijif, Y
ijbe less than C
ij, then by Y
ijbe adjusted to C
ij.
In actual application, if Y
ijbe greater than B
ij, also can by Y
ijbe adjusted to B
ijneighbouring value, if Y
ijbe less than C
ij, then by Y
ijbe adjusted to C
ijneighbouring value.
One of ordinary skill in the art will appreciate that: all or part of step realizing said method embodiment can have been come by the hardware that programmed instruction is relevant, aforesaid program can be stored in a computer read/write memory medium, this program, when performing, performs the step comprising said method embodiment; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Last it is noted that above embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme.