Image sub-pixel interpolation method and device, and computer-readable storage medium
By adopting a new sub-pixel interpolation method in image processing, considering the influence of three known pixels in the forward and reverse directions, and using fast Fourier transform, the problem of insufficient sub-pixel interpolation accuracy in the existing technology is solved and achieved Provides higher precision and more widely applicable image interpolation effects.
Patent Information
- Application Number
- CN202210516225.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The existing image sub-pixel interpolation algorithm is not accurate enough to accurately reflect the details of the photographed object. Especially under the limitations of camera hardware, the position of the landmark point may be in a whole pixel gap, resulting in inaccurate interpolation.
A new image sub-pixel interpolation method is adopted, by defining a plane rectangular coordinate system, calculating the interpolation coefficient and interpolating according to the coordinates of the sub-pixel position to be inserted, taking into account the influence of the three nearest known pixels in the forward and reverse directions, and Fast Fourier transform is used to reduce the amount of calculation and fill in pseudo pixels to process the edge parts of the image.
It improves the accuracy and calculation efficiency of image sub-pixel interpolation, ensures the accuracy and high-order differentiability of image global interpolation, has a wider range of applications, and can more accurately reflect the details of the photographed object.
Smart Images

Figure CN114782253B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing. Background Art
[0002] Digital image processing technology is widely used in many fields, and photogrammetry is one of its application areas. Photogrammetry is a method of measuring the measured parameters by taking an image of the object to be measured and analyzing the image data. Due to the hardware limitations of the camera itself, the image captured is not of infinite pixel density. Therefore, the position of the measured mark point in the image may be in the gap between integer pixels (the original pixels of the image, that is, the pixels captured by the camera) instead of integer pixels. In this case, sub-pixels need to be inserted to make the position of the measured mark point a pixel. Commonly used sub-pixel interpolation algorithms include bilinear interpolation algorithm, cubic function interpolation algorithm, etc., but the accuracy of these algorithms is not high enough. Summary of the invention
[0003] In view of this, the present invention provides an image sub-pixel interpolation method with higher accuracy.
[0004] To achieve the above objectives, the present invention provides the following technical solutions.
[0005] 1. Image sub-pixel interpolation method, a plane rectangular coordinate system is defined in the plane of the image to be processed, the X axis is parallel to one arrangement direction of the integer pixels of the image, the Y axis is parallel to another arrangement direction of the integer pixels of the image, and the spacing between two adjacent integer pixels arranged in the coordinate axis direction is taken as the unit length 1,
[0006] The interpolation algorithm is:
[0007]
[0008]
[0009] represents the position with coordinates (x+Δx, y0), x+Δx represents the position with a distance Δx from the known pixel with X coordinate x, represents the pixel value of the sub-pixel inserted at the position with coordinates (x+Δx, y0), represents the interpolation coefficient of a known pixel with coordinates (x+k,y0), is the weight function β 5 (m(The function value at the position with coordinates (k-Δx,y0);
[0010] represents the position with coordinates (x0, y+Δy), y+Δy represents the position with a distance Δy from the known pixel with Y coordinate y, represents the pixel value of the sub-pixel inserted at the position with coordinates (x0, y+Δy), represents the interpolation coefficient of a known pixel with coordinates (x0, y+k), is the weight function β 5 (m) The function value at the position with coordinates (x0, k-Δx);
[0011] Δx∈(0,1), Δy∈(0,1), k∈[-2,3] and k is an integer; x0, y0 represent the X coordinate and Y coordinate of the known pixel respectively;
[0012] Integer pixels refer to original pixels of the image, sub-pixels refer to pixels inserted later, and known pixels include integer pixels and inserted sub-pixels;
[0013] When the Y coordinate is y0, let m = k-Δx, when the X coordinate is x0, let m = k-Δy, the weight function β 5 (m) is:
[0014]
[0015] Let Δx=0, Δy=0, substitute the coordinate values and pixel values of the known pixels whose interpolation coefficients are unknown into the interpolation algorithm, and calculate the interpolation coefficients of the known pixels whose interpolation coefficients are unknown;
[0016] When the Y coordinate is y0, the X coordinate value of the position of the sub-pixel to be inserted is converted to x+Δx, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm;
[0017] When the X coordinate is x0, the Y coordinate value of the position of the sub-pixel to be inserted is converted to y+Δy, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm.
[0018] The image sub-pixel interpolation method of the present invention first calculates the interpolation coefficient of the known pixel through an interpolation algorithm based on the pixel value and coordinates of the known pixel, and then calculates the pixel value of the sub-pixel to be inserted through an interpolation algorithm based on the coordinates of the position of the sub-pixel to be inserted. The same interpolation algorithm is used to calculate the interpolation coefficient and the pixel value of the sub-pixel, ensuring that within the framework of the interpolation algorithm, the whole pixel and the inserted sub-pixel conform to the same rule. The pixel data of pixels in an image that are close in position may also be close. The image sub-pixel interpolation method of the present invention takes into account the influence of the three nearest known pixels in the positive and negative directions of the interpolation area on the interpolation area. It can be seen from Δx∈(0,1), Δy∈(0,1), k∈[-2,3] and k is an integer that the area between two adjacent known pixels in the X-axis direction or the Y-axis direction is the interpolation area. The pixel value of the sub-pixel to be inserted is obtained by multiplying the interpolation coefficients of the three nearest known pixels in the positive and negative directions by the corresponding weights. The closer the known pixels are, the greater the influence and the greater the weight, which conforms to the general law of pixels in the image. In summary, the sub-pixels inserted by the image sub-pixel interpolation method of the present invention can more accurately reflect the object being photographed and have higher precision. The interpolation algorithm also has high-order differentiability and a wider range of applications.
[0019] 2. Based on technical solution 1, the calculation method of the interpolation coefficient is:
[0020] The convolution calculation along the X-axis is done through a fast Fourier transform, as follows:
[0021]
[0022]
[0023]
[0024] is the Fourier transform, ω x is the frequency domain characteristic along the X-axis direction when y=y0, After Fourier transformation get After Fourier transformation get After Fourier transformation get
[0025] Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get:
[0026]
[0027] Then we get:
[0028]
[0029] Again Doing the inverse Fourier transform gives the interpolation coefficient c(x+
[0030] The convolution calculation along the Y-axis is done through a fast Fourier transform, as follows:
[0031]
[0032]
[0033]
[0034] is the Fourier transform, ω y is the frequency domain characteristic along the Y-axis when x=x0, After Fourier transformation get After Fourier transformation get After Fourier transformation get
[0035] Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get:
[0036]
[0037] Then we get:
[0038]
[0039] Again The interpolation coefficients can be obtained by performing an inverse Fourier transform
[0040] Before calculating the pixel value of the sub-pixel to be inserted, it is necessary to first calculate the interpolation coefficient of the known pixel with unknown interpolation coefficient based on the known pixels and the interpolation algorithm. For each known pixel with unknown interpolation coefficient, the interpolation coefficient of six known pixels including itself is involved. After the interpolation algorithm is used to calculate the formula of all known pixels with unknown interpolation coefficients, the interpolation coefficient of each known pixel with unknown interpolation coefficient can be solved. If the traditional method is used for calculation, taking n pixels in the horizontal direction as an example, n equations will be established in the horizontal direction, and there are n unknown variables c(x,y). Then the expression of the linear equation group A is obtained. n×n X n×1 =B n×1, the amount of calculation required to solve such a large matrix is very huge. In the present invention, according to the convolution characteristics of the interpolation algorithm, the convolution of the matrix can be performed through fast Fourier transform to obtain the frequency domain characteristics, and then the frequency domain is converted to the time domain to obtain the interpolation coefficients after the solution, which can greatly reduce the amount of calculation.
[0041] 3. On the basis of technical solution 1, when the Y coordinate is y0, if there is no known pixel at the position of the X coordinate of x+2, x+3, x-1 or x-2, then fill the above position with a pseudo pixel as a known pixel; when the X coordinate is x0, if there is no known pixel at the position of the Y coordinate of y+2, y+3, y-1 or y-2, then fill the above position with a pseudo pixel as a known pixel; the pseudo pixel refers to a pixel with a preset pixel value. Because the image sub-pixel interpolation method of the present invention needs to consider 3 known pixels on the left and right when calculating the pixel value of a sub-pixel to be inserted, so that the sub-pixel cannot be inserted in the two interpolation areas at the edge of the image. Therefore, if the position where the sub-pixel needs to be inserted is within the two interpolation areas at the edge of the image, fill the corresponding position with pseudo pixels as known pixels for calculating the pixel value of the sub-pixel to be inserted in the interpolation area. In this way, the interpolation calculation and insertion of sub-pixels can be performed in the entire image, avoiding the inability to insert sub-pixels at the edge of the image.
[0042] 4. Based on technical solution 3, the pixel value of the pseudo pixel is the pixel value of the known pixel closest to it.
[0043] 5. A computer-readable storage medium storing a computer program, which, when executed, can implement the image sub-pixel interpolation method described in any one of Technical Solutions 1-4.
[0044] 6. An image sub-pixel interpolation device, comprising a computer-readable storage medium and a processor, wherein the computer-readable storage medium is the computer-readable storage medium described in Technical Solution 5, and the processor can execute a computer program stored therein. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 Schematic diagram of the arrangement of integer pixels in an image.
[0046] Figure 2 The figure is a schematic diagram of the arrangement of the positions of whole pixels, pseudo pixels, and sub-pixels to be inserted in the process of inserting sub-pixels for the first time using the image sub-pixel interpolation method of the present invention.
[0047] Figure 3 The figure is a schematic diagram of the arrangement of the positions of whole pixels, sub-pixels, pseudo-pixels, and sub-pixels to be inserted in the process of inserting sub-pixels for the second time using the image sub-pixel interpolation method of the present invention.
[0048] Figure 4The figure is a schematic diagram of the arrangement of whole pixels and sub-pixels after two sub-pixel insertions are completed using the image sub-pixel interpolation method of the present invention.
[0049] Figure 5 It is a schematic diagram of inserting sub-pixels along the X-axis direction according to the image sub-pixel interpolation method of the present invention.
[0050] Figure 6 It is a schematic diagram of six Y-axis directions of sub-pixel positions to be inserted obtained from the X-axis direction by the image sub-pixel interpolation method of the present invention.
[0051] Figure 7 It is a schematic diagram of inserting sub-pixels along the Y-axis direction according to the image sub-pixel interpolation method of the present invention. DETAILED DESCRIPTION
[0052] The present invention is described in detail below in conjunction with specific embodiments.
[0053] Terminology
[0054] Pixel value: refers to the value assigned by the computer when the image is digitized, such as the R value, G value, and B value in RGB mode.
[0055] Interpolation area: The area between two adjacent known pixels in the X-axis direction or Y-axis direction is the interpolation area, for example Figure 2 Regions a, b, c in Figure 3 The area d in the figure is represented by the line segment.
[0056] Integer pixel: refers to the original pixel of the image.
[0057] Sub-pixel: refers to pixels inserted later.
[0058] Known pixels: pixels whose values are known, including integer pixels and interpolated sub-pixels.
[0059] Pseudo pixel: refers to a pixel with a preset pixel value, which is neither an integer pixel nor a pixel whose pixel value is calculated by an interpolation algorithm.
[0060] Figure 1 The figure shows the arrangement of integer pixels of the image to be processed, which are arranged along two mutually orthogonal directions. A plane rectangular coordinate system is defined in the plane of the image to be processed, the X-axis is parallel to one arrangement direction of the integer pixels of the image, the Y-axis is parallel to another arrangement direction of the integer pixels of the image, and the spacing between two adjacent integer pixels arranged in the direction of the coordinate axis is taken as a unit length of 1. In this embodiment, the position of the integer pixel in the lower left corner of the image is taken as the coordinate origin.
[0061] The interpolation algorithm in the image sub-pixel interpolation method of this embodiment is:
[0062]
[0063]
[0064] In the formula, represents the position with coordinates (x+Δx, y0), x+Δx represents the position with a distance Δx from the known pixel with X coordinate x, represents the pixel value of the sub-pixel inserted at the position with coordinates (x+Δx, y0), represents the interpolation coefficient of a known pixel with coordinates (x+k,y0), is the weight function β 5 (m) The function value at the position with coordinates (k-Δx, y0); represents the position with coordinates (x0, y+Δy), y+Δy represents the position with a distance Δy from the known pixel with Y coordinate y, represents the pixel value of the sub-pixel inserted at the position with coordinates (x0, y+Δy), represents the interpolation coefficient of a known pixel with coordinates (x0, y+k), is the weight function β 5 (m) The function value at the location with coordinates (x0, k-Δx).
[0065] Where Δx∈(0,1), Δy∈(0,1), k∈[-2,3] and k is an integer. x0 and y0 represent the X and Y coordinates of the known pixel, respectively.
[0066] When the Y coordinate is y0, let m = k-Δx, when the X coordinate is x0, let m = k-Δy, the weight function β 5 (m) is:
[0067]
[0068] The weight function is a bell-shaped function, and its function waveform is the same at any position. The farther the known pixel is from the position of the sub-pixel to be inserted, the less influence it has, and the closer the known pixel is to the position of the sub-pixel to be inserted, the greater influence it has. The weight function has nothing to do with x and y, but only with Δx and Δy. That is to say, when inserting sub-pixels at different positions, the influence of the three known pixels in the positive and negative directions on it depends only on Δx or Δy.
[0069] If you want to insert sub-pixels at any position in the image, you need to go through two insertion operations. The first insertion operation is to insert sub-pixels in the X-axis direction and the Y-axis direction of the whole pixel, such as Figure 2 The second insertion operation is to insert sub-pixels in the X-axis direction and Y-axis direction of the inserted sub-pixels, as shown in FIG. Figure 3After these two insertions, sub-pixels can be inserted at any position, such as Figure 4 In this embodiment, for the sake of convenience, two sub-pixels are inserted into each interpolation region as an example. In actual operation, any number of sub-pixels can be inserted into each interpolation region, which can be selected as needed. The second insertion operation is performed as needed.
[0070] In this embodiment, combined with Figure 2 , when inserting sub-pixels for the first time, it is known that the pixel is an integer pixel, x+Δx is an integer, and Δx is Similarly, in y+Δy, y is an integer and Δy is Combination Figure 3 When inserting sub-pixels for the second time, x+Δx is an integer plus or Δx is Similarly, in y+Δy, y is an integer plus or Δy is
[0071] First, the interpolation coefficients of each known pixel are solved. Let Δx=0, Δy=0, substitute the coordinate values and pixel values of the known pixels with unknown interpolation coefficients into the interpolation algorithm, and calculate the interpolation coefficients of each known pixel with unknown interpolation coefficients.
[0072] Then, the pixel value of the sub-pixel to be inserted is calculated, and the calculation is performed along the X-axis direction and the Y-axis direction respectively. Along the X-axis direction, that is, when the Y coordinate is y0, the X coordinate value of the position of the sub-pixel to be inserted is converted to x+Δx, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm. Along the Y-axis direction, that is, when the X coordinate is x0, the Y coordinate value of the position of the sub-pixel to be inserted is converted to y+Δy, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm.
[0073] Each sub-pixel insertion operation includes the above two steps of solving the interpolation coefficient and calculating the sub-pixel pixel value.
[0074] Combination Figure 2 , perform the first sub-pixel insertion operation, first solve the interpolation coefficients of the known pixels whose interpolation coefficients are unknown, at this time the known pixels are all integer pixels, let Δx = 0, Δy = 0, substitute the coordinate values and pixel values of the integer pixels into the interpolation algorithm, calculate the interpolation coefficients of each integer pixel, and then calculate the pixel values of the sub-pixels to be inserted along the X-axis direction and the Y-axis direction respectively. Specifically, along the X-axis direction, that is, the Y coordinate is y0, there are multiple rows of integer pixels arranged along the X-axis direction, the Y coordinate of the first row of integer pixels is 0, at this time y0 = 0, convert the X coordinate value of the sub-pixel position to be inserted into x + Δx, that is (X coordinates of the two sub-pixel positions to be inserted in the third interpolation area from the left); (X coordinates of the two sub-pixel positions to be inserted in the fourth interpolation area from the left)... Substitute the coordinates of the sub-pixel positions to be inserted into the above interpolation algorithm to calculate the pixel values of each sub-pixel position to be inserted, and then y0 is equal to 1, 2, 3... Repeat the above operations respectively. The same approach is taken along the Y-axis direction. After the sub-pixel insertion operation is completed along the X-axis direction and the Y-axis direction, the first sub-pixel insertion operation is completed.
[0075] Combination Figure 3 , perform the second sub-pixel insertion operation, first solve the interpolation coefficients of the known pixels whose interpolation coefficients are unknown. The known pixels at this time include integer pixels and sub-pixels inserted for the first time. Since the interpolation coefficients of the integer pixels have been solved when the sub-pixels are inserted for the first time, there is no need to solve the interpolation coefficients of the integer pixels again. In addition, the interpolation coefficients of the integer pixels will not actually be used in the second sub-pixel insertion process. This time, solve the interpolation coefficients of the sub-pixels inserted for the first time, let Δx=0, Δy=0, substitute the coordinate value and pixel value of the sub-pixel inserted for the first time into the interpolation algorithm, calculate the interpolation coefficients of the sub-pixels inserted for the first time, and then calculate the pixel values of the sub-pixels to be inserted along the X-axis and Y-axis directions respectively. Specifically, along the X-axis direction, that is, the Y coordinate is y0, and the Y coordinate of the sub-pixel inserted for the first time in the first row is at this time Convert the X coordinate value of the sub-pixel position to be inserted into x+Δx, that is (X coordinates of the two sub-pixel positions to be inserted in the third interpolation area from the left); (X coordinates of the two sub-pixel positions to be inserted in the fourth interpolation area from the left)······, substituting the coordinates of these sub-pixel positions to be inserted into the above interpolation algorithm, the pixel values of each sub-pixel position to be inserted can be calculated, and then y0 is equal to ······Repeat the above operations respectively. The same method is used along the Y-axis direction. After the sub-pixel insertion operations are completed along the X-axis direction and the Y-axis direction, the second sub-pixel insertion operation is completed.
[0076] Whether it is the first or second sub-pixel insertion, the two interpolation areas at the edge of the image ( Figure 2 Regions b and c in Figure 3In the area d), there are less than 3 known pixels in the positive or negative direction, that is, when the Y coordinate is y0, there is no known pixel at the position of the X coordinate x+2, x+3, x-1 or x-2; when the X coordinate is x0, there is no known pixel at the position of the Y coordinate y+2, y+3, y-1 or y-2. Therefore, it is impossible to insert sub-pixels in the two interpolation areas at the edge of the image. In order to insert sub-pixels in these areas, when the Y coordinate is y0, if there is no known pixel at the position of the X coordinate x+2, x+3, x-1 or x-2, pseudo pixels are filled in the above positions as known pixels; when the X coordinate is x0, if there is no known pixel at the position of the Y coordinate y+2, y+3, y-1 or y-2, pseudo pixels are filled in the above positions as known pixels. In this way, sub-pixels can be inserted in the two interpolation areas at the edge of the image, that is, interpolation calculations can be performed in the entire image to insert sub-pixels, avoiding the inability to insert sub-pixels at the edge of the image. Filling pseudo pixels is done before calculating the interpolation coefficients, so that the interpolation coefficients of two known pixels at the edge of the image can be calculated.
[0077] In this embodiment, the method for calculating and solving the interpolation coefficient is:
[0078] The convolution calculation along the X-axis is done through a fast Fourier transform, as follows:
[0079]
[0080]
[0081]
[0082] is the Fourier transform, ω x is the frequency domain characteristic along the X-axis direction when y=y0, After Fourier transformation get After Fourier transformation get After Fourier transformation get
[0083] Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get:
[0084]
[0085] Then we get:
[0086]
[0087] Again The interpolation coefficients can be obtained by performing an inverse Fourier transform
[0088] The convolution calculation along the Y-axis is done through a fast Fourier transform, as follows:
[0089]
[0090]
[0091]
[0092] is the Fourier transform, ω y is the frequency domain characteristic along the Y-axis when x=x0, After Fourier transformation get After Fourier transformation get After Fourier transformation get
[0093] Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get:
[0094]
[0095] Then we get:
[0096]
[0097] Again The interpolation coefficients can be obtained by performing an inverse Fourier transform
[0098] According to the convolution characteristics of the interpolation algorithm, the convolution of the matrix can be performed through fast Fourier transform to obtain the frequency domain characteristics, and then the interpolation coefficients are obtained by converting the frequency domain into the time domain after solving it, which can greatly reduce the amount of calculation. The specific instructions are as follows:
[0099] Discretize the continuous equation, let Where m = 0, 1, 2, ..., M-1, then
[0100]
[0101] G m yes Discretize a period of This term has symmetry Periodicity Availability
[0102]
[0103] in
[0104]
[0105]
[0106] In the above formula, we only need to calculate k = 0, 1, 2, ..., M / 2-1, which is the result of the first half of the data. The second half is based on the periodicity. so Same reason By analogy, we can further regard the M / 2 data as odd and even parts, and divide them into two parts in the same way. We only need to calculate the first half of the data, which greatly reduces the amount of calculation.
[0107] The following is a specific calculation, combined with Figure 5-Figure 7 :
[0108] When -3≤m≤-2:
[0109]
[0110] When the sub-pixel offset is generated, that is, -3≤-2+Δm≤-2, Δm represents the sub-pixel offset value.
[0111]
[0112] When -2≤m≤-1:
[0113]
[0114] When -1≤m≤0:
[0115]
[0116] When 0≤m≤1:
[0117]
[0118] When 1≤m≤2:
[0119]
[0120] When 2≤m≤3:
[0121]
[0122] g(x f +Δx,y s )=[c f-2,s c f-1,s c f,s c f+1,s cf+2,s c f+3,s ]MΔP
[0123] in
[0124]
[0125]
[0126] Then g(x f +Δm,y s )=[c f-2,s c f-1,s c f,s c f+1,s c f+2,s c f+3,s ]MΔP
[0127] The subscripts “f” and “s” represent the position of the pixel in the X-axis direction and the Y-axis direction, respectively.
[0128] The sub-pixel offset Δm along the X-axis direction is calculated.
[0129] Move the image one pixel along the Y axis and calculate according to the above process to obtain p1, g(x f +Δx,y s+1 )=[c f-2,s+1 c f-1,s+1 c f,s c f+1,s+1 c f+2,s+1 c f+3,s+1 ]MΔP
[0130] By analogy, we get p -2 、p -1 , p2 and p3, such as Figure 5 and Figure 6 shown.
[0131] g(x f +Δx,y s-2 )=[c f-2,s-2 c f-1,s-2 c f,s-2 c f+1,s-2 c f+2,s-2 c f+3,s-2 ]MΔP
[0132] g(x f +Δx,y s-1 )=[c f-2,s-1 c f-1,s-1 c f,s-1 c f+1,s-1 c f+2,s-1 c f+3,s-1 ]MΔP
[0133] g(x f +Δx,y s+2 )=[c f-2,s+2 c f-1,s+2 c f,s+2 c f+1,s+2 c f+2,s+2 c f+3,s+2 ]MΔP
[0134] g(x f +Δx,y s+3 )=[c f-2,s+3 c f-1,s+3 c f,s+3 c f+1,s+3 c f+2,s+3 c f+3,s+3 ]MΔP
[0135] like Figure 7 Therefore, the same operation is then performed in the Y-axis direction, including: interpolating the algorithm with the calculated point p -2 、p -1 , p0, p1, p2 and p3 are interpolated. First, the coefficients [c] are calculated based on the Fourier transform. f,s Then, we use the interpolation algorithm to get
[0136] g(x f +Δm,y s +Δn)=ΔQ T M T [C] f,s MΔP
[0137] ΔQ=[1 Δn Δn 2 Δn 3 Δn 4 Δn 5 ] T
[0138] Wherein Δn represents the sub-pixel offset value along the y direction, f represents the pixel point position in the x direction, and s represents the pixel point position in the y direction.
[0139]
[0140] So far, we can find any integer pixel position (x f ,y s ), the interpolated pixel value at the offset (Δm, Δn).
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit the scope of protection of the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the essence and scope of the technical solution of the present invention.
Claims
1. Image sub-pixel interpolation method, characterized in that: A rectangular coordinate system is defined in the plane of the image to be processed, wherein the X axis is parallel to one arrangement direction of the integer pixels of the image, the Y axis is parallel to another arrangement direction of the integer pixels of the image, and the spacing between two adjacent integer pixels arranged in the coordinate axis direction is taken as a unit length of 1. The interpolation algorithm is: represents the position with coordinates (x+Δx, y0), x+Δx represents the position with a distance Δx from the known pixel with X coordinate x, represents the pixel value of the sub-pixel inserted at the position with coordinates (x+Δx, y0), represents the interpolation coefficient of a known pixel with coordinates (x+k, y0), is the weight function β 5 (m) the function value at the position with coordinates (k-Δx, y0); represents the position with coordinates (x0, y+Δy), y+Δy represents the position with a distance Δy from the known pixel with Y coordinate y, represents the pixel value of the sub-pixel inserted at the position with coordinates (x0, y+Δy), represents the interpolation coefficient of a known pixel with coordinates (x0, y+k), is the weight function β 5 (m) The function value at the position with coordinates (x0, k-Δx); Δx∈(0,1), Δy∈(0,1), k∈[-2,3] and k is an integer; x0 and y0 represent the X coordinate and Y coordinate of the known pixel respectively; Integer pixels refer to original pixels of the image, sub-pixels refer to pixels inserted later, and known pixels include integer pixels and inserted sub-pixels; When the Y coordinate is y0, let m = k-Δx, when the X coordinate is x0, let m = k-Δy, the weight function β 5 (m) is: Let Δx=0, Δy=0, substitute the coordinate values and pixel values of the known pixels whose interpolation coefficients are unknown into the interpolation algorithm, and calculate the interpolation coefficients of the known pixels whose interpolation coefficients are unknown; When the Y coordinate is y0, the X coordinate value of the position of the sub-pixel to be inserted is converted to x+Δx, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm; When the X coordinate is x0, the Y coordinate value of the position of the sub-pixel to be inserted is converted to y+Δy, and the pixel value of the sub-pixel to be inserted is calculated according to the interpolation algorithm.
2. The image sub-pixel interpolation method according to claim 1, characterized in that: The interpolation coefficients are calculated as follows: The convolution calculation along the X-axis is done through a fast Fourier transform, as follows: is the Fourier transform, ω x is the frequency domain characteristic along the X-axis direction when y=y0, After Fourier transformation get After Fourier transformation get After Fourier transformation get Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get: Then we get: Again The interpolation coefficients can be obtained by performing an inverse Fourier transform The convolution calculation along the Y-axis is done through a fast Fourier transform, as follows: is the Fourier transform, ω y is the frequency domain characteristic along the Y-axis when x=x0, After Fourier transformation get After Fourier transformation get After Fourier transformation get Convert the time domain calculation to the frequency domain calculation and perform Fourier transform to get: Then we get: Again The interpolation coefficients can be obtained by performing an inverse Fourier transform 3. The image sub-pixel interpolation method according to claim 1, characterized in that: When the Y coordinate is y0, if there is no known pixel at the position where the X coordinate is x+2, x+3, x-1 or x-2, a pseudo pixel is filled in the above position as a known pixel; when the X coordinate is x0, if there is no known pixel at the position where the Y coordinate is y+2, y+3, y-1 or y-2, a pseudo pixel is filled in the above position as a known pixel; a pseudo pixel refers to a pixel with a preset pixel value.
4. The image sub-pixel interpolation method according to claim 3, characterized in that: The pixel value of a pseudo pixel is the pixel value of the nearest known pixel.
5. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, it is possible to implement the image sub-pixel interpolation method described in any one of claims 1 to 4.
6. An image sub-pixel interpolation device, comprising a computer-readable storage medium and a processor, characterized in that: The computer-readable storage medium is the computer-readable storage medium according to claim 5, and the processor can execute the computer program stored therein.
