Color interpolation method suitable for industrial vision

By using a gradient-based dynamic weight allocation and Retinex enhancement method, color distortion and the zipper effect in industrial vision color interpolation are solved, improving image quality and reducing hardware costs.

CN121981884APending Publication Date: 2026-05-05YUANTU ARTIFICIAL INTELLIGENCE (HANGZHOU) CO LTD
View PDF 11 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YUANTU ARTIFICIAL INTELLIGENCE (HANGZHOU) CO LTD
Filing Date
2026-04-08
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing industrial vision color interpolation methods suffer from color distortion and zipper effect, and traditional methods may lead to false color or high hardware costs.

Method used

The G-channel image is reconstructed using gradient-based dynamic weight allocation, and the R and B-channel images are corrected by residual interpolation guided by the gradient of the G-channel, followed by Retinex enhancement processing.

Benefits of technology

It reduces false color and zipper effect, improves image quality, and lowers hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121981884A_ABST
    Figure CN121981884A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of color interpolation, and belongs to a color interpolation method suitable for industrial vision, and the method comprises the steps: S1, obtaining a to-be-processed Bayer image; s2, reconstructing a G channel image based on gradient dynamic distribution weight; s3, rebuilding an R channel image and a B channel image based on G channel gradient guide direction and residual interpolation correction; s4, Retinex enhancement is carried out on the reconstructed RGB image; and S5, outputting the enhanced RGB image. According to the method, a G channel image is reconstructed based on gradient dynamic distribution weight, then R channel and B channel images are reconstructed based on G channel gradient guide direction and residual interpolation correction, pseudo-color and zipper effects are reduced, Retinex enhancement is carried out on the reconstructed RGB image, an enhanced Retinex image is obtained, and the image quality is improved. The atomization of the interpolated image is reduced; and the quality of the image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of color interpolation technology, and pertains to a color interpolation method suitable for industrial vision. Background Technology

[0002] Equipping each pixel of a camera image sensor with a three-channel RGB acquisition structure would significantly increase hardware cost and complexity. Bayer arrays address this issue by covering sensor pixels with a specific arrangement of RGB filters, commonly a 2×2 RGGB arrangement, where the green filter accounts for 50%, and red and blue each account for 25%, because the human eye is most sensitive to green. However, with this design, each pixel can only capture light information of one color. To obtain a normal color image, the Bayer algorithm must be used to fill in the missing data for the other two color channels.

[0003] However, traditional color interpolation is prone to color distortion and the "zipper effect." For example, patent CN101197916A (Gradient-based Edge Enhancement Color Interpolation Method) uses a gradient threshold to perform a gradient-based color interpolation method, but if the gradient threshold is not properly controlled, it may produce false colors. CN116847211B (An Interpolation Method for a Color Filter Array) interpolates the color filter array at the top of the tower, which can obtain high-quality images, but it is a traditional and simple color interpolation algorithm, and its hardware cost is relatively high. CN104159091B (An Edge Detection-based Color Interpolation Method) detects edges based on edge detection to determine the edge and texture parts for interpolation, and performs color difference estimation and gradient weighting according to the color difference law, but the inherent "zipper effect" cannot be significantly improved. Summary of the Invention

[0004] To address the aforementioned technical problems, this invention provides a color interpolation method suitable for industrial vision.

[0005] To achieve the above objectives, the present invention provides the following technical solution: This invention provides a color interpolation method suitable for industrial vision, comprising the following steps: S1: Obtain the Bayer image to be processed; S2: Reconstructing the G-channel image based on gradient dynamic weight allocation; S3: Reconstruct the R and B channel images based on the gradient-guided direction of the G channel and residual interpolation correction; S4: Perform Retinex enhancement on the reconstructed RGB image; S5: Outputs an enhanced RGB image.

[0006] Preferably, in step S2, the specific steps for reconstructing the G-channel image based on gradient dynamic weight allocation are as follows: S21: Calculate the gradient of the multi-faceted approach; S22: Calculate the mean of the neighborhood G components in multiple directions; S23: Select all known G and R pixel pairs within a 5×5 window, calculate the color difference to obtain neighborhood color difference samples; S24: Perform 3×3 window mean smoothing on the color difference samples in S23 to obtain the local average color difference; S25: Combine the R value of the current pixel with the average color difference obtained in S24 to calculate the preliminary G estimate values ​​in each direction, and perform anti-color shift processing; S26: Dynamically allocate weights in the four directions using gradient inverse weighting, and then normalize the weights; S27: Finally, based on the recalculation obtained from weight S26, the interpolation result of the G channel is calculated, and the G channel image reconstruction is completed.

