1. Field of the Invention
This invention is related to an image processing method applied to an image scanner using an image sensor, and particularly to a method of generating interpolation pixel data for a digital image.
2. Description of the Related Art
In an image scanner using an image sensor, a pixel interpolation process is performed to interpolate a lost pixel. Interpolation pixel data is obtained by averaging pixel data neighboring the lost pixel, or calculating a regression line of pixels neighboring the lost pixel using a least-square method. Moreover, as described in Japanese a Laid-Open Open Patent Publication 2003-101724, the pixel interpolation data is also obtained by calculating a biquadratic curve of four pixels neighboring the interpolation pixel.
There are various methods for obtaining the interpolation pixel data, however, a conventional pixel interpolation circuit has a following problem. Since the conventional pixel interpolation circuit calculates the interpolation pixel data using a fixed method without considering an image characteristic, for example, a difference between original pixels and interpolation pixels (interpolation error) becomes large in an image area forming outlines, and an image quality is deteriorated.
The present invention has been made in order to solve above problems and to provide a pixel interpolation circuit, which is able to calculate an interpolation pixel data without causing the interpolation error for images having various characteristics.
A pixel interpolation circuit according to this invention includes a plurality of interpolation circuits each calculating interpolation candidate data of a interpolation pixel and test interpolation data of a plurality of pixels neighboring the interpolation pixel using different interpolation methods, a determining circuit for selecting one of the interpolation circuits based on a difference between the test interpolation data and actual pixel data and an output circuit for outputting the interpolation candidate data calculated by the selected interpolation circuit as the interpolation pixel data.
A pixel interpolation method according to this invention comprising calculating interpolation candidate data of a interpolation pixel and test interpolation data of a plurality of pixels neighboring the interpolation pixel, using different interpolation methods, selecting one of the interpolation methods based on a difference between the test interpolation data and actual pixel data, and outputting the interpolation candidate data calculated by the selected interpolation method as the interpolation pixel data.
Preferred
Firstly, in the 1st interpolation circuit 4a, a test interpolation calculation is performed over pixels T1-Tm (hereinafter, referred to as test pixels) neighboring one of lost pixels included in the image data D1 so as to calculate test interpolation data TD1[T1]-TD1 [Tm] (Step 1).
The test interpolation data TD1[T1]−TD1[Tm] (indicated as TD1 in
When the test interpolation data TD1[Tm] and the determination data M1[T1]−M1[Tm] are calculated for the last test pixel Tm (Step 3), the first interpolation circuit 4a performs an interpolation calculation over the lost pixel L, so as to calculatean interpolation candidate data D1 (Step 4). The interpolation candidate data D1 is sent to the output circuit 3.
The above-described processes of Step 1-Step 4 are similarly performed in the 2nd-nth interpolation circuits 4b-4n (Step 5). In other words, the test interpolation data, TD2[T1]−TD2[Tm], . . . TDn[T1]−TDn[Tm] (indicated as TD2-TDn in
The determination circuit 2 calculates the absolute values of the differences between the test interpolation data TD1[T1]−TD1[Tm] and the values D1[T1]−D1[Tm] of the test pixels T1-Tm (Step 21), respectively, and outputs the absolute values as the determination data M1[T1]−M1[Tm] (Step 22). The determination data M1[T1]−M1[Tm] are calculated using the following Formulas (1).
M1[T1]=|TD1[T1]−D1[T1]| . . . M1[Tm]=|TD1[Tm]−DI[Tm]| Formulas (1):
The determination circuit 2 also performs processes of Step 21 and Step 22 for the test interpolation data, TD2[T1]−TD2[Tm], . . . TDn[Tl]−TDn[Tm], calculated by the 2nd-nth interpolation circuits 4b-4n, so as to calculate the determination data M2[T1]−M2[Tm], . . . Mn[T1]−Mn[Tm].
Next, the determination data M1[T1]−M1[Tm], . . . Mn[T1]−Mn[Tm] are evaluated in the control circuit 1 (Step 6).
Firstly, the control circuit 1 calculates evaluation data S1 for the 1st interpolation circuit 4a by summing up the determination data M1[T1]−M1[Tm] (Step 61).
The control circuit 1 similarly calculates evaluation data S2-Sn for the 2nd-nth interpolation circuits 4b-4n (Step 62).
Calculations of the evaluation data S1-Sn are represented by the following Formulas (2).
S1=M1[T1]+M1[T2] . . . +M1[Tm]
. . .
Sn=Mn[T1]+Mn[T2]+Mn[Tm] Formulas (2):
Next, the control circuit selects minimal evaluation data Sx from the evaluation data S1-Sn (Step 63), and then specifies an interpolation circuit 4x corresponding to the evaluation data Sx (Step 64). The smaller a difference between the test interpolation data and actual image data is, the smaller the evaluation data becomes. Therefore, the interpolation circuit 4x with the smallest evaluation data is estimated to have highest interpolation aptitude, which means the interpolation error becomes smallest. The control circuit 1 sends a selection signal C for selecting interpolation candidate data Dx calculated by the interpolation circuit 4× to the output circuit 3 (Step 65).
The output circuit 3 selects the interpolation candidate data Dx according to the selection signal C, and outputs as interpolation data DO (Step 7).
The processes of Step 1-Step 7 are performed for all the lost pixels to calculate interpolation pixel data DO.
The left/right averaging interpolation circuit 5 calculates an average value XL of pixels B and E located in left and right sides of the lost pixel L, and the rightward up averaging interpolation circuit 6 calculates an average value of pixels D and C. The average values XL calculated by the left/right averaging interpolation circuit 5 and the rightward up averaging interpolation circuit 6 are represented by the following Formulas (3) and (4), wherein data values (gradation values) of the pixels A-F are represented as XA-XF, respectively.
XL=(XB+XE)/2 Formula (3)
XL=(XC+XD)/2 Formula (4)
Hereinafter, a process of calculating an interpolation pixel data of the lost pixel L illustrated in
The left/right averaging interpolation circuit 5 calculates test interpolation data TD1[T1]−TD1[T4] for the test pixels T1-T4 illustrated in
The test interpolation data TD1[T2] for the test pixel T2 is obtained by calculating the average value of pixels “T2B” and “T2E” located in left and right sides of the test pixel T2 as illustrated in
The test interpolation data TD1[T3] for the test pixel T3 is obtained by calculating the average value of pixels “T3B” and “T3E” located in left and right sides of the test pixel T3 as illustrated in
The test interpolation data TD1[T4] for the test pixel T4 is obtained by calculating the average value of pixels “T4B” and “T4E” located in left and right sides of the test pixel T4 as illustrated in
Therefore, the test interpolation data TD1[T1]−TD1[T4] are calculated as follows;
TD1[T1]=(T1B+T1E)/2=(255+255)/2=255
TD1[T2]=(T2B+T2E)/2=(255+0)/2=127.5
TD1[T3]=(T3B+T3E)/2=(255+0)/2=127.5
TD1[T4]=(T4B+T4E)/2=(0+0)/2=0
As illustrated in
D1=(LB+LE)/2=(255+0)/2=127.5
The determination circuit 2 obtains the determination data M1[T1]−M1[T4] by calculating the absolute values of the differences between the test interpolation data TD1[T1]−TD1[T4] and the values DI[Tl]−DI[T4] of the test pixels T1-T4.
The determination data M1[T1]−M1[T4] are calculated as follows.
M1[T1]=|TD1[T1]−DI[T1]|=|255−255|=0
M1[T2]=|TD1[T2]−DI[T2]|=|127.5−255|=127.5
M1[T3]=|TD1[T3]−DI[T3]|=|127.5−0|=127.5
M1[T4]=|TD1[T4]−DI[T4]|=|0−0|=0
The rightward up averaging interpolation circuit 6 calculates test interpolation data TD1[T1]−TD1[T4] for the test pixels T1-T4 illustrated in
The test interpolation data TD2[T1] for the test pixel T1 is obtained by calculating the average value of pixels “T1D” and “T1C” located in upper right and lower left positions of the test pixel T1 as illustrated in
The test interpolation data TD2[T2] for the test pixel T2 is obtained by calculating the average value of pixels “T2D” and “T2C” located on the rightward up and leftward down positions of the test pixel T2 as illustrated in
The test interpolation data TD2[T3] for the test pixel T3 is obtained by calculating the average value of pixels “T3D” and “T3C” located on the rightward up and leftward down positions of the test pixel T3 as illustrated in
The test interpolation data TD2[T4] for the test pixel T4 is obtained by calculating the average value of pixels “T4D” and “T4C” located on the rightward up and leftward down positions of the test pixel T4 as illustrated in
Therefore, the test interpolation data TD1[T1]−TD1[T4] is calculated as follows;
TD2[T1]=(T1C+T1D)/2=(255+255)/2=255
TD2[T2]=(T2C+T2D)/2=(255+0)/2=127.5
TD2[T3]=(T3C+T3D)/2=(255+0)/2=127.5
TD2[T4]=(T4C+T4D)/2=(0+0)/2=0
As illustrated in
D2=(LC+LD)/2=(0+0)/2=0
The determination circuit 2 obtains the determination data M2[T1]−M2[T4] by calculating the absolute values of the differences between the test interpolation data TD2[T1]−TD2[T4] and the values DI[T1]−DI[T4] of the test pixels T1-T4.
The determination data M2[T1]−M2[T4] is calculated as follows;
M2[T1]=|TD2[T1]−DI[T1]|=|255−255|=0
M2[T2]=|TD2[T2]−DI[T2]|=|127.5−255|=127.5
M2[T3]=|TD2[T3]−DI[T3]|=|0−0|=0
M2[T4]=|TD2[T4]−DI[T4]|=|0−0|=0
The control circuit 1 adds up the determination data M1[T1]−M1[T4], and calculates the evaluation data S1 for evaluating the interpolation aptitude of the left/right averaging interpolation circuit 5.
The evaluation data S1 is given as follows;
In a similar way, the control circuit 1 adds up the determination data M2[T1]−M2[T4], and calculates the evaluation data S2 for evaluating the interpolation aptitude of the rightward up averaging interpolation circuit 6.
The evaluation data S2 is given as follows;
The evaluation data shown in
The control circuit 1 selects the evaluation data S2, and specifies the rightward up averaging calculating circuit 6 corresponding to this evaluation data. The control circuit 1 sends the selection signal C for selecting the interpolation candidate data D2 for the lost pixel L calculated by the rightward up averaging interpolation circuit 6 to the output circuit 3.
According to the selection signal C, the output circuit 3 outputs the interpolation candidate data D2 (D2=0) calculated by the rightward up averaging interpolation circuit 6 as the interpolation pixel data DO (DO=0).
As illustrated in
As described above, by selecting the interpolation candidate data calculated by the different interpolation methods, based on the results of the test interpolation calculations, the interpolation pixel data can be accurately calculated using the most suitable interpolation method in accordance with an outline neighboring the interpolation pixel.
The leftward up averaging interpolation circuit 7 calculates average values of pixels located on the leftward up and rightward down positions of a pixel to be interpolated. In other words, the circuit calculates the average value “XL” of pixels “A” and “F” located on the leftward up and rightward down positions of the pixel L. The average value XL calculated by the leftward up averaging interpolation circuit 7 is represented by the following Formula (5), wherein data values (gradation values) of pixels A and F are represented as XA and XF, respectively.
XL=(XA+XF)/2 Formula (5)
Hereinafter, processes of calculating interpolation pixel data of the lost pixel L illustrated in
The leftward up averaging interpolation circuit 7 calculates test interpolation data TD3[T1]−TD3[T4] for the test pixels T1-T4 illustrated in
The test interpolation data TD3[T1] for the test pixel T1 is obtained by calculating the average value of pixels “T1A” and “T1F” located on the leftward up and rightward down positions of the test pixel T1 as illustrated in
The test interpolation data TD3[T2] for the test pixel T2 is obtained by calculating the average value of pixels “T2A” and “T2F” located on the leftward up and rightward down positions of the test pixel T2 as illustrated in
The test interpolation data TD3[T3] for the test pixel T3 is obtained by calculating the average value of pixels “T3A” and “T3F” located on the leftward up and rightward down positions of the test pixel T3 as illustrated in
The test interpolation data TD3[T4] for the test pixel T4 is obtained by calculating the average value of pixels “T4A” and “T4F” located on the leftward up and rightward down positions of the test pixel T4 as illustrated in
Therefore, the test interpolation data TD3[T1]−TD3[T4] are calculated as follows;
TD3[T1]=(T1A+T1F)/2=(255+255)/2=255
TD3[T2]=(T2A+T2F)/2=(255+0)/2=127.5
TD3[T3]=(T3A+T3F)/2=(0+0)/2=0
TD3[T4]=(T4A+T4F)/2=(0+0)/2=0
As illustrated in
D3=(LA+LF)/2=(0+0)/2=0
The determination circuit 2 obtains the determination data M1[T1]−M1[T4] by calculating the absolute values of the differences between the test interpolation data TD3[T1]−TD3[T4] and the values DI[T1]−DI[T4] of the test pixels T1-T4.
The determination data M3[T1] through M3[T4] can be calculated as follows;
M3[T1]=|TD3[T1]−DI[T1]|=|255−2551=0
M3[T2]=|TD3[T2]−DI[T2]|=|127.5−255|=127.5
M3[T3]=TD3[T3]−DI[T3]|=|0−0|=0
M3[T4]=|TD3[T4]−DI[T4]|=|0−0=0
The left/right averaging interpolation circuit 5 and the rightward up averaging interpolation circuit 6 calculate the interpolation candidate data D1 and D2 and the test interpolation data TD1[T1]−TD1[T4] and TD2[T1]−TD21[T4], and the determination circuit 2 calculates determination data M1[T1]−M1[T4] and M2[T1]−M2[T4] based on the test interpolation data. The processes in the left/right averaging interpolation circuit 5 and the rightward up averaging interpolation circuit 6 are described in the Embodiment 1.
Here, the interpolation candidate data D1 calculated by the left/right averaging interpolation circuit 5 is 127.5, and the interpolation candidate data D2 calculated by the rightward up averaging interpolation circuit 6 is 127.5.
The control circuit 1 adds up the determination data M1[T1]−M1[T4], and calculates the evaluation data S1 for evaluating the interpolation aptitude of the left/right averaging interpolation circuit 5.
The evaluation data S1 is given as follows;
In a similar way, the control circuit 1 adds up the determination data M2[T1]−M2[T4], and calculates the evaluation data S2 for evaluating the interpolation aptitude of the rightward up averaging interpolation circuit 6
The evaluation data S2 is given as follows;
In a similar way, the control circuit 1 adds up the determination data M3[T1]−M3[T4], and calculates the evaluation data S3 for evaluating the interpolation aptitude of the leftward up averaging interpolation circuit 7.
The evaluation data S3 is given as follows;
The control circuit 1 selects the minimal evaluation data S3, and specifies leftward up averaging interpolation circuit 7 corresponding to this evaluation data. The control circuit sends the selection signal C for selecting the interpolation candidate data D3 calculated by the leftwardup averaging interpolation circuit 7 for the lost pixel L to the output circuit 3.
According to the selection signal C, the output circuit 3 outputs the interpolation candidate data D3 (D3=0) calculated by the leftward up averaging interpolation circuit 7 as the interpolation pixel data DO (DO=0).
As illustrated in
As described above, by further providing the leftward up averaging interpolation circuit 7, more accurate interpolation process can be realized. In other words, the most suitable interpolation method is used for an image having different characteristics. Furthermore, the pixel interpolation circuit according to this invention can be used for increasing the number of pixels of an input image.
In the interpolation unit 4, the interpolation candidate data may be calculated using methods other than a left/right averaging interpolation, a rightward up average interpolation, or a leftward up average interpolation. For example such a method as calculating interpolation pixel using the least-square method, or calculating interpolation pixel data using a biquadratic curve obtained from four pixels neighboring the interpolation pixel can be used. In the pixel interpolation circuit according to this invention, various kinds of interpolation circuits can further be added to the interpolation unit 4 without drastically modifying a configuration of the whole circuit.
Data amount of the determination data to be processed in the determination circuit 2 may be increased when the number of the interpolation circuits composing the interpolation unit 4 is increased. The data amount of the determination data can be decreased, by binarizing or ternarizing the determination data using a predefined threshold value.
As an example, a method of ternarizing the determination data values will be explained.
The determination circuit 2 compares the absolute value of the difference between the test interpolation data TD1[T1] calculated by the first interpolation circuit 4a and the value DI[T1] of the test pixel T1, with two predefined threshold values TH1 and TH2 (0≦TH1<TH2). When the absolute value is smaller than the threshold value TH1, a value of the determination data M1[T1] is set −1; when the absolute value is larger than the threshold value TH1 and smaller than the threshold value TH2, a value of the determination data is set 0; and when the absolute value is larger than the threshold value TH2, a value of the determination data is set 1.
That is:
The determination circuit 2 similarly calculates the determination data M1[T2]−M1[Tm] for the test pixels T2-Tm.
That is:
The determination data M1[T1]−M1[Tm] calculated in the above described method represent error of the test interpolation data with three values, −1, 0, and 1. The determination data becomes −1 when the error is small.
The determination circuit 2 similarly calculates the ternarized determination data MD2[T1]−MD2[Tm] for the test interpolation data TD2[T1]−TD2[Tm], . . . TDn[T1]−TDn[Tm] calculated by the 2nd-nth interpolation circuits 4b-4n.
Hereinafter, a process of calculating ternarized determination data in the pixel interpolation circuit illustrated in
As calculated in Embodiment 1, the absolute values of the differences between the test interpolation data TD1[T1]−TD1[T4] and the values DI[T1]−DI[T4] of the test pixels T1-T4 are given as follows;
|TD1[T1]−DI[T1]|=|255−255|=0
|TD1[T2]−DI[T2]|=|127.5−255|=127.5
|TD1[T3]−DI[T3]|=|127.5−0|=127.5
|TD1[T4]−DI[T4]|=|0−0|=0
Relations between these absolute values and the threshold values TH1 (TH1=50) and TH2 (TH1=100) are shown as follows;
|TD1[T1]−DI[T1]|<TH1
TH2≦|TD1[T2]−DI[T2]|
TH2<|TD1[T3]−DI[T3]|
|TD1[T4]−DI[T4]|<TH1
Therefore, the determination data calculated for the left/right averaging interpolation circuit 5 are given as follows;
M1[T1]=−1
M1[T2]=1
M1[T3]=1
M1[T4]=−1
The absolute values of the differences between the test interpolation data TD1[T1]−TD1[T4] calculated by the rightward up averaging interpolation circuit 6 and the values DI[T1]−DI[T4] of the test pixels T1-T4 are given as follows;
|TD2[T1]−DI[T1]|=|255−2551=0
|TD2[T2]−DI[T2]|=|127.5−255|=127.5
|TD2[T3]−DI[T3]|=|0−0|=0
|TD2[T4]−DI[T4]|=|0−0|=0
Relations between these absolute values and the threshold values TH1 (TH1=50) and TH2 (TH1=100) are given as follows;
|TD2[T1]−DI[T1]|<TH1
TH2<|TD2[T2]−DI[T2]|
TH2<|TD2[T3]−DI[T3]|
|TD2[T4]−DI[T4]|<TH1
Therefore, the determination data calculated for the rightward up averaging interpolation circuit 6 are given as follows;
M2[T1]=−1
M2[T2]=1
M2[T3]=−1
M2[T4]=−1
The control circuit 1 adds up the ternarized determination data M1[T1]−M1[T4], and calculates the evaluation data S1 for the left/right averaging interpolation circuit 5.
The evaluation data S1 is given as follows;
Similarly, the control circuit 1 adds up the determination data M2[T1]−M2[T4], and calculates the evaluation data S2 for evaluating the rightward up averaging interpolation circuit 6.
The evaluation data S2 is given as follows;
In the above explanation, the determination data is ternarized using two threshold values. The data volume of the determination data can be also decreased by binarizing them using one threshold value or by decreasing the number of bits.
The pixel interpolation circuit according to this invention may be configured by either hardware or software, or may be configured with both hardware and software being properly mixed.
Number | Date | Country | Kind |
---|---|---|---|
2003-347944 | Oct 2003 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP04/09179 | 6/30/2004 | WO | 7/7/2005 |