The present invention relates to the field of image processing technology, and particularly to a downsampling based display method and a downsampling based display apparatus.
Conventional portable multimedia players (PMPs) and personal digital assistants (PDAs) generally display images with low-resolution. When a content inputted into these apparatuses is high-resolution, it is necessary to perform a downsampling (DS) processing on the high-resolution content. For example, the content with resolution of 1280*960 is down to a resolution of 640*480 by the downsampling processing.
Currently, the downsampling methods can be classified into pixel-based downsampling and subpixel-based downsampling. In one aspect, when performing an average pixel-based DS (APD), for example obtaining RGB values of four pixels and then calculating averages thereof to obtain a new RGB value, although such APD method is simple in calculation, it would result in the problems of reduced resolution and image blurring. In another aspect, when performing the subpixel-based DS, for example obtaining RGB values of subpixels in diagonal directions to obtain a new image, although the subpixel-based DS method can obtain an image sharper than that obtained by the APD method, it would cause the problem of color aliasing.
Accordingly, a technical problem to be solved by the present invention is to provide a downsampling based display method and a downsampling based display apparatus, so as to obtain sharp image and avoid color aliasing.
In order to solve the above technical problem, the present invention provides a downsampling based display method. The method includes: obtaining an input image, wherein the input image includes a plurality of pixels; obtaining at least two pixels neighboring with a to-be-calculated DS pixel in a target image on each of at least two directions from the plurality of pixels of the input image to obtain at least four first neighboring pixels, and calculating theoretical values of each of the at least four first neighboring pixels on the at least two directions; obtaining errors between the theoretical values of each of the at least four first neighboring pixels and a corresponding original value, and determining weight coefficients for calculating the DS pixel according to the errors; and calculating an estimation value of the DS pixel according to the weight coefficients and a weighted cubic interpolation calculation model built in advance for the DS pixel, using the above steps to calculate corresponding estimation values of the other DS pixels in the target image, and thereby obtaining a downsampling processed image.
In an exemplary embodiment, after the step of obtaining an input image, the method further includes: obtaining at least four pixels neighboring with the DS pixel on each of at least two directions from the plurality of pixels of the input image to obtain at least eight second neighboring pixels, and building the weighted cubic interpolation calculation model according to the at least eight second neighboring pixels.
In an exemplary embodiment, the at least two directions are four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel, and correspondingly sixteen second neighboring pixels are obtained; the weighted cubic interpolation calculation model is:
p
m
=k
0(λ1A+λ2B+λ3C+λ4D)+k45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on a 45-degree direction of pm in the plurality of pixels of the input image, Ph5˜Ph8 are four pixels neighboring with pm on a 135-degree direction of pm in the plurality of pixels of the input image; A, B, C, D are four pixels neighboring with pm on a 0-degree direction of pm in the plurality of pixels of the input image; E, F, G, H are four pixels neighboring with pm on a 90-degree direction of pm in the plurality of pixels of the input image; k0, k45, k90, k135 are weight coefficients, and k0+k45+k90+k135=1.
In an exemplary embodiment, values of A, B, C, D, E, F, G, H are determined according to the following formulas:
W
1=λ1Pn1+λ2Pn2+λ3Pn3+λ4Pn4 (1)
W
2=λ1Pm1+λ2Pm2+λ3Pm3+λ4Pm4 (2)
where, the obtained four pixels on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel cooperatively constitute a pixel array of 4*4; the formula (1) is used to calculate the values of A, B, C, D; Pn1, Pn2, Pn3, Pn4 are four pixels in each column of the pixel array; the formula (2) is used to calculate the values of E, F, G, H; and Pm1, Pm2, Pm3, Pm4 are four pixels in each row of the pixel array.
In an exemplary embodiment, the step of calculating theoretical values of each of the at least four first neighboring pixels on the at least two directions includes: substituting an original value of each pixel of the at least four first neighboring pixels into a cubic interpolation formula to calculate the theoretical values of the pixel on the at least two directions, wherein the cubic interpolation formula is: P′j1(x)=λ1Pj2+λ2Pj3+λ3Pj4+λ4Pj5; where, x is a value of a corresponding one of the at least two directions, Pj2, Pj3, Pj4, Pj5 are pixels neighboring with the DS pixel on the corresponding direction of the DS pixel in the plurality of pixels of the input image; P′j1 is an interpolation value of Pj2, Pj3, Pj4, Pj5.
In an exemplary embodiment, the at least two directions are two directions of 45-degree and 135-degree with respect to the DS pixel, and correspondingly eight second neighboring pixels are obtained; the weighted cubic interpolation calculation model is:
p
m
=k
45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where, pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on a 45-degree direction of pm in the plurality of pixels of the input image, and Ph5˜Ph8 are four pixels neighboring with pm on a 135-degree direction of pm in the plurality of pixels of the input image; k45, k135 are weight coefficients, and k45+k135=1.
In an exemplary embodiment, the step of calculating theoretical values of each of the at least four first neighboring pixels on the at least two directions includes: substituting an original value of each pixel of the at least four first neighboring pixels into a cubic interpolation formula to calculate the theoretical values of the pixel on the at least two directions, wherein the cubic interpolation formula is: P′j1(x)=λ1Pj2+λ2Pj3+λ3Pj4+λj4Pj5; where x is a value of a corresponding one of the at least two directions, Pj2, Pj3, Pj4, Pj5 are pixels neighboring with the DS pixel on the corresponding direction of the DS pixel in the plurality of pixels of the input image; P′j1 is an interpolation value of Pj2, Pj3, Pj4, Pj5.
In order to solve the above technical problem, the present invention further provides a downsampling based display apparatus adapted for being inputted with an image including a plurality of pixels. The display apparatus includes: a pixel theoretical value calculation unit, configured to obtain at least two pixels neighboring with a to-be-calculated DS pixel in a target image on each of at least two directions from the plurality of pixels of the input image to thereby obtain at least four first neighboring pixels, and calculate theoretical values of each pixel of the at least four first neighboring pixels on the at least two directions; a weighted cubic interpolation calculation unit, configured to obtain at least four pixels neighboring with the DS pixel on each of at least two directions from the plurality of pixels of the input image to thereby obtain at least eight second neighboring pixels, and build a weighted cubic interpolation calculation model for calculating the DS pixel in advance according to the at least eight second neighboring pixels; a weight coefficient calculation unit, configured to obtain errors of the theoretical values of each pixel of the at least four first neighboring pixels and a corresponding original value, and determine weight coefficients for calculating the DS pixel according to the errors; and a DS pixel calculation unit, configured to select a corresponding weighted cubic interpolation calculation model according to the weight coefficients to calculate an estimation value of the DS pixel. The display apparatus calculates a corresponding estimation value of each DS pixel in the target image, and thereby a downsampling processed image is obtained.
In an exemplary embodiment, the at least two directions are four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel, and correspondingly sixteen second neighboring pixels are obtained; the weighted cubic interpolation calculation model built by the weighted cubic interpolation calculation unit in advance is:
p
m
=k
0(λ1A+λ2B+λ3C+λ4D)+k45(λ1Ph1+λ2Ph2λ3Ph3λ4Ph4)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1Ph5λ2Ph6+λ3Ph7+λ4Ph8);
where pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on a 45-degree direction of pm in the plurality of pixels of the input image, Ph8˜Ph8 are four pixels neighboring with pm on a 135-degree direction of pm in the plurality of pixels of the input image; A, B, C, D are four pixels neighboring with pm on a 0-degree direction of pm in the plurality of pixels of the input image; E, F, G, H are four pixels neighboring with pm on a 90-degree direction of pm in the plurality of pixels of the input image; k0, k45, k90, k135 are weight coefficients, and k0+k45+k90+k135=1.
In an exemplary embodiment, the pixel theoretical value calculation unit substitutes an original value of each pixel of the at least four first neighboring pixels into a cubic interpolation formula to calculate the theoretical values of the pixel on the at least two directions, and the cubic interpolation formula is: P′j1(x)=λ1Pj2+λ2Pj3+λ3Pj4+λ4Pj5; where x is a value of a corresponding one of the at least two directions, Pj2, Pj3, Pj4, Pj5 are pixels neighboring with the DS pixel on the corresponding direction of the DS pixel in the plurality of pixels of the input image; P′j1 is an interpolation value of Pj2, Pj3, Pj4, Pj5.
In an exemplary embodiment, the at least two directions are two directions of 45-degree and 135-degree with respect to the DS pixel, and correspondingly eight second neighboring pixels are obtained; the weighted cubic interpolation calculation model is:
p
m
=k
45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where, pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on a 45-degree direction of pm in the plurality of pixels of the input image, and Ph5˜Ph8 are four pixels neighboring with pm on a 135-degree direction of pm in the plurality of pixels of the input image; k45, k135 are weight coefficients, and k45+k135=1.
In an exemplary embodiment, the pixel theoretical value calculation unit substitutes an original value of each pixel of the at least four first neighboring pixels into a cubic interpolation formula to calculate the theoretical values of the pixel on the at least two directions, and the cubic interpolation formula is: P′j1(x)=λ1Pj2+λ2Pj3+λ3Pj4+λ4Pj5; where x is a value of a corresponding one of the at least two directions, Pj2, Pj3, Pj4, Pj5 are pixels neighboring with the DS pixel on the corresponding direction of the DS pixel in the plurality of pixels of the input image; P′j1 is an interpolation value of Pj2, Pj3, Pj4, Pj5.
In order to solve the above technical problem, the present invention further provides a downsampling based display method. The method includes: obtaining an input image, wherein the input image comprises a plurality of pixels; obtaining at least four pixels neighboring with a to-be-calculated DS pixel in a target image on each of at least two directions from the plurality of pixels of the input image to obtain at least eight second neighboring pixels, and building a weighted cubic interpolation calculation model according to the at least eight second neighboring pixels; obtaining at least two pixels neighboring with the DS pixel on each of at least two directions from the plurality of pixels of the input image to obtain at least four first neighboring pixels, and calculating theoretical values of each pixel of the at least four first neighboring pixels on the at least two directions; obtaining errors between the theoretical values of each pixel of the at least four first neighboring pixels and a corresponding original value of the pixel, and determining weight coefficients for calculating the DS pixel according to the errors; and calculating an estimation value of the DS pixel according to the weight coefficients and the weighted cubic interpolation calculation model, using the above steps to calculate corresponding estimation values of the other DS pixels in the target image, and thereby obtaining a downsampling processed image.
Sum up, the present invention provides downsampling based display method and display apparatus, by building a weighted cubic interpolation model for a to-be-calculated DS pixel, using the model to calculate theoretical values of original image pixels neighboring with the to-be-calculated DS pixel, then analyzing errors between the theoretical values and corresponding original values to obtain weight coefficients fed back to the weighted cubic interpolation model for calculating the DS pixel. Such DS method of pixel-based calculation can avoid the color aliasing of the subpixel-based DS method, and also can obtain sharp image.
In order to further understand the features and technical contents of the present invention, please refer to the following detailed description and accompanying drawings of the present invention. However, the drawings are provided for the purpose of illustration and description only, and are not intended to limit the present invention.
Embodiments of the present invention will be described below in detail with reference to the drawings, and thereby the technical solutions of the present invention and other beneficial effects will be more apparent. In the drawings:
In the following, with reference to accompanying drawings of embodiments of the present invention, technical solutions in the embodiments of the present invention will be clearly and completely described. Apparently, the embodiments of the present invention described below only are a part of embodiments of the present invention, but not all embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary skill in the art without creative effort belong to the scope of protection of the present invention.
Firstly, derivation principles of a cubic interpolation coefficient Bicubic and a cubic interpolation formula will be described below.
If the expression of a function f(x) and its derivatives at x=0, x=1 are given, the function can be interpolated in the range of [0, 1]; and when the expression of the function is a cubic polynomial, it is referred to as cubic interpolation.
The derivation principle of the cubic interpolation coefficient Bicubic will be described as follows.
Setting the cubic polynomial f(x) and its derivative f′(x) respectively are:
f(x)=ax3+bx2+cx+d (1)
f′(x)=3ax2+2bx+c (2)
The cubic polynomial f(x) and its derivative f′(x) at x=0, x=1 respectively are:
f(0)=d (3)
f(1)=a+b+c+d (4)
f′(0)=c (5)
f′(1)=3a+2b+c (6)
The above four equations (3)˜(6) are equivalently transformed to be:
a=2f(0)−2f(1)+f′(0)+f′(1) (7)
b=−3f(0)+3f(1)−2f′(0)−f′(1) (8)
c=f′(0) (9)
d=f(0) (10
It is assumed that values of four points P0, P1, P2, P3 respectively are known as f(−1), f(0), f(1), f(2), formulas can be obtained as follows:
f(0)=P1 (11)
f(1)=P2 (12)
f′(0)=(P2−P0)/2 (13)
f′(1)=(P3−P1)/2 (14)
After substituting the formulas (11)˜(14) into the formulas (7)˜(10) to calculate the coefficients a, b, c, a bicubic formula can be obtained as follows:
Setting the interpolation is x=0.5 and substituting x=0.5 into the formula (15), a formula (16) then can be obtained as follows:
where λ1, λ2, λ3, λ4 are cubic interpolation coefficients, and
Setting x0.5 is an interpolation of x−1, x0, x1 and x2, the formula (16) can be changed to be the following formula (17), i.e., a cubic interpolation formula:
f(x0.5)=λ1f(x−1)+λ2f(x0)+λ3f(x1)+λ4f(x2) (17)
Referring to
Step S10: obtaining an input image including M*N pixels, and obtaining an original image according to the M*N pixels.
A video streaming image or picture image collected by a method such as mutual transmission among camera, network download and facility can be used as current input image.
Step 11: selecting at least four pixels neighboring with a to-be-calculated pixel on each of at least two directions from the M*N pixels of the original image to obtain at least eight second neighboring pixels, and building a weighted cubic interpolation calculation model for calculating a corresponding DS pixel according to the obtained at least eight second neighboring pixels.
In a first embodiment, the at least two directions are four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel. The weighted cubic interpolation calculation model is a 0-45-90-135 model. Specifically, four pixels neighboring with the DS pixel on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree are selected from the M*N pixels in the original image to obtain sixteen second neighboring pixels, and then the sixteen second neighboring pixels are used to build the weighted cubic interpolation calculation model.
The weighted cubic interpolation calculation model is:
p
m
=k
0(λ1A+λ2B+λ3C+λ4D)+k45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where pm is a to-be-calculated DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on the 45-degree direction of pm in the M*N pixels of the original image, Ph5˜Ph8 are four pixels neighboring with pm on the 135-degree direction of pm in the M*N pixels of the original image, A, B, C, D are four pixels neighboring with pm on the 0-degree direction of pm in the M*N pixels of the original image, E, F, G, H are four pixels neighboring with pm on the 90-degree direction of pm in the M*N pixels of the original image, k0, k45, k90, k135 are weight coefficients, and k0+k45+k90+k135=1.
Furthermore, values of A, B, C, D, E, F, G, H are determined by the following formulas:
W
1=λ1Pn1+λ2Pn2+λ3Pn3+λ4Pn4 (18)
W
2=λ1Pm1+λ2Pm2+λ3Pm3+λ4Pm4 (19)
The obtained four pixels on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel cooperatively constitute a pixel array of 4*4. The formula (18) is for calculating the values of A, B, C, D. Pn1, Pn2, Pn3, Pn4 are four pixels of each column in the pixel array of 4*4. The formula (19) is for calculating the values of E, F, G, H. Pm1, Pm2, Pm3, Pm4 are four pixels of each row in the pixel array of 4*4.
In a second embodiment, the at least two directions are two directions of 45-degree and 135-degree with respect to the DS pixel, and the weighted cubic interpolation calculation model is a 45-135 model. Specifically, four pixels neighboring the DS pixel on each of the two directions of 45-degree and 135-degree with respect to the DS pixel are selected from the M*N pixels of the original image to obtain eight second neighboring pixels, and then the eight neighboring pixels are used to build the weighted cubic interpolation calculation model.
The weighted cubic interpolation calculation model is:
p
m
=k
45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on the 45-degree direction of pm in the M*N pixels of the original image, Ph5˜Ph8 are four pixels neighboring with pm on the 135-degree direction of pm in the M*N pixels of the original image, k45, k135 are weight coefficients, and k45+k135=1.
Step S12: selecting at least two pixels neighboring with the DS pixel on each of at least two directions from the pixel array of M*N in the original image to obtain at least four first neighboring pixels, and calculating theoretical values of each of the at least four first neighboring pixels by using the cubic interpolation formula (17).
Step S13: calculating an error between the theoretical value of each of the at least four first neighboring pixels and an original value of the first neighboring pixel, and then determining the weight coefficients for calculating a corresponding DS pixel according to the errors.
Step S14: selecting a corresponding weighted cubic interpolation calculation model, and calculating an estimation value of the DS pixel according to the determined weight coefficients.
Moreover, as to the other DS pixels of the target image, corresponding estimation values can be calculated by using the above steps, and thereby the downsampling processed image can be obtained.
The DS pixel being p22 is taken as an example to describe the present invention below in detail.
Please also refer to
As described in the step S11, the weighted cubic interpolation calculation model for calculating p22 is:
p
22
=k
0(Δ1A+λ2B+λ3C+λ4D)+k45(λ1P63+λ2P54+λ3P45+λ4P36)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1P33+λ2P44+λ3P55+λ4P66);
where P63, P54, P45, P36 are the four pixels neighboring with p22 on the 45-degree direction of p22 in the pixels P00˜P911 of the original image; and P33, P44, P55, P66 are the four pixels neighboring with p22 on the 135-degree direction of p22 in the pixels P00˜P911 of the original image
According to the cubic interpolation coefficients λ1, λ2, λ3, λ4 and the four pixels neighboring with p22 on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to p22 in the pixels P00˜P911 of the original image, the values of A, B, C, D, E, F, G, H are determined as:
A=λ
1
P
33+λ2P43+λ3P53+λ4P63
B=λ
1
P
34+λ2P44+λ3P54+λ4P64
C=λ
1
P
35+λ2P45+λ3P55+λ4P65
D=λ
1
P
36+λ2P46+λ3P56+λ4P66
E=λ
1
P
33+λ2P34+λ3P35+λ4P36
F=λ
1
P
43+λ2P44+λ3P45+λ4P46
G=λ
1
P
53+λ2P54+λ3P55+λ4P56
H=λ
1
P
63+λ2P64+λ3P65+λ4P66
Please also refer to
P′
44(0)=λ1P42+λ2P43+λ3P45+λ4P46
P′
44(45)=λ1P62+λ2P53+λ3P35+λ4P26
P′
44(90)=λ1P24+λ2P34+λ3P54+λ4P64
P′
44(135)=λ1P22+λ2P33+λ3P55+λ4P66
P′
45(0)=λ1P43+λ2P44+λ3P46+λ4P47
P′
45(45)=λ1P63+λ2P54+λ3P36+λ4P27
P′
45(90)=λ1P25+λ2P35+λ3P55+λ4P65
P′
45(135)=λ1P23+λ2P34+λ3P56+λ4P67
P′
54(0)=λ1P52+λ2P53+λ3P55+λ4P56
P′
54(45)=λ1P72+λ2P63+λ3P45+λ4P36
P′
54(90)=λ1P34+λ2P44+λ3P64+λ4P74
P′
54(135)=λ1P32+λ2P43+λ3P65+λ4P76
P′
55(0)=λ1P53+λ2P54+λ3P56+λ4P57
P′
55(45)=λ1P63+λ2P64+λ3P46+λ4P37
P′
55(90)=λ1P35+λ2P45+λ3P65+λ4P75
P′
55(135)=λ1P33+λ2P44+λ3P66+λ4P77
As described in the step S13, errors between the theoretical values and the original value of each one of P44, P45, P54, P55 are calculated, and the sum of errors on each of 0-degree, 45-degree, 90-degree and 135-degree further is determined as follows:
Sum_error0=|P44−P′44(0)|+|P45−P′45(0)|+|P54−P′54(0)|+|P55−P′55(0)|
Sum_error45=|P44−P′44(45)|+|P45−P′45(45)|+|P54−P′54(45)|+|P55−P′55(45)|
Sum_error90=|P44−P′44(90)|+|P45−P′45(90)|+|P54−P′54(90)|+|P55−P′55(90)|
Sum_error135=|P44−P′44(135)|+|P45−P′45(135)|+|P54−P′54(135)|+|P55−P′55(135)|;
According to the sums of error, the weight coefficients k0, k45, k90, k135 are calculated as follows:
As described in the step S14, the weighted cubic interpolation calculation model corresponding to p22 is selected, and the calculated weight coefficients then are substituted into the weighted cubic interpolation calculation model to calculate an estimation value of p22 as follows:
Please also refer to
As described in the step S11, a weighted cubic interpolation calculation model for calculating p22 is:
p
22
=k
45(λ1P63+λ2P54+λ3P45+λ4P36)+k135(λ1P33+λ2P44+λ3P55+λ4P66)
where P63, P54, P45, P36 are four pixels neighboring with p22 on the 45-degree direction of p22 in the pixels P00˜P911 of the original image, P33, P44, P55, P66 are four pixels neighboring with p22 on the 135-degree direction of p22 in the pixels P00˜P911 of the original image.
Likewise, the four pixels neighboring with p22 selected from the pixel array of M*N pixels in the original image are P44, P45, P54, P55; by using the cubic interpolation formula (17), theoretical values on two directions of each pixel are calculated as follows:
P′
44(45)=λ1P62+λ2P53+λ3P35+λ4P26
P′
44(135)=λ1P22+λ2P33+λ3P55+λ4P66
P′
45(45)=λ1P63+λ2P54+λ3P36+λ4P27
P′
45(135)=λ1P23+λ2P34+λ3P56+λ4P67
P′
54(45)=λ1P72+λ2P63+λ3P45+λ4P36
P′
54(135)=λ1P32+λ2P43+λ3P65+λ4P76
P′
55(45)=λ1P63+λ2P64+λ3P46+λ4P37
P′
55(135)=λ1P33+λ2P44+λ3P66+λ4P77
As described in the step S13, errors between the theoretical values and the original value of each of P44, P45, P54, P55 are calculated, and a sum of the errors on each of the 45-degree and 135-degree directions further is determined as follows:
Sum_error45=|P44−P′44(45)|+|P45−P′45(45)|+|P54−P′54(45)|+|P55−P′55(45)|
Sum_error135=|P44−P′44(135)|+|P45−P′45(135)|+|P54−P′54(135)|+|P55−P′55(135)|;
According to the sums of error, the weight coefficients k45, k135 are calculated as follows:
As described in the step S14, the weighted cubic interpolation calculation model corresponding to p22 is selected, and the calculated weight coefficients then are substituted into the selected weighted cubic interpolation calculation model to calculate an estimation value of p22 as follows:
As described above, by calculating P*Q number of DS pixels, a downsampling processed image can be obtained consequently. The obtained downsampling processed image then be displayed.
Please refer to
The weighted cubic interpolation calculation unit 21 is configured (structured and arranged) to select at least four pixels neighboring with the DS pixel on each of at least two directions from the M*N pixels in the original image to obtain at least eight neighboring pixels, and build a weighted cubic interpolation calculation model for calculating the DS pixel in advance according to obtained at least eight neighboring pixels.
In this embodiment, the at least two directions are four directions of 0-degree, 45-degree, 90-degree and 135-degree with respect to the DS pixel. That is, the weighted cubic interpolation calculation unit 21 selects four pixels neighboring with the DS pixel on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree of the DS pixel from the M*N pixels in the original image to obtain sixteen neighboring pixels, and then builds the weighted cubic interpolation calculation model as follows:
p
m
=k
0(λ1A+λ2B+λ3C+λ4D)+k45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where pm is a to-be-calculated DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients; Ph1˜Ph4 are four pixels neighboring with pm on the 45-degree direction of pm in the M*N pixels of the original image; Ph5˜Ph8 are four pixels neighboring with pm on the 135-degree direction of pm in the M*N pixels of the original image; A, B, C, D are four pixels neighboring with pm on the 0-degree direction of pm in the M*N pixels of the original image; E, F, G, H are four pixels neighboring with pm on the 90-degree direction of pm in the M*N pixels of the original image; k0, k45, k90, k135 are weight coefficients, and k0+k45+k90+k135=1. The weighted cubic interpolation calculation unit 21 further can determine corresponding values of A, B, C, D, E, F, G, H according to the cubic interpolation coefficients λ1, λ2, λ3, λ4 and the four pixels neighboring with pm on each of 0-degree, 45-degree, 90-degree and 135-degree directions of pm in the M*N pixels of the original image.
Specifically, the weighted cubic interpolation calculation unit 21 determines the values of A, B, C, D, E, F, G, H according to the following formulas:
W
1=λ1Pn1+λ2Pn2+λ3Pn3+λ4Pn4 (18)
W
2=λ1Pm1+λ2Pm2+λ3Pm3+λ4Pm4 (19)
where, the obtained four pixels on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree of the DS pixel cooperatively constitute a pixel array of 4*4, the formula (18) is used to calculate the values of A, B, C, D; Pn1, Pn2, Pn3, Pn4 are four pixels in each column of the pixel array of 4*4; the formula (19) is used to calculate the values of E, F, G, H; Pm1, Pm2, Pm3, Pm4 are four pixels in each row of the pixel array of 4*4.
In another embodiment, the at least two directions are two directions of 45-degree and 135-degree with respect to the DS pixel. That is, the weighted cubic interpolation calculation unit 21 selects four pixels neighboring with the DS pixel on each of the two directions of 45-degree and 135-degree of the DS pixel from the M*N pixels in the original image to obtain eight neighboring pixels, and then builds the weighted cubic interpolation calculation model:
p
m
=k
45(λ1Ph1+λ2Ph2+λ3Ph3+λ4Ph4)+k135(λ1Ph5+λ2Ph6+λ3Ph7+λ4Ph8);
where pm is the DS pixel, λ1, λ2, λ3, λ4 are cubic interpolation coefficients, Ph1˜Ph4 are four pixels neighboring with pm on the 45-degree direction of pm in the M*N pixels of the original image, Ph5˜Ph8 are four pixels neighboring with pm on the 135-degree direction of pm in the M*N pixels of the original image, k45, k135 are weight coefficients, and k45+k135=1
The pixel theoretical value calculation unit 22 is configured to select at least two pixels neighboring with the DS pixel on each of at least two directions of the DS pixel from the pixel array M*N of the original image to obtain at least four neighboring pixels, and calculate theoretical values of each of the at least four neighboring pixels by using the cubic interpolation formula (17).
The weight coefficient calculation unit 23 is configured to calculate errors between the theoretical values determined by the pixel theoretical value calculation unit 22 and corresponding original values, and further determine weight coefficients for calculating the corresponding DS pixel according the errors.
The DS pixel calculation unit 24 is configured to select a corresponding weighted cubic interpolation calculation model, and calculate the DS pixel according to the determined weight coefficients.
Furthermore, as to the other DS pixels in the target image, the display apparatus 20 uses the above processing method to obtain corresponding estimation values, and thereby a downsampling processed image (target image) is obtained.
The DS pixel being p22 is taken as an example to describe the first embodiment of the present invention below in detail.
The weighted cubic interpolation calculation unit 21 builds a weighted cubic interpolation calculation model for calculating p22 as:
p
22
=k
0(λ1A+λ2B+λ3C+λ4D)+k45(λ1P63+λ2P54+λ3P45+λ4P36)+k90(λ1E+λ2F+λ3G+λ4H)+k135(λ1P33+λ2P44+λ3P55+λ4P66)
where P63, P54, P45, P36 are four pixels neighboring with p22 on the 45-degree direction of p22 in the pixels P00˜P911 of the original image; and P33, P44, P55, P66 are four pixels neighboring with p22 on the 135-degree direction of p22 in the pixels P00˜P911 of the original image.
The weighted cubic interpolation calculation unit 21 further, according to the cubic interpolation coefficients λ1, λ2, λ3, λ4 and the four pixels neighboring with p22 on each of the four directions of 0-degree, 45-degree, 90-degree and 135-degree of p22 in the pixels P00˜P911 of the original image, determines the values of A, B, C, D, E, F, G, H as:
A=λ
1
P
33+λ2P43+λ3P53+λ4P63
B=λ
1
P
34+λ2P44+λ3P54+λ4P64
C=λ
1
P
35+λ2P45+λ3P55+λ4P65
D=λ
1
P
36+λ2P46+λ3P56+λ4P66
E=λ
1
P
33+λ2P34+λ3P35+λ4P36
F=λ
1
P
43+λ2P44+λ3P45+λ4P46
G=λ
1
P
53+λ2P54+λ3P55+λ4P56
H=λ
1
P
63+λ2P64+λ3P65+λ4P66
The pixel theoretical value calculation unit 22 selects the four pixels P44, P45, P54, P55 neighboring with p22 on the four directions from the M*N pixels of the original image, and calculates theoretical values of each pixel on the four directions by using the cubic interpolation formula (17) as:
P′
44(0)=λ1P42+λ2P43+λ3P45+λ4P46
P′
44(45)=λ1P62+λ2P53+λ3P35+λ4P26
P′
44(90)=λ1P24+λ2P34+λ3P54+λ4P64
P′
44(135)=λ1P22+λ2P33+λ3P55+λ4P66
P′
45(0)=λ1P43+λ2P44+λ3P46+λ4P47
P′
45(45)=λ1P63+λ2P54+λ3P36+λ4P27
P′
45(90)=λ1P25+λ2P35+λ3P55+λ4P65
P′
45(135)=λ1P23+λ2P34+λ3P56+λ4P67
P′
54(0)=λ1P52+λ2P53+λ3P55+λ4P56
P′
54(45)=λ1P72+λ2P63+λ3P45+λ4P36
P′
54(90)=λ1P34+λ2P44+λ3P64+λ4P74
P′
54(135)=λ1P32+λ2P43+λ3P65+λ4P76
P′
55(0)=λ1P53+λ2P54+λ3P56+λ4P57
P′
55(45)=λ1P63+λ2P64+λ3P46+λ4P37
P′
55(90)=λ1P35+λ2P45+λ3P65+λ4P75
P′
55(135)=λ1P33+λ2P44+λ3P66+λ4P77
The weight coefficient calculation unit 23 calculates errors between the theoretical values of P44, P45, P54, P55 and original values thereof, and further determines a sum of error on each of the 0-degree, 45-degree, 90-degree and 135-degree as:
Sum_error0=|P44−P′44(0)|+|P45−P′45(0)|+|P54−P′54(0)|+|P55−P′55(0)|
Sum_error45=|P44−P′44(45)|+|P45−P′45(45)|+|P54−P′54(45)|+|P55−P′55(45)|
Sum_error90=|P44−P′44(90)|+P′45−P45(90)|+|P54−P54(90)|+|P55−P55(90)|
Sum_error135=|P44−P′44(135)|+|P45−P′45(135)|+|P54−P′54(135)|+|P55−P′55(135)|;
The weight coefficient calculation unit 23 further calculates the weight coefficients k0, k45, k90, k135 according to the sums of error as that:
The DS pixel calculation unit 24 selects a weighted cubic interpolation calculation model corresponding to p22, and substitutes the calculated weight coefficients into the selected weighted cubic interpolation calculation model to calculate an estimation value of p22 as:
The DS pixel being p22 is taken as an example to describe a second embodiment of the present invention below in detail.
The weighted cubic interpolation calculation unit 21 builds a weighted cubic interpolation calculation model for calculating p22 as:
p
22
=k
45(λ1P63+λ2P54+λ3P45+λ4P36)+k135(λ1P33+λ2P44+λ3P55+λ4P66);
where P63, P54, P45, P36 are four pixels neighboring with p22 on the 45-degree direction of p22 in the pixels P00˜P911 of the original image; and P33, P44, P55, P66 are four pixels neighboring with p22 on the 135-degree direction of p22 in the pixels P00˜P911 of the original image.
Likewise, the pixel theoretical value calculation unit 22 selects four pixels P44, P45, P54, P55 neighboring with p22 on two directions from the M*N pixels of the original image, and calculates theoretical values of each pixel on the two directions by using the cubic interpolation formula (17) as that:
P′
44(45)=λ1P62+λ2P53+λ3P35+λ4P26
P′
44(135)=λ1P22+λ2P33+λ3P55+λ4P66
P′
45(45)=λ1P63+λ2P54+λ3P36+λ4P27
P′
45(135)=λ1P23+λ2P34+λ3P56+λ4P67
P′
54(45)=λ1P72+λ2P63+λ3P45+λ4P36
P′
54(135)=λ1P32+λ2P43+λ3P65+λ4P76
P′
55(45)=λ1P63+λ2P64+λ3P46+λ4P37
P′
55(135)=λ1P33+λ2P44+λ3P66+λ4P77
The weight coefficient calculation unit 23 calculates errors between the theoretical values of P44, P45, P54, P55 and corresponding original values thereof, and further determines a sum of errors on each of the 45-degree and 135-degree directions as:
Sum_error45=|P44−P′44(45)|+|P45−P′45(45)|+|P54−P′54(45)|+|P55−P′55(45)|
Sum_error135=|P44−P′44(135)|+|P45−P′45(135)|+|P54−P′54(135)|+|P55−P′55(135)|;
The weight coefficient calculation unit 23 further calculates the weight coefficients k45, k135 according to the sums of error as that:
The DS pixel calculation unit 24 selects a weighted cubic interpolation calculation model corresponding to p22 and substitutes the calculated weight coefficients into the selected weighted cubic interpolation calculation model to calculate an estimation value of p22 as:
As described above, by calculating P*Q number of DS pixels, a downsampling processed image can be obtained consequently. The obtained downsampling processed image then can be displayed.
In summary, the present invention provides downsampling based display method and display apparatus, by building a weighted cubic interpolation model for a to-be-calculated DS pixel, using the model to calculate theoretical values of original image pixels neighboring with the to-be-calculated DS pixel, then analyzing errors between the theoretical values and corresponding original values to obtain weight coefficients fed back to the weighted cubic interpolation model for calculating the DS pixel. Such DS method of pixel-based calculation can avoid the color aliasing of the subpixel-based DS method, and also can obtain sharp image.
While the invention has been described in terms of what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention needs not be limited to the disclosed embodiment. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims which are to be accorded with the broadest interpretation so as to encompass all such modifications and similar structures.
Number | Date | Country | Kind |
---|---|---|---|
2014104295147 | Aug 2014 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2014/086510 | 9/15/2014 | WO | 00 |