[0007] Preferably, the specific steps for image reconstruction of the R channel and B channel in step S3 are as follows: S31: Calculate the horizontal and vertical gradients of channel G within a 3×3 window; S32: Compare the magnitudes of the horizontal and vertical gradients obtained in S31, determine the edge direction of the G channel, and determine the interpolation direction of the R / B channels; S33: Based on the guiding direction determined in S32, interpolation is performed using the known R / B pixels within a 3×3 window, and the interpolated value is a preliminary estimate. S34: Define the local linear fit coefficients and perform bilinear interpolation on the residuals within a 3×3 window to obtain the residual estimate at the position to be interpolated; S35: The final R / B channel result is obtained based on the local linear fitting coefficients.

[0008] Preferably, the specific judgment logic in step S32 is as follows: If the horizontal gradient is less than the vertical gradient: then the edge of the G channel is in the vertical direction, the horizontal direction is smooth, and the R / B channels are interpolated along the horizontal direction; If the vertical gradient is less than or equal to the horizontal gradient, then the edge of the G channel is horizontal, the vertical direction is smooth, and the R / B channels are interpolated along the vertical direction.

[0009] Preferably, the Retinex enhancement steps in step S4 are as follows: S41: Perform a log transformation on the reconstructed RGB image to obtain the log-transformed image; S42: Apply Gaussian blur to the image after log transformation to obtain the Gaussian blurred image; S43: Subtract the image after log transformation from the image after Gaussian blur to obtain the image after removing the illumination; S44: Perform an inverse log transform on the image after illumination removal to obtain the Retinex-enhanced image.

[0010] Compared with existing technologies, the present invention provides a color interpolation method suitable for industrial vision, which has the following beneficial effects: This invention reconstructs the G-channel image based on gradient dynamic weight allocation, and then reconstructs the R-channel and B-channel images by adding residual interpolation correction based on the gradient guidance direction of the G-channel, reducing false color and zipper effect. Then, the reconstructed RGB image is enhanced by Retinex to obtain the enhanced Retinex image, which reduces the fogging of the interpolated image and improves the image quality.

[0011] The features and advantages of the present invention will be described in detail through embodiments and in conjunction with the accompanying drawings. Attached Figure Description

[0012] Figure 1 This is a logic diagram of a color interpolation method applicable to industrial vision according to the present invention; Figure 2 This is the image before processing; Figure 3 The image is a result of processing according to the method of the present invention. Detailed Implementation

[0013] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. However, it should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of the invention. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concept of the invention.

[0014] See Figure 1 A color interpolation method suitable for industrial vision includes the following steps: S1: Obtain the Bayer image to be processed; S2: Reconstructing the G-channel image based on gradient dynamic weight allocation S3: Reconstruct the R and B channel images based on the gradient-guided direction of the G channel and residual interpolation correction; S4: Perform Retinex enhancement on the reconstructed RGB image; S5: Outputs an enhanced RGB image.

[0015] Specifically, in step S2, the steps for reconstructing the G-channel image based on gradient dynamic weight allocation are as follows: S21: Calculate the gradient of the multi-faceted approach; Where the center coordinates are denoted as (x, y), the formulas for calculating the gradient directions at horizontal, vertical, 135°, and 45° are as follows: S22: Calculate the mean of the neighborhood G components in multiple directions; Where the center coordinates are denoted as (x, y), the formula for calculating the mean of the G component is: S23: Select all known G and R pixel pairs within a 5×5 window, calculate the color difference to obtain neighborhood color difference samples; The formula for calculating color difference is: S24: Perform 3×3 window mean smoothing on the color difference samples in S23 to obtain the local average color difference; S25: Combine the R value of the current pixel with the average color difference obtained in S24 to calculate the preliminary G estimate values ​​in each direction, and perform anti-color shift processing; The calculation formula is: S26: Dynamically allocate weights in the four directions using gradient inverse weighting, and then normalize the weights; The formula for calculating the weight is: The normalization calculation formula is: S27: Finally, based on the recalculation of the G channel obtained from weight S26, the interpolation result of the G channel is completed, thus completing the G channel image reconstruction. The formula for calculating the interpolation result is: Specifically, in step S3, the image reconstruction steps for the R channel and B channel are as follows: S31: Calculate the horizontal and vertical gradients of channel G within a 3×3 window; Let the center coordinates be (x, y), and the calculation formula be: S32: Compare the magnitudes of the horizontal and vertical gradients obtained in S31, determine the edge direction of the G channel, and determine the interpolation direction of the R / B channels; S33: Based on the guiding direction determined in S32, interpolation is performed using the known R / B pixels within a 3×3 window, and the interpolated value is a preliminary estimate. The preliminary calculation formula is as follows: S34: Define the local linear fit coefficients and perform bilinear interpolation on the residuals within a 3×3 window to obtain the residual estimate at the position to be interpolated; Here, a and b are defined as local linear fitting coefficients (solved using the least squares method with known R and G pixels within a 3×3 window, reflecting the linear correlation between R and G). The formula for calculating residuals is defined as follows: S35: The final R / B channel result is obtained based on the local linear fitting coefficients; The calculation formula is: Specifically, in step S32, the specific judgment logic is as follows: If the horizontal gradient is less than the vertical gradient: then the edge of the G channel is in the vertical direction, the horizontal direction is smooth, and the R / B channels are interpolated along the horizontal direction; If the vertical gradient is less than or equal to the horizontal gradient, then the edge of the G channel is horizontal, the vertical direction is smooth, and the R / B channels are interpolated along the vertical direction.

