A Bayer image anti-crosstalk processing method and device

By using N*N sliding window and threshold replacement technology in the CMOS image sensor, the image crosstalk problem in the Bayer array is solved, the image quality is improved, and the hardware resource consumption is low.

CN114500769BActive Publication Date: 2024-10-22ARKMICRO TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202011265906.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-13
Publication Date
2024-10-22
Estimated Expiration
2040-11-13

AI Technical Summary

Technical Problem

During the image processing process, crosstalk occurs in the restored image in the Bayer array of the CMOS image sensor, especially in the high-frequency part of the green component, resulting in a decrease in image quality. It is difficult for existing technology to effectively solve this problem.

Method used

Use an N*N sliding window to slide in the Bayer image to be processed, calculate the average value and absolute difference of the green component, and use the preset threshold or the threshold obtained by linear interpolation to replace the green component value of the center point when determining the presence of crosstalk, reducing crosstalk phenomenon.

Benefits of technology

It effectively reduces the crosstalk phenomenon of images and requires small hardware resources, achieving simple and efficient anti-crosstalk processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114500769B_ABST
    Figure CN114500769B_ABST
Patent Text Reader

Abstract

The present invention provides a Bayer image anti-crosstalk processing method and device, the method comprising: using an N*N sliding window to slide in the Bayer image to be processed; when the center point of the sliding window is the green component, calculating the average value of the green component G in each row of data in the N*N data matrix and the absolute difference of the average values ​​of adjacent rows; calculating the average value of the green component G in each column of data in the N*N data matrix and the absolute difference of the average values ​​of adjacent columns; calculating the difference average value; when the difference average value is less than a preset first threshold value and meets a first condition, determining that crosstalk exists; when crosstalk exists, using a preset second threshold value as the real-time threshold value of the current point, otherwise using a third threshold value as the real-time threshold value of the current point; determining a color component value according to the green component value of the current center point, the real-time threshold value and the average value of four green components adjacent to the current center point, and replacing the current center point with the component value. The method for processing crosstalk is simple, practical and has good effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a Bayer image anti-crosstalk processing method and device. Background Art

[0002] With the development of image processing technology, the application of digital video images is becoming more and more common. In the fields of cameras, mobile devices such as mobile phones, vehicles, and monitoring, the quality requirements for video images are getting higher and higher. Among image sensors, CMOS image sensors have a higher cost-effectiveness than CCD image sensors and are widely used. CMOS image sensors generally adopt the form of Bayer array, with 1 / 4 R, 1 / 4 B and 1 / 2 G in the array. In the image processing process, it is necessary to restore the R, G, and B components of each pixel. In the high-frequency part of the image, the restored image will have crosstalk, especially the G component. Therefore, it is necessary to design a simple anti-crosstalk method to solve the above problems in order to reduce the image crosstalk generated in the process of restoring the RGB components of the Bayer array pixels. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a Bayer image anti-interference processing method and device, which can effectively reduce the crosstalk phenomenon of the image and require small hardware resources.

[0004] In order to solve the technical problem of the present invention, an embodiment of the present invention provides a Bayer image anti-interference processing method, comprising:

[0005] An N*N sliding window is used to slide in the Bayer image to be processed, wherein N is an odd number greater than or equal to 3;

