A method for improving image resolution using Bayer image interpolation algorithm
By calculating interpolation weights in the Bayer image interpolation algorithm and optimizing the interpolation process using average gradient and color difference, the problems of high computational complexity and insufficient resolution of existing algorithms are solved, thereby improving image clarity and anti-spoofing color capability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2026-04-03
AI Technical Summary
Existing Bayer image interpolation algorithms suffer from high computational complexity, high hardware resource consumption, severe mosaic effect, and insufficient resolution, especially with high-frequency signals, which are prone to producing moiré patterns and false color phenomena.
By calculating the color difference in the horizontal and vertical directions, the interpolation weights are calculated using the average gradient, color difference, and gradient variance. Combined with Gaussian weights or mean weights, the interpolation process is optimized to improve image resolution.
It effectively reduces computational complexity, mitigates mosaic effects, improves image resolution, restores high-frequency information, and reduces moiré patterns and false color phenomena.
Smart Images

Figure CN116416127B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method for improving image resolution using the Bayer image interpolation algorithm. Background Technology
[0002] The purpose of Bayer image interpolation is to interpolate a Bayer image into a complete color image. The original bilinear interpolation algorithm suffers from problems such as the zipper effect, low sharpness, and severe false color. Therefore, researchers have invented more advanced interpolation algorithms. Currently, the most mainstream Bayer image interpolation algorithms are mainly divided into two categories: chromatic aberration methods and residual methods.
[0003] Color difference method: A basic assumption is that the hue and brightness of an RGB image change slowly within a local area, which can be represented by the constancy of local color difference. Using this constancy, the complete G channel information can be interpolated. Then, based on the complete G channel information and the color difference information, the complete R and B channel information is interpolated to obtain the complete RGB image. The color difference method typically involves six steps:
[0004] Step 1: Use linear interpolation to obtain the horizontal and vertical interpolation results for the R, G, and B channels respectively;
[0005] Step 2: Calculate the horizontal interpolation color difference RG and BG using the interpolation results from the previous step, and simultaneously calculate the vertical interpolation color difference RG and BG.
[0006] Step 3: Calculate the color difference weights in the horizontal and vertical directions;
[0007] Step 4: Calculate the final color difference estimates RG and BG using the color difference weights and weighted averages of the color difference values in both directions;
[0008] Step 5: Superimpose the final color difference estimate onto the R and B channels of the original Bayer image to recover the complete G channel information;
[0009] Step 6: Recover the R and B channel information using the principle of constant color difference.
[0010] Residual method: The residual method has a better overall effect than the color difference method. It assumes that the three channels of the image satisfy linear correlation within a local range, and uses guided upsampling to complete the image interpolation. The basic steps of the residual method are the same as those of the color difference method, the difference being: the first step uses guided upsampling to complete the horizontal and vertical interpolation; the sixth step uses guided upsampling to complete the interpolation of the R and B channels.
[0011] However, the main drawback of the existing technology is:
[0012] 1. High complexity: When calculating the color difference weight in the third step, the two algorithms mentioned above generally need to be performed based on the first two steps. They require a large sliding window to complete the calculation, and the calculation process is relatively complex, which consumes a lot of hardware resources.
[0013] 2. Mosaic effect: When calculating the color difference weight in step 3, the two algorithms mentioned above do not effectively utilize the original Bayer image information, resulting in inaccurate weight calculation in some areas and producing a mosaic effect.
[0014] 3. Insufficient resolution: Neither algorithm has high enough image resolution, and moiré patterns and false color phenomena are easily produced when the signal frequency is high.
[0015] In addition, commonly used technical terms in the prior art include:
[0016] 1. Bayer Image: Most color cameras use photoelectric sensors to acquire image information. A color filter array (CFA) is covered on the sensor surface. The most common CFA format is Bayer format. The raw data acquired by the sensor in Bayer format is called a Bayer image. Figure 1 The image shown is a typical Bayer diagram.
[0017] 2. Bayer image interpolation: The process of restoring a Bayer image to a complete RGB image.
[0018] 3. Resolution: The ability to distinguish details of the photographed object. The higher the resolution, the richer the image details and the higher the clarity.
[0019] 4. Nyquist Frequency: According to the sampling theorem, mixing will occur when the sampling frequency is less than twice the highest frequency of the sampled signal. In practical applications, the sampling frequency is known, and half of the sampling frequency is called the Nyquist frequency.
[0020] 5. Moiré patterns: In Bayer image interpolation, due to the influence of sampling frequency and interpolation algorithm, phenomena such as checkerboard patterns and false colors may appear in high-frequency regions, which are called moiré patterns. Summary of the Invention
[0021] To address the aforementioned issues, the main objective of this application is to improve image resolution by employing the following methods in the Bayer image interpolation algorithm: methods for calculating interpolation weights using average gradients, including methods for calculating average gradients in four directions and corresponding weights; methods for calculating interpolation weights using average color difference, including methods for calculating average color difference in four directions and corresponding weights; and methods for calculating comprehensive weights using variance.
[0022] Specifically, the present invention provides a method for improving image resolution using the Bayer image interpolation algorithm, the method comprising:
[0023] S1. Calculate the color difference in the horizontal direction and the color difference in the vertical direction;
[0024] S2. Calculate the interpolation weights:
[0025] S2.1, Calculate the average gradient
[0026] Based on the Bayer image, the formulas for calculating the average gradient in the four directions are:
[0027]
[0028]
[0029]
[0030]
[0031] In the formula, p ij D represents the pixel value at coordinates (i,j). top D down D left D right These represent the average pixel gradients in the four directions: up, down, left, and right.
[0032] S2.2, Calculate the average color difference
[0033] If the horizontal color difference window in step S1 is 9*9, then the average color difference in the left and right directions is calculated.
[0034] d ij This represents the color difference value at position (i,j); the average color difference in the left and right directions is:
[0035]
[0036]
[0037] Where, Δ left Δ right These represent the average color difference in the left and right directions, respectively.
[0038] The same method is used to process the color difference diagram in the vertical direction to obtain the average color difference Δ in the vertical direction. top Δ down ;
[0039] S2.3, Calculate the gradient variance
[0040] The gradient variance in four directions reflects the degree of directionality; the larger the variance, the stronger the directionality. The gradient variance in four directions is calculated as follows:
[0041]
[0042] Where σ 2 This represents the gradient variance in four directions.
[0043] S2.4, Calculate interpolation weights using gradients:
[0044] The weights are calculated using the gradient in S2.1 as follows:
[0045]
[0046]
[0047]
[0048]
[0049] in, These represent the weight values for the four directions (up, down, left, and right) calculated using gradient descent, ω. D Normalization factor:
[0050] ω D =3[(D top ) 2 +(D down ) 2 +(D left ) 2 +(D right ) 2 ]
[0051] S2.5, Calculate interpolation weights using color difference:
[0052] The interpolation weights are calculated using the average color difference from S2.2, and the calculation method is similar to that in S2.4. Therefore, only the formulas for calculating the weights above are listed:
[0053]
[0054] in, This represents the upper weight value calculated using color difference, ω. Δ Normalization factor:
[0055] ω Δ =3[(Δ top ) 2 +(Δ down ) 2 +(Δ loft )2 +(Δ right ) 2 ]
[0056] This method is used to calculate the interpolation weights in the four directions: up, down, left, and right.
[0057] S2.6, Calculate the overall weight:
[0058] When the signal frequency is close to the Nyquist frequency, it is impossible to calculate the accurate gradient weights. In this case, color difference weights are needed for correction. The final weight calculation scheme is as follows:
[0059]
[0060]
[0061]
[0062]
[0063] Where, ω top ω down ω left ω right These represent the interpolation weights for the four directions obtained in the final calculation. This represents the variance threshold, used to distinguish between effective and ineffective gradient weights.
[0064] S3. Calculate the interpolation results: The final interpolation process is completed using the ordinary color difference method.
[0065] Step S1, calculating the horizontal and vertical color differences, further includes:
[0066] S1.1, Calculate linear interpolation: Calculate the linear interpolation results in the horizontal and vertical directions;
[0067] S1.2, Calculate the horizontal and vertical color differences: Subtract G from the effective position of R after linear interpolation, and subtract B from G to obtain the color difference image RG and color difference image BG.
[0068] Step S1 further includes:
[0069] S1.1, linear interpolation:
[0070] For pixels R or B in the Bayer image, the linear interpolation results in the horizontal and vertical directions are calculated using the following formulas:
[0071]
[0072]
[0073] in, G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the linear interpolation results of the G channel in the horizontal and vertical directions, respectively; G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the actual G channel pixel values at the corresponding positions, respectively.
[0074] At pixel G of the Bayer image, the calculation formula is similar to the one above, but for each pixel position, only the interpolation result in one of the horizontal or vertical directions can be calculated:
[0075] If the left and right adjacent positions of pixel G are pixels R, then:
[0076]
[0077] Conversely, if pixel G is adjacent to pixel B on either side, then:
[0078]
[0079] S1.2, calculate the color difference in the horizontal direction and the color difference in the vertical direction:
[0080] Subtracting R from G and B from G at the effective positions after linear interpolation yields the color difference image RG and the color difference image BG.
[0081] The color difference at pixel R is:
[0082]
[0083]
[0084] The color difference at pixel B is:
[0085]
[0086]
[0087] If the left and right adjacent positions of pixel G are pixels R, then the color difference at pixel G is:
[0088]
[0089]
[0090] If pixel G is adjacent to pixel B on either side, then the color difference at pixel G is:
[0091]
[0092]
[0093] in, These represent the color difference values between G and R in the horizontal direction, the color difference values between G and R in the vertical direction, the color difference values between G and B in the horizontal direction, and the color difference values between G and B in the vertical direction, respectively.
[0094] The horizontal color difference map is constructed by arranging all the horizontal color difference values together according to their pixel positions. The vertical color difference map is constructed by arranging all the vertical color difference values together according to their pixel positions.
[0095] Step S3 further includes:
[0096] S3.1, Estimate the final color difference value:
[0097]
[0098] in, This represents the estimated color difference between R and G at position (i,j); Represents the vertical and horizontal chromatic aberration images RG obtained in step S1; W top W down W left W right Let f represent the weighted images in each of the up, down, left, and right directions; let f represent the chromatic aberration smoothing weight vector in each direction. T Let f be the transpose vector;
[0099] The same method can be used to obtain the color difference estimates for B and G.
[0100]
[0101] in, This represents the estimated color difference between B and G at position (i,j); and Let BG represent the vertical chromatic aberration image and the horizontal chromatic aberration image obtained in step S1, respectively.
[0102] S3.2, complete the interpolation of the G channel:
[0103] For the R position in the Bayer image, the G channel is interpolated using the following formula:
[0104]
[0105] For the R position in the Bayer image, the G channel is interpolated using the following formula:
[0106]
[0107] S3.3, complete the interpolation of the R and B channels:
[0108] For the R position in the Bayer image, the B channel interpolation is performed using the following formula:
[0109]
[0110] For position B in the Bayer image, the R channel is interpolated using the following formula:
[0111]
[0112] For position G in the Bayer image, interpolation of the R and B channels is performed using the following formula:
[0113]
[0114]
[0115] In step S3.1, f is selected as Gaussian weight or mean weight.
[0116] The f = [1,1,1] / 3.
[0117] Therefore, after studying the existing technology, a method for improving image resolution using the Bayer image interpolation algorithm is proposed. This application has the following advantages:
[0118] 1. It effectively reduces complexity by directly calculating interpolation weights on the Bayer image, eliminating the need for a large window to complete the interpolation task, and making it easy to implement in hardware;
[0119] 2. It effectively reduces the mosaic effect, makes full use of effective information, and the interpolation results are more accurate;
[0120] 3. Improves image resolution, recovers high-frequency information to a greater extent, increases image clarity, and effectively reduces moiré patterns and false color phenomena. Attached Figure Description
[0121] The accompanying drawings, which are provided to further illustrate the invention and form part of this application, are not intended to limit the scope of the invention.
[0122] Figure 1 This is a common Bayer image diagram in existing technology.
[0123] Figure 2 This is a schematic diagram illustrating the steps for calculating the color difference in the horizontal and vertical directions in this invention.
[0124] Figure 3 This is a schematic diagram of the Bayer image used to calculate the average gradient in an embodiment of the present invention.
[0125] Figure 4 This is a schematic diagram of color difference calculation for the average color difference in an embodiment of the present invention.
[0126] Figure 5 This is a flowchart of the method of the present invention. Detailed Implementation
[0127] To better understand the technical content and advantages of the present invention, the present invention will now be described in further detail with reference to the accompanying drawings.
[0128] like Figure 5 As shown, this application relates to a method for improving image resolution using the Bayer image interpolation algorithm, the method comprising:
[0129] S1. Calculate the color difference in the horizontal direction and the color difference in the vertical direction;
[0130] S2. Calculate the interpolation weights:
[0131] S2.1 Calculate the average gradient in the four directions;
[0132] Based on the Bayer image, the formula for calculating the average gradient in the four directions is:
[0133]
[0134]
[0135]
[0136]
[0137] In the formula, p ij D represents the pixel value at coordinates (i,j). top D down D left D right These represent the average pixel gradients in the four directions: up, down, left, and right.
[0138] S2.2, Calculate the average color difference
[0139] Taking the horizontal color difference window in step S1 as 9*9, the average color difference in the left and right directions is calculated; where the dark gray block represents the horizontal color difference RG, the light gray block represents the horizontal color difference BG, and d ij This represents the color difference value at position (i,j); the average color difference in the left and right directions is:
[0140]
[0141]
[0142] Where, Δ left Δ right These represent the average color difference in the left and right directions, respectively.
[0143] Using the same method to process the color difference image in the vertical direction, the average color difference Δ in the vertical direction can be obtained. top Δ down ;
[0144] S2.3, Calculate the gradient variance;
[0145] The gradient variance in four directions reflects the degree of directionality; the larger the variance, the stronger the directionality. The gradient variance in four directions is calculated as follows:
[0146]
[0147] Where σ 2 This represents the gradient variance in four directions.
[0148] S2.4, calculate the interpolation weights using the gradient;
[0149] The weights are calculated using the gradient in S2.1 as follows:
[0150]
[0151]
[0152]
[0153]
[0154] in, These represent the weight values for the four directions (up, down, left, and right) calculated using gradient descent, ω. D Normalization factor:
[0155] ω D =3[(D top ) 2 +(D down ) 2 +(D left ) 2 +(D right ) 2 ]
[0156] S2.5, Calculate interpolation weights using color difference:
[0157] The interpolation weights are calculated using the average color difference from S2.2, and the calculation method is similar to that in S2.4. Therefore, only the formulas for calculating the weights above are listed:
[0158]
[0159] in, This represents the upper weight value calculated using color difference, ω. Δ Normalization factor:
[0160] ω Δ =3[(Δ top ) 2 +(Δ down 2 +(Δ left ) 2 +(Δ right ) 2 ]
[0161] This method is used to calculate the interpolation weights in the four directions: up, down, left, and right.
[0162] S2.6, Calculate the overall weight:
[0163] When the signal frequency is close to the Nyquist frequency, it is impossible to calculate the accurate gradient weights. In this case, color difference weights are needed for correction. The final weight calculation scheme is as follows:
[0164]
[0165]
[0166]
[0167]
[0168] Where, ω top ω down ω left ω right These represent the interpolation weights for the four directions obtained in the final calculation. This represents the variance threshold, used to distinguish between effective and ineffective gradient weights.
[0169] S3. Calculate the interpolation results: The final interpolation process is completed using the ordinary color difference method.
[0170] Specifically, the method of this invention can also be described as the following steps:
[0171] S1. Calculate the color difference in the horizontal direction and the color difference in the vertical direction;
[0172] (1) Linear interpolation. Calculate the linear interpolation results in the horizontal and vertical directions.
[0173] (2) Calculate the horizontal and vertical color differences. Subtract G from R and B from G at the effective positions after linear interpolation to obtain the color difference images (RG) and (BG).
[0174] Taking the horizontal direction as an example, the diagram of this step is as follows: Figure 2 As shown, the leftmost column represents the original Bayer image, the middle column represents the image after linear interpolation in the horizontal direction, and the rightmost column represents the chromatic aberration image in the horizontal direction.
[0175] Step S1, calculating the horizontal and vertical color differences, further includes:
[0176] S1.1, Calculate linear interpolation: Calculate the linear interpolation results in the horizontal and vertical directions;
[0177] S1.2, Calculate the horizontal and vertical color differences: Subtract G from the effective position of R after linear interpolation, and subtract B from G to obtain the color difference image RG and color difference image BG.
[0178] S1.1, linear interpolation:
[0179] For pixels R or B in the Bayer image, the linear interpolation results in the horizontal and vertical directions are calculated using the following formulas:
[0180]
[0181]
[0182] in, G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the linear interpolation results of the G channel in the horizontal and vertical directions, respectively; G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the actual G channel pixel values at the corresponding positions, respectively.
[0183] At pixel G in the Bayer image, the calculation formula is similar to the one above. If the left and right adjacent positions of pixel G are pixels R, then:
[0184]
[0185] Conversely, if pixel G is adjacent to pixel B on either side, then:
[0186]
[0187] S1.2, calculate the color difference in the horizontal direction and the color difference in the vertical direction:
[0188] Subtracting R from G and B from G at the effective positions after linear interpolation yields the color difference images (RG) and (BG).
[0189] The color difference at pixel R is:
[0190]
[0191]
[0192] The color difference at pixel B is similar to that at pixel R, and is as follows:
[0193]
[0194]
[0195] If the left and right adjacent positions of pixel G are pixels R, then the color difference at pixel G is:
[0196]
[0197]
[0198] If pixel G is adjacent to pixel B on either side, then the color difference at pixel G is:
[0199]
[0200]
[0201] in, These represent the color difference values between G and R in the horizontal direction, the color difference values between G and R in the vertical direction, the color difference values between G and B in the horizontal direction, and the color difference values between G and B in the vertical direction, respectively.
[0202] The horizontal color difference map is constructed by arranging all the horizontal color difference values together according to their pixel positions. The vertical color difference map is constructed by arranging all the vertical color difference values together according to their pixel positions.
[0203] S2. Calculate the interpolation weights;
[0204] (1) Calculate the average gradient;
[0205] Assuming a schematic diagram of the Bayer image is as follows: Figure 3 As shown, the formula for calculating the average gradient in the four directions is:
[0206]
[0207]
[0208]
[0209]
[0210] In the formula and diagram, p ij D represents the pixel value at coordinates (i,j). top D down D left D right These represent the average pixel gradients in the four directions: up, down, left, and right.
[0211] (2) Calculate the average color difference;
[0212] By setting the horizontal color difference window in step 1 to 9x9, the average color difference in both the left and right directions can be calculated. (Color difference illustration follows.) Figure 4 As shown, the darker color blocks represent the horizontal color difference RG, and the lighter color blocks represent the horizontal color difference BG. ij This represents the color difference value at position (i,j). The average color difference in the left-right direction is:
[0213]
[0214]
[0215] Where, Δ left Δ right These represent the average color difference in the left and right directions, respectively. Using the same method to process the color difference diagram in the vertical direction, we can obtain the average color difference Δ in the up and down direction. top Δ down .
[0216] (3) Calculate the gradient variance;
[0217] The gradient variance in four directions reflects the degree of directionality; the larger the variance, the stronger the directionality. The method for calculating the gradient variance in four directions is as follows:
[0218]
[0219] Where σ 2 This represents the gradient variance in four directions.
[0220] (4) Calculate the interpolation weights using gradients;
[0221] The weights are calculated using the gradient in (1) as follows:
[0222]
[0223]
[0224]
[0225]
[0226] in, These represent the weight values for the four directions (up, down, left, and right) calculated using gradient descent, ω. D Normalization factor:
[0227] ω D =3[(D top ) 2 +(D down ) 2 +(D left ) 2 +(D right ) 2 ]
[0228] (5) Calculate the interpolation weights using color difference;
[0229] The interpolation weights are calculated using the average color difference from (2), and the calculation method is similar to that in (4). Here, only the formulas for calculating the weights above are listed:
[0230]
[0231] in, This represents the upper weight value calculated using color difference, ω. Δ Normalization factor:
[0232] ω Δ =3[(Δ top ) 2 +(Δ down ) 2 +(Δ left ) 2 +(Δ γight ) 2 ]
[0233] This method is used to calculate the interpolation weights in the four directions: up, down, left, and right.
[0234] (6) Calculate the overall weight;
[0235] When the signal frequency is close to the Nyquist frequency, accurate gradient weights cannot be calculated, and chromatic aberration weights are needed for correction. The final weight calculation scheme is as follows:
[0236]
[0237]
[0238]
[0239]
[0240] Where, ω top ωdown ω left ω right These represent the interpolation weights for the four directions obtained in the final calculation. This represents the variance threshold, used to distinguish between effective and ineffective gradient weights.
[0241] S3. Calculate the interpolation results;
[0242] The final interpolation process can be completed using the ordinary color difference method.
[0243] (1) Estimate the final color difference value;
[0244]
[0245] in, This represents the estimated color difference between R and G at position (i,j); This represents the vertical chromatic aberration image and the horizontal chromatic aberration image (RG) obtained in step 1; W top W down W left W right Let f represent the weighted images in each of the up, down, left, and right directions; let f represent the chromatic aberration smoothing weight vector in each direction. T Let f be the transpose of f. f can be weighted by Gaussian or mean weights, such as f = [1, 1, 1] / 3.
[0246] The same method can be used to obtain the estimated color difference values between B and G.
[0247] (2) Complete the interpolation of the G channel;
[0248] For the R position in the Bayer image, the G channel is interpolated using the following formula:
[0249]
[0250] For the R position in the Bayer image, the G channel is interpolated using the following formula:
[0251]
[0252] (3) Complete the interpolation of the R and B channels;
[0253] For the R position in the Bayer image, the B channel interpolation is performed using the following formula:
[0254]
[0255] For position B in the Bayer image, the R channel is interpolated using the following formula:
[0256]
[0257] For position G in the Bayer image, interpolation of the R and B channels is performed using the following formula:
[0258]
[0259]
[0260] In summary, the Bayer image interpolation algorithm disclosed in this application, particularly the method for calculating the interpolation weights in step S2, includes the following technical features, which effectively improve image resolution:
[0261] (1) The method of calculating interpolation weights using average gradients, including the calculation methods of average gradients in four directions and the corresponding weights.
[0262] (2) The method of calculating interpolation weights using average color difference, including the calculation method of average color difference in four directions and the calculation method of corresponding weights;
[0263] (3) The method of calculating the comprehensive weight using variance.
[0264] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, various modifications and variations can be made to the embodiments of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for improving image resolution using Bayer image interpolation algorithm, characterized in that, The method includes: S1. Calculate the color difference in the horizontal direction and the color difference in the vertical direction; S2. Calculate the interpolation weights: S2.1, Calculate the average gradient; Based on the Bayer image, the formulas for calculating the average gradient in the four directions are: In the formula, p ij D represents the pixel value at coordinates (i,j). top D down D left D right These represent the average pixel gradients in the four directions: up, down, left, and right. S2.2, Calculate the average color difference; Taking the horizontal color difference window in step S1 as 9*9, the average color difference in the left and right directions is calculated; d ij This represents the color difference value at position (i,j); the average color difference in the left and right directions is: Where, Δ left Δ right These represent the average color difference in the left and right directions, respectively. The same method is used to process the color difference diagram in the vertical direction to obtain the average color difference Δ in the vertical direction. top Δ down ; S2.3, Calculate the gradient variance; The gradient variance in four directions reflects the degree of directionality; the larger the variance, the stronger the directionality. The gradient variance in four directions is calculated as follows: Where σ 2 This represents the gradient variance in four directions. S2.4, Calculate interpolation weights using gradients: The weights are calculated using the gradient in S2.1 as follows: in, These represent the weight values for the four directions (up, down, left, and right) calculated using gradient descent, ω. D Normalization factor: ω D =3[(D top ) 2 +(D down ) 2 +(D left ) 2 +(D right ) 2 ] S2.5, Calculate interpolation weights using color difference: The interpolation weights are calculated using the average color difference from S2.2, and the calculation method is similar to that in S2.
4. Therefore, only the formulas for calculating the weights above are listed: in, This represents the upper weight value calculated using color difference, ω. Δ Normalization factor: oh Δ =3[(D top ) 2 +(D down ) 2 +(D left ) 2 +(D right ) 2 ] This method is used to calculate the interpolation weights in the four directions: up, down, left, and right. S2.6, Calculate the overall weight: When the signal frequency is close to the Nyquist frequency, it is impossible to calculate the accurate gradient weights. In this case, color difference weights are needed for correction. The final weight calculation scheme is as follows: Where, ω top ω down ω left ω right These represent the interpolation weights for the four directions obtained in the final calculation. This represents the variance threshold, used to distinguish between effective and ineffective gradient weights. S3. Calculate the interpolation results: The final interpolation process is completed using the ordinary color difference method.
2. The method for improving image resolution using Bayer image interpolation algorithm according to claim 1, characterized in that, Step S1, calculating the horizontal and vertical color differences, further includes: S1.1, Calculate linear interpolation: Calculate the linear interpolation results in the horizontal and vertical directions; S1.2, Calculate the horizontal and vertical color differences: Subtract G from the effective position of R after linear interpolation, and subtract B from G to obtain the color difference image RG and color difference image BG.
3. The method for improving image resolution using Bayer image interpolation algorithm according to claim 2, characterized in that, Step S1 further includes: S1.1, linear interpolation: For pixels R or B in the Bayer image, the linear interpolation results in the horizontal and vertical directions are calculated using the following formulas: in, G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the linear interpolation results of the G channel in the horizontal and vertical directions, respectively; G(i,j-1), G(i,j+1), G(i-1,j), and G(i+1,j) represent the actual G channel pixel values at the corresponding positions, respectively. At pixel G of the Bayer image, the calculation formula is similar to the one above, but for each pixel position, only the interpolation result in one of the horizontal or vertical directions can be calculated: If the left and right adjacent positions of pixel G are pixels R, then: Conversely, if pixel G is adjacent to pixel B on either side, then: S1.2, calculate the color difference in the horizontal direction and the color difference in the vertical direction: Subtracting R from G and B from G at the effective positions after linear interpolation yields the color difference image RG and the color difference image BG. The color difference at pixel R is: The color difference at pixel B is: If the left and right adjacent positions of pixel G are pixels R, then the color difference at pixel G is: If pixel G is adjacent to pixel B on either side, then the color difference at pixel G is: in, These represent the color difference values between G and R in the horizontal direction, the color difference values between G and R in the vertical direction, the color difference values between G and B in the horizontal direction, and the color difference values between G and B in the vertical direction, respectively. The horizontal color difference map is constructed by arranging all the horizontal color difference values together according to their pixel positions. The vertical color difference map is constructed by arranging all the vertical color difference values together according to their pixel positions.
4. A method for improving image resolution using Bayer image interpolation algorithm according to claim 3, characterized in that, Step S3 further includes: S3.1, Estimate the final color difference value: in, This represents the estimated color difference between R and G at position (i,j); This represents the vertical chromatic aberration image and the horizontal chromatic aberration image RG obtained in step S1; W top W down W left W right Let f represent the weighted images in each of the up, down, left, and right directions; let f represent the chromatic aberration smoothing weight vector in each direction. T Let f be the transpose vector; The same method can be used to obtain the color difference estimates for B and G. in, This represents the estimated color difference between B and G at position (i,j); and Let BG represent the vertical chromatic aberration image and the horizontal chromatic aberration image obtained in step S1, respectively. S3.2, complete the interpolation of the G channel: For the R position in the Bayer image, the G channel is interpolated using the following formula: For the R position in the Bayer image, the G channel is interpolated using the following formula: S3.3, complete the interpolation of the R and B channels: For the R position in the Bayer image, the B channel interpolation is performed using the following formula: For position B in the Bayer image, the R channel is interpolated using the following formula: For position G in the Bayer image, interpolation of the R and B channels is performed using the following formula:
5. A method for improving image resolution using Bayer image interpolation algorithm according to claim 4, characterized in that, In step S3.1, f is selected as Gaussian weight or mean weight.
6. A method for improving image resolution using Bayer image interpolation algorithm according to claim 5, characterized in that, The f = [1,1,1] / 3.
Citation Information
Patent Citations
Novel edge adaptive color filter array (CFA) color image interpolation method
CN102170572A
Demosaicing method and device
CN110730336A