[0016] Specifically, in step S4, the Retinex enhancement steps are as follows: S41: Perform a log transformation on the reconstructed RGB image to obtain the log-transformed image; S42: Apply Gaussian blur to the image after log transformation to obtain the Gaussian blurred image; S43: Subtract the image after log transformation from the image after Gaussian blur to obtain the image after removing the illumination; S44: Perform an inverse log transform on the image after illumination removal to obtain the Retinex-enhanced image.

[0017] Specifically, see Figures 2-3 The before-and-after image effects processed by the color interpolation method applicable to industrial vision according to the present invention significantly reduce the fogging of the interpolated image and improve the image quality.

[0018] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions or improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A color interpolation method suitable for industrial vision, characterized in that: Includes the following steps: S1: Obtain the Bayer image to be processed; S2: Reconstructing the G-channel image based on gradient dynamic weight allocation S3: Reconstruct the R and B channel images based on the gradient-guided direction of the G channel and residual interpolation correction; S4: Perform Retinex enhancement on the reconstructed RGB image; S5: Outputs an enhanced RGB image.

2. The color interpolation method suitable for industrial vision according to claim 1, characterized in that: In step S2, the specific steps for reconstructing the G-channel image based on gradient dynamic weight allocation are as follows: S21: Calculate gradients in multiple directions; S22: Calculate the mean of the neighborhood G components in multiple directions; S23: Select all known G and R pixel pairs within a preset range and calculate the color difference to obtain neighborhood color difference samples; S24: Perform mean smoothing on the color difference samples in S23 within a preset size to obtain the local average color difference; S25: Combine the R value of the current pixel with the average color difference obtained in S24 to calculate the preliminary G estimate values ​​in each direction, and perform anti-color shift processing; S26: Dynamically allocate weights for multiple directions using gradient inverse weighting, and then normalize the weights; S27: Finally, based on the recalculation obtained from weight S26, the interpolation result of the G channel is calculated, and the G channel image reconstruction is completed.

3. The color interpolation method suitable for industrial vision according to claim 1, characterized in that: In step S3, the specific steps for image reconstruction of the R channel and B channel are as follows: S31: Calculate the horizontal and vertical gradients of channel G within the preset range 2; S32: Compare the magnitudes of the horizontal and vertical gradients obtained in S31 to determine the edge direction of the G channel and the interpolation direction of the R / B channels; S33: Based on the guiding direction determined by S32, interpolation is performed using known R / B pixels within the preset range two, and the interpolated value is a preliminary estimate. S34: Define the local linear fitting coefficients and perform bilinear interpolation on the residuals within the preset range 2 to obtain the residual estimate at the position to be interpolated; S35: The final R / B channel result is obtained based on the local linear fitting coefficients.

4. A color interpolation method suitable for industrial vision according to claim 3, characterized in that: In step S32, the specific judgment logic is as follows: If the horizontal gradient is less than the vertical gradient: then the edge of the G channel is in the vertical direction, the horizontal direction is smooth, and the R / B channels are interpolated along the horizontal direction; If the vertical gradient is less than or equal to the horizontal gradient, then the edge of the G channel is horizontal, the vertical direction is smooth, and the R / B channels are interpolated along the vertical direction.

5. A color interpolation method suitable for industrial vision according to claim 1, characterized in that: In step S4, the specific steps for Retinex enhancement are as follows: S41: Perform a log transformation on the reconstructed RGB image to obtain the log-transformed image; S42: Apply Gaussian blur to the image after log transformation to obtain the Gaussian blurred image; S43: Subtract the image after log transformation from the image after Gaussian blur to obtain the image after removing the illumination; S44: Perform an inverse log transform on the image after illumination removal to obtain the Retinex-enhanced image.

Citation Information

Patent Citations

  • Edge crispening color interpolation method based on gradient

    CN101197916A

  • A color interpolation method based on edge detection

    CN104159091B

  • A color filter array interpolation method

    CN116847211B

  • Bayer-CFA interpolation method based on finite difference and gradient

    CN108961167A

  • Bayer image processing method and device, storage medium, chip and equipment

    CN115841426A