[0006] When the center point of the sliding window is the green component, calculate the average value MH1, MH2…MH of the green component G in each row of data in the N*N data matrix N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF=(((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|)+…+(|MH N-1 -MH N-2 |-|MH N-MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+ (|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1);

[0007] When the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met, it is determined that crosstalk exists;

[0008] When it is determined that crosstalk exists, the preset second threshold CGFTH2 is used as the real-time threshold CGFTH of the current point, otherwise the third threshold CGFTH3 is used as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3;

[0009] A color component value is determined according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and the green component value of the current center point is replaced by the color component value.

[0010] Furthermore, the first condition is:

[0011] All even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1 <mh2>MH3、MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、MV3 <mv4>MV5, …MV N-2 <MV N-1 >MV N or

[0012] All even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

[0013] Further, determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes:

[0014] Calculate the weighting factor K, where the weighting factor K = |P-MA|-CGFTH;

[0015] The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient

[0016] A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

[0017] Further, a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3 using the following calculation expression: CGFTH3=a+(ba)*MA / MAmax, where a is the threshold corresponding to the minimum MA value of 0, and b is the threshold corresponding to the maximum MAmax.

[0018] Furthermore, the average value of the G component of each row or column of data in the N*N data matrix is ​​calculated using the following formula:

[0019] Assume that the number of G components in a row or column of data is x, where 2 n-1 <x≤2 n ; The corresponding G component values ​​are: G1, G2, ...G x ; The corresponding weight values ​​are K1, K2, ...K x ; then the average value of G component = (K1G1+K2G2+…K x G x ) / (K1+K2+…+K x ), where K1+K2+…+K x =2 n , K1, K2, …K X They are all positive integers; the closer the G component value is to the center point, the larger the corresponding weight K is.

[0020] Furthermore, N is 5.

[0021] The embodiment of the present invention further provides a Bayer image anti-interference processing device, comprising:

[0022] A sliding selection module, used for sliding an N*N sliding window in the Bayer image to be processed; wherein N is an odd number greater than or equal to 3;

[0023] The average value calculation module is used to calculate the average values ​​MH1, MH2…MH of the green component G in each row of data in the N*N data matrix when the center point of the sliding window is the green component. N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF=(((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|)+…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+ (|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1);

[0024] A crosstalk determination module, used for determining that crosstalk exists when the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met;

[0025] A threshold acquisition module is used to use the preset second threshold CGFTH2 as the real-time threshold CGFTH of the current point when it is determined that crosstalk exists, otherwise use the third threshold CGFTH3 as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3;

[0026] The calculation replacement module is used to determine a color component value according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and use the color component value to replace the green component value of the current center point.

[0027] Furthermore, the first condition is:

[0028] All even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1 <mh2>MH3、MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、MV3 <mv4>MV5, …MV N-2 <MV N-1 >MV N or

[0029] All even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

[0030] Further, determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes:

[0031] Calculate the weighting factor K, where the weighting factor K = |P-MA|-CGFTH;

[0032] The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient

[0033] A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

[0034] Further, a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3 using the following calculation expression: CGFTH3=a+(ba)*MA / MAmax, where a is the threshold corresponding to the minimum MA value of 0, and b is the threshold corresponding to the maximum MAmax.

[0035] The Bayer image anti-crosstalk processing method provided by the present invention is simpler, more practical, consumes less hardware resources and has a good anti-crosstalk effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 is a flowchart of a method for anti-crosstalk of a Bayer image according to an embodiment of the present invention;

[0038] Figure 2 This is a schematic diagram of a 5*5 data array;

[0039] Figure 3 It is a structural diagram of a Bayer image anti-interference device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0041] like Figure 1 As shown, an embodiment of the present invention provides a Bayer image anti-interference processing method, comprising the steps of:

[0042] S101. Use an N*N sliding window to slide in the Bayer image to be processed; wherein N is an odd number greater than or equal to 3.

[0043] S102, when the center point of the sliding window is the green component, calculate the average values ​​MH1, MH2, MH2, MH3, MH4, MH5, MH6, MH7, MH8, MH9, MH10, MH11, MH12, MH13, MH14, MH15, MH16, MH17, MH18, MH19, MH20, MH21, MH22, N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF=(((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|)+…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+ (|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1).

[0044] The N*N sliding window slides in the Bayer image to be processed to obtain an N*N data matrix. When the center point data P of the N*N data matrix is ​​the green component G, P is the current point to be processed. The average value of the green component G in the N rows of data is calculated respectively, and recorded as MH1, MH2...MH N , find the average value of the green component G in N columns of data, denoted as MV1, MV2…MV N .

[0045] The average value of the green component G can be calculated without considering the weight factor, and the sum of all green components G in each row or column can be directly divided by the number of green components. Figure 2 As shown, taking N=5 as an example, MH1=(P11+P13+P15) / 3, MH2=(P22+P24) / 2, MH3=(P31+P33+P35) / 3, MH4=(P42+P44) / 2, MH5=(P51+P53+P55) / 3, MV1=(P11+P31+P51) / 3, MV2=(P22+P42) / 2, MV3=(P13+P33+P53) / 3, MV4=(P24+P44) / 2, MV5=(P15+P35+P55) / 3.

[0046] It is also possible to calculate the average value of the green component G in the following way:

[0047] Assume that the number of G components in a row or column of data is x, where 2 n-1 <x≤2 n ; The corresponding G component values ​​are: G1, G2, ...G x ; The corresponding weight values ​​are K1, K2, ...K x ; then the average value of G component = (K1G1+K2G2+…K x G x ) / (K1+K2+…+K x ), where K1+K2+…+K x =2 n , K1, K2, …K X They are all positive integers; the closer the G component value is to the center point, the larger the corresponding weight K is.

[0048] Taking N=5 as an example, MH1=(P11+2*P13+P15) / 4, MH2=(P22+P24) / 2, MH3=(P31+2*P33+P35) / 4, MH4=(P42+P44) / 2, MH5=(P51+2*P53+P55) / 4, MV1=(P11+2*P31+P51) / 4, MV2=(P22+P42) / 2, MV3=(P13+2*P33+P53) / 4, MV4=(P24+P44) / 2, MV5=(P15+2*P35+P55) / 4.

[0049] Taking N=7 as an example, MH1=(P11+P13+P15+P17) / 4, MH2=(P22+2*P24+P26) / 4, MH3=(P31+P33+P35+P37) / 4, MH4=(P42+2*P44+P46) / 4, MH5=(P51+P53+P55+P57) / 4, MV1=(P11+P31+P51+P71) / 4, MV2=(P22+2*P42+P62) / 2, MV3=(P13+P33+P53+P73) / 4, MV4=(P24+2*P44+P64) / 4, MV5=(P15+P35+P55+P75) / 4.

[0050] When calculating the average value, the divisor is set to 2 to take into account the weight factor. n The form is conducive to the hardware to implement related operations. The corresponding division operation can be realized by shifting the binary number to the right, which is conducive to saving hardware overhead and improving operation processing efficiency.

[0051] According to the calculated average values ​​of the green component G in each row of data, MH1, MH2…MH N Obtain the absolute difference between the average values ​​of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |.

[0052] According to the calculated average values ​​MV1, MV2…MV N Obtain the absolute difference between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |.

[0053] Finally, the difference average value HVDIFF is calculated, where the difference average value HVDIFF = (((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|) +…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+(|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1).

[0054] S103 , when the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met, it is determined that crosstalk exists.

[0055] The preset first threshold CGFTH1 can be obtained by experimentally testing a test pattern with severe crosstalk. Specifically, for a 5*5 data matrix, the empirical value of CGFTH1 is generally 8.

[0056] The first condition is that all even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value MH1 of the green component G in the data of the two adjacent odd-numbered rows. <mh2>MH3、 MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、 MV3 <mv4>MV5, …MV N-2 <MV N-1 >MV N Or all even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、 MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、 MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

[0057] According to the difference of adjacent mean values, we can judge whether the even rows compared with adjacent rows, and the even columns compared with adjacent columns are peaks or troughs. The condition for judging a peak is that MH2 is larger than MH1 and MH3, MH4 is larger than MH3 and MH5…, that is, the even rows are larger than the adjacent rows, and MV2 is larger than MV1 and MV3, MV4 is larger than MV3 and MV5…, that is, the even columns are larger than the adjacent columns; similarly, the condition for judging a trough is that MH2 is smaller than MH1 and MH3, MH4 is smaller than MH3 and MH5…, that is, the even rows are smaller than the adjacent rows, and MV2 is smaller than MV1 and MV3, MV4 is smaller than MV3 and MV5…, that is, the even columns are smaller than the adjacent columns.

[0058] S104. When it is determined that crosstalk exists, the preset second threshold CGFTH2 is used as the real-time threshold CGFTH of the current point, otherwise the third threshold CGFTH3 is used as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed based on the average value MA to obtain the corresponding third threshold CGFTH3.

[0059] The preset second threshold CGFTH2 can be obtained by experimentally testing a test pattern with severe crosstalk. Specifically, for a 5*5 data matrix, the empirical value of CGFTH2 is generally 8.

[0060] Taking N=5 as an example, the average value MA=(P22+P24+P42+P44) / 4 of the four green components P22, P24, P42 and P44 adjacent to the center point P33 is calculated.

[0061] The corresponding third threshold CGFTH3 is obtained by performing linear interpolation operation according to the average value MA. Specifically, the following calculation expression can be used: CGFTH3 = a + (ba) * MA / MAmax, where a is the threshold corresponding to the minimum value 0 of MA, and b is the threshold corresponding to the maximum value MAmax of MA.

[0062] For a 5*5 data matrix, the threshold a=235 corresponds to the minimum MA value of 0, and the threshold b=255 corresponds to the maximum MA value of 255.

[0063] S105, determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and using the color component value to replace the green component value of the current center point.

[0064] Determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes:

[0065] Calculate the weighting factor K, where weighting factor K = |P-MA| - CGFTH.

[0066] The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient

[0067] A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

[0068] After the color component value RAWCGF is calculated, the green component value of the current center point is replaced by the color component value RAWCGF.

[0069] However, considering the anti-crosstalk processing effect and the corresponding software and hardware resource consumption, in this embodiment, the N value is preferably 5.

[0070] The Bayer image anti-interference processing method provided by the embodiment of the present invention is simple, practical and has good effect, and can play a role in reducing the crosstalk phenomenon of the Bayer image when restoring the RGB image.

[0071] Figure 3 The figure shows a Bayer image anti-interference processing device provided by an embodiment of the present invention, comprising: a sliding selection module 101, an average value calculation module 102, a crosstalk determination module 103, a threshold acquisition module 104 and a calculation replacement module 105.

[0072] A sliding selection module, used for sliding an N*N sliding window in the Bayer image to be processed; wherein N is an odd number greater than or equal to 3;

[0073] The average value calculation module is used to calculate the average values ​​MH1, MH2…MH of the green component G in each row of data in the N*N data matrix when the center point of the sliding window is the green component. N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF = (((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|) +…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+ (|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1);

[0074] A crosstalk determination module, used for determining that crosstalk exists when the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met;

[0075] A threshold acquisition module is used to use the preset second threshold CGFTH2 as the real-time threshold CGFTH of the current point when it is determined that crosstalk exists, otherwise use the third threshold CGFTH3 as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3;

[0076] The calculation replacement module is used to determine a color component value according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and use the color component value to replace the green component value of the current center point.

[0077] The first condition is that all even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value MH1 of the green component G in the data of the two adjacent odd-numbered rows. <mh2>MH3、 MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、 MV3 <mv4>MV5, …MV N-2 <MV N-1 >MV N Or all even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、 MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、 MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

[0078] Determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes:

[0079] Calculate the weighting factor K, where weighting factor K = |P-MA| - CGFTH.

[0080] The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient

[0081] A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

[0082] The corresponding third threshold CGFTH3 is obtained by performing linear interpolation operation based on the average value MA using the following calculation expression: CGFTH3=a+(ba)*MA / MAmax, where a is the threshold corresponding to the minimum value 0 of MA, and b is the threshold corresponding to the maximum value MAmax of MA.

[0083] It should be noted that: the Bayer image anti-crosstalk processing device provided in the above embodiment only uses the division of the above program modules as an example when performing anti-interference processing. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the above-described processing. In addition, the Bayer image anti-crosstalk processing device provided in the above embodiment and the Bayer image anti-crosstalk processing method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment. The beneficial effects are the same as those of the method embodiment, and will not be repeated here.

[0084] The embodiment of the present invention also provides a computer storage medium, which is a computer-readable storage medium, on which a computer program is stored, and the computer program can be executed by a processor of a computer device to complete the steps of the aforementioned Bayer image anti-crosstalk processing method. The computer-readable storage medium can be a magnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0085] An embodiment of the present invention further provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned Bayer image anti-crosstalk processing method when executing the computer program.

[0086] In the several embodiments provided by the present invention, it should be understood that the disclosed methods and intelligent devices can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0087] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0088] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A Bayer image anti-crosstalk processing method, characterized in that: include: Use an N*N sliding window to slide in the Bayer image to be processed; Where N is an odd number greater than or equal to 3; When the center point of the sliding window is the green component, calculate the average value MH1, MH2…MH of the green component G in each row of data in the N*N data matrix N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF = (((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|)+…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+(|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1); When the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met, it is determined that crosstalk exists; When it is determined that crosstalk exists, the preset second threshold CGFTH2 is used as the real-time threshold CGFTH of the current point, otherwise the third threshold CGFTH3 is used as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3; A color component value is determined according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and the green component value of the current center point is replaced by the color component value.

2. The Bayer image anti-crosstalk processing method according to claim 1, characterized in that: The first condition is: All even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1 <mh2>MH3、MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、MV3 <mv4>MV5、…MV N-2 <MV N-1 >MV N or All even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

3. The Bayer image anti-crosstalk processing method according to claim 1, characterized in that: Determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes: Calculate the weighting factor K, where the weighting factor K = |P-MA|-CGFTH; The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

4. The Bayer image anti-crosstalk processing method according to claim 1, characterized in that: The corresponding third threshold CGFTH3 is obtained by performing linear interpolation operation based on the average value MA using the following calculation expression: CGFTH3=a+(ba)*MA / MAmax, where a is the threshold corresponding to the minimum value 0 of MA, and b is the threshold corresponding to the maximum value MAmax of MA.

5. The Bayer image anti-crosstalk processing method according to claim 1, characterized in that: The following formula is used to calculate the average value of the G component of each row or column of data in the N*N data matrix: Assume that the number of G components in a row or column of data is x, where 2 n-1 <x≤2 n ; The corresponding G component values ​​are: G1, G2, ...G x ; The corresponding weight values ​​are K1, K2, ...K x ; then the average value of G component = (K1G1+K2G2+…K x G x ) / (K1+K2+…+K x ), where K1+K2+…+K x =2 n , K1, K2, …K X All are positive integers; the closer the G component value is to the center point, the larger the corresponding weight K is.

6. The Bayer image anti-crosstalk processing method according to claim 1, characterized in that: N is 5.

7. A Bayer image anti-crosstalk processing device, characterized in that: include: A sliding selection module, used for sliding an N*N sliding window in the Bayer image to be processed; Where N is an odd number greater than or equal to 3; The average value calculation module is used to calculate the average values ​​MH1, MH2…MH of the green component G in each row of data in the N*N data matrix when the center point of the sliding window is the green component. N and the absolute differences of the means of adjacent rows |MH2-MH1|, |MH3-MH2|, ... |MH N -MH N-1 |; Calculate the average value MV1, MV2…MV of the green component G in each column of the N*N data matrix N and the absolute differences between the means of adjacent columns |MV2-MV1|, |MV3-MV2|, ... |MV N -MV N-1 |; Calculate the difference average HVDIFF, where the difference average HVDIFF = (((|MH2-MH1|-|MH3-MH2|)+(|MH4-MH3|-|MH5-MH4|)+…+(|MH N-1 -MH N-2 |-|MH N -MH N-1 |))+((|MV2-MV1|-|MV3-MV2|)+(|MV4-MV3|-|MV5-MV4|)+…+(|MV N-1 -MV N-2 |-|MV N -MV N-1 |))) / (N-1); A crosstalk determination module, used for determining that crosstalk exists when the difference average HVDIFF is less than a preset first threshold CGFTH1 and a first condition is met; A threshold acquisition module is used to use the preset second threshold CGFTH2 as the real-time threshold CGFTH of the current point when it is determined that crosstalk exists, otherwise use the third threshold CGFTH3 as the real-time threshold of the current point; wherein the third threshold CGFTH3 is determined in the following manner: the average value MA of the four green components adjacent to the center point is calculated, and a linear interpolation operation is performed according to the average value MA to obtain the corresponding third threshold CGFTH3; The calculation replacement module is used to determine a color component value according to the green component value P of the current center point, the real-time threshold CGFTH and the average MA of the four green components adjacent to the current center point, and use the color component value to replace the green component value of the current center point.

8. The Bayer image anti-crosstalk processing device according to claim 7, characterized in that: The first condition is: All even-numbered rows satisfy the condition that the average value of the green component G in the data is greater than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1 <mh2>MH3、MH3 <mh4>MH5, …MH N-2 <MH N-1 >MH N And all even columns satisfy the condition that the average value of the green component G in the data is greater than the average value MV1 of the green component G in the data of the two adjacent odd columns <mv2>MV3、MV3 <mv4>MV5、…MV N-2 <MV N-1 >MV N or All even-numbered rows satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd-numbered rows MH1>MH2<MH3、MH3> MH4 <MH5、…MH N-2 >MH N-1 <MH N And all even columns satisfy the condition that the average value of the green component G in the data is less than the average value of the green component G in the data of the two adjacent odd columns MV1>MV2<MV3、MV3> MV4 <MV5、…MV N-2 >MV N-1 <MV N .

9. The Bayer image anti-crosstalk processing device according to claim 7, characterized in that: Determining a color component value according to the green component value P of the current center point, the real-time threshold CGFTH, and the average value MA of four green components adjacent to the current center point specifically includes: Calculate the weighting factor K, where the weighting factor K = |P-MA|-CGFTH; The weighting coefficient KP is determined according to the weighting factor K, where the weighting coefficient A color component value is determined according to the weighting coefficient KP, wherein the color component value RAWCGF=(KP*P+(128-KP)*MA) / 128.

10. The Bayer image anti-crosstalk processing device according to claim 7, characterized in that: The corresponding third threshold CGFTH3 is obtained by performing linear interpolation operation based on the average value MA using the following calculation expression: CGFTH3=a+(ba)*MA / MAmax, where a is the threshold corresponding to the minimum value 0 of MA, and b is the threshold corresponding to the maximum value MAmax of MA.

Citation Information

Cited By

  • Self-adaptive image crosstalk correction method and system and medium

    CN121235960A