Method for removing purple edge in large area
Through the methods of color sharpening and multi-color spatial analysis, the purple edges in large areas are accurately positioned and removed, which solves the shortcomings in the detection and removal of purple edges in the prior art, and ensures the integrity of the color information of the edges of the object.
Patent Information
- Application Number
- CN202311034788.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-15
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art is difficult to effectively detect and remove purple edges in large areas, and commonly used methods can easily lead to the loss of color information of the object edge during the removal process.
The purple edge area is reduced by color sharpening method. By transferring the image to the YUV and HSV color spaces, the purple edge area is accurately positioned using a variety of information, and two purple edge correction methods are used to stably remove and restore the purple edge color.
Accurate detection and effective removal of purple edges in large areas are achieved, ensuring the integrity of color information at the edge of the object, and solving the problems of false detection and loss of color information when removing purple edges in large areas in the prior art.
Smart Images

Figure CN119515724A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing, and in particular relates to a method for removing purple fringes in a large area. Background Art
[0002] In the prior art, such as Figure 1 As shown, in optics, incident light of different wavelengths has different refractive indices and will focus at different positions on the image plane, resulting in optical chromatic aberration. Optical chromatic aberration is divided into axial chromatic aberration and lateral chromatic aberration. The imaging system generally focuses the green channel accurately, so the lateral chromatic aberration causes the object to produce a purple-red pseudo edge, namely, purple fringing, while the axial chromatic aberration causes the pseudo edge to diffuse. At present, the main methods to eliminate purple fringing are purple fringing detection and purple fringing correction. Purple fringing detection usually uses the color information and brightness information of the image to detect purple fringing. For example, when the image is converted from RGB space to YCrCb space, the highlight area and purple area are determined by setting certain thresholds for CrCb and Y components, and then the purple fringing range is determined by combination. The purple fringing correction method usually performs weighted desaturation within the purple fringing range to finally achieve the purpose of removing purple fringing.
[0003] However, the defects of the prior art are:
[0004] At present, mainstream methods for removing purple fringes have solutions for narrow purple fringes. However, for large-area purple fringes, current methods have the following problems:
[0005] (1) The current purple fringing detection method is difficult to detect purple fringing in a large area and may lead to false detection of purple objects;
[0006] (2) The current method of desaturation removal can easily lead to the loss of color information at the edge of objects when removing purple fringing in large areas.
[0007] In addition, common terminology explanations in the prior art include:
[0008] HSV: HSV color space. H is hue; S is saturation; V is brightness.
[0009] YUV: YUV color space. Y is brightness; U and V are chromaticity.
[0010] Gradient: It refers to the maximum value of the derivative of a function at that point.
[0011] Axial chromatic aberration: The lens images light of different wavelengths at different positions, so that the focal planes of light of different colors cannot overlap when the final image is formed, resulting in dispersion. Summary of the invention
[0012] In order to solve the above problems, the purpose of this application is to:
[0013] 1. Design a color sharpening method to reduce the purple fringing diffusion problem caused by axial chromatic aberration and narrow the purple fringing;
[0014] 2. Convert the image to YUV and HSV color space to obtain H hue information, S saturation information, Y brightness information, and UV gradient information, analyze the characteristics of the purple fringing area, and accurately locate the purple fringing area through a variety of information;
[0015] 3. Stably remove and restore purple fringing colors through two purple fringing correction methods.
[0016] Specifically, the present invention proposes a method for removing purple fringing in a large area, the method comprising the following steps:
[0017] S1, first, use the color edge sharpening method to sharpen the purple edge and reduce the purple edge area, including:
[0018] Obtain local extreme value; Correct signal; Overshoot control;
[0019] S2, secondly, purple fringing detection is performed, the image is converted to HSV and YUV color space, the H component is used to determine the color range of the purple fringing, the V component is used to determine the highlight area near the purple fringing, the gradient information of the U and V components is used to detect the color fringing, and the S component is designed to obtain the saturation threshold, including:
[0020] RGB->YUV, HSV conversion; then:
[0021] Color range area determination; highlight area determination; gradient information determination; saturation threshold limit;
[0022] S3, finally, purple fringing correction, classifies and corrects the detected purple fringing areas, including:
[0023] Purple fringed area; restore purple fringed color; reduce purple fringing saturation.
[0024] The step S1, the color edge sharpening, in order to correct the color diffusion problem caused by axial chromatic aberration, adjusts the values of the R and B channels based on the G channel, further comprising:
[0025] S1.1, obtain the local extreme value, find the maximum and minimum values of each pixel in the vertical and horizontal directions in the R and B channel windows, and obtain the local extreme value. The calculation formula is as follows:
[0026] Hrange=C hmax -C hmin
[0027] Vrange=C vmax -C vmin
[0028] if Hrange>Vrange
[0029] C max =C hmax
[0030] C min =C hmin
[0031] else
[0032] C max =C vmax
[0033] C min =C vmin
[0034] The calculation process of local extreme values in each direction is expressed as follows:
[0035] Input:C hmax Maximum horizontal value
[0036] C hmin Horizontal minimum
[0037] C vmax Maximum vertical value
[0038] C vmin Minimum vertical value
[0039] Output:C max Local maximum
[0040] C min Local Minimum
[0041] if Hrange>Vrange
[0042] C max =C hmax
[0043] C min =C hmin
[0044] else
[0045] C max =C vmax
[0046] C min =C vmin
[0047] endif
[0048] S1.2, correction signal, using the current pixel first-order gradient C', calculate the gain control function, the formula of the sharpened color information can be expressed as:
[0049] C(x,y) new =C(x,y) ori -|C(x,y)' / k|×(C(x,y) ori -C min );
[0050] Where k is the normalization factor; C ori is the current pixel value; C new is the value after sharpening;
[0051] The calculation process of color information sharpening is as follows:
[0052] Input: C_ori: current pixel value
[0053] C_min: minimum pixel value
[0054] C_gradient: first-order gradient
[0055] K: normalization factor
[0056] Output:C_new
[0057] delta=abs(C_gradient / k)*(C_ori-C_min)
[0058] C_new = C_ori – delta;
[0059] S1.3, overshoot limit, the updated value of the anti-overshoot limit is in the local extreme value calculated above, and the updated channel value cannot be less than the G channel value.
[0060] C(x,y) new =max(max(min(C(x,y) new ,C max ),C min ),G(x,y));
[0061] The calculation process of overshoot control is expressed as follows:
[0062] Input: C_ori: current pixel value
[0063] C_min: local minimum
[0064] C_max: local minimum
[0065] G: pixel value of G channel
[0066] Output: C_new: channel value after overshoot limiting
[0067] temp1=abs(C_gradient / k)*(C_ori-C_min)
[0068] temp2=max(temp1,C_min)
[0069] C_new=max(temp,G).
[0070] The step S2, purple fringing detection, further comprises:
[0071] The color region range determination is as follows: the image is converted to the HSV color space, and the purple edge region is determined by the purple degree, wherein the purple degree calculation formula is as follows:
[0072]
[0073] The process of purple calculation is as follows:
[0074] Input:Fsita: purple angle value
[0075] sita: current angle value
[0076] sita_max: Maximum angle value
[0077] Output:Pd: purple degree
[0078] temp1=abs(Fsita-sita)
[0079] temp2=min(temp1,sita_max)
[0080] Pd=(sita_max-temp2) / sita_max;
[0081] Determination of the highlight area: Since purple fringes often appear near the highlight area, a window centered on the point is established. When there are several points in the window whose brightness components are greater than a fixed threshold, the point can be determined to be near the highlight area.
[0082] The gradient information is determined by converting the image to the YUV space and using four truncated pyramid filters to obtain the gradient information of the UV component, thereby obtaining the color edge of the image and protecting the color of the non-edge area from being affected. The gradient calculation formula is expressed as follows:
[0083]
[0084]
[0085] U gradient=|h*u(x,y)|+|v*u(x,y)|+|b*u(x,y)|+|s*u(x,y)|
[0086] V gradient =|h*v(x,y)|+|v*v(x,y)|+|b*v(x,y)|+|s*v(x,y)|
[0087] Gradient=U gradient +V gradient
[0088] Where h, v, s, b represent four truncated pyramid filters, and * represents the convolution operation;
[0089] The gradient information of the UV component is expressed as follows:
[0090] Input: h: horizontal truncated pyramid filter
[0091] v: vertical truncated pyramid filter
[0092] s: diagonal truncated pyramid filter
[0093] b: diagonal horizontal truncated pyramid filter
[0094] U: U component value
[0095] V: V component value
[0096] Output:Gradient: Gradient of UV component
[0097] U gradient =abs(h*U)+abs(v*U)+abs(b*U)+abs(s*U)
[0098] V gradient =abs(h*V)+abs(v*V)+abs(b*V)+abs(s*V)
[0099] G radient =U gradient +V gradient ;
[0100] The saturation threshold limit: by limiting the saturation, the normal object color within a certain saturation range will not be detected.
[0101] In step S3, purple fringing correction is divided into the following two methods:
[0102] 1) Restore the color of the purple-fringed area by using the color of the objects around the purple-fringed area;
[0103] The red-green color difference can be used as a basis for judging whether the color of the surrounding objects is referenceable. When the red-green color difference of the surrounding objects is close to the red-green color difference of the purple edge, the color is referenceable. The judgment formula is as follows:
[0104] |Gap(x+i,y+j) normalGR -Gap(x,y) purfGR |≤Threshold i,j∈M
[0105] The process of color reference determination is as follows:
[0106] Input: GapGRnor: Red and green difference of surrounding objects
[0107] GappurfGR: Purple edge red and green difference
[0108] M: Window
[0109] Threshold: Threshold
[0110] Output: Judgment result
[0111] 1:for i in M:
[0112] 2:for j in M:
[0113] 3:diff=abs(GapGRnor(x+i,y+j)-GappurfGR)
[0114] 4:if diff<=Threshold:
[0115] 5:print("satisfies the conditions")
[0116] 6: endif
[0117] 7: endfor
[0118] 8:endfor
[0119] Where M is the window; Gap is the color difference; Threshold is the threshold for judging the degree of proximity;
[0120] At this time, the relationship between the blue-green difference and the red-green difference is used to restore the purple edge area and the blue-green difference. The calculation formula is as follows:
[0121]
[0122]
[0123] B new (x,y)=Gap(x,y)+G(x,y)
[0124] The process of restoring the blue-green color difference is as follows:
[0125] Input: GapGRnor: Red and green difference of surrounding objects
[0126] GappurfGR: Purple edge red and green difference
[0127] GappurfGB: Purple edge blue-green difference
[0128] M: Window
[0129] Output:Bnew: B channel repair value
[0130] for i in M:
[0131] for j in M:
[0132] GapGB=GapnorGR(x+i,y+j)-GappurfGR+GappurfGB
[0133] Bnew=GapGB+G
[0134] endfor
[0135] endfor;
[0136] 2) There is no reference for the surrounding colors of the object, so the only way to remove the purple fringing is to reduce the saturation;
[0137] When the color of the surrounding objects is not of reference, the purple fringing is removed by reducing the saturation. The saturation reduction is in the YUV domain, and the U and V components in the window are smoothed. The saturation and purple degree in the purple fringing detection are used as weights. The higher the purple degree and saturation, the lower the weight. The specific calculation formula is as follows:
[0138]
[0139]
[0140] The calculation process of U and V component smoothing is as follows:
[0141] Input:W: smoothing weight
[0142] M: Window
[0143] sat: saturation
[0144] Pd: purple degree
[0145] C: U, V components
[0146] Output:Cnew: U, V component update
[0147] for i in M:
[0148] for j in M:
[0149] w(x+i,y+j)=1 / (sat(x+i,y+j)+eps)*1 / (pd(x+i,y+j)+eps)
[0150] Sumw=Sumw+w(x+i,y+j)
[0151] endfor
[0152] for i in M:
[0153] for j in M:
[0154] normalized_w(x+i,y+j)=w(x+i,y+j) / SumwCnew(x+i,y+j)=Cnew(x+i,y+j)+normalized_w(x+i,y+j)*C(x+i,y+j)
[0155] End for.
[0156] Therefore, the advantages of the present application are: the method is simple, and by accurately detecting large-area purple fringing in the image and reasonably removing the purple fringing of the object, the color of the object edge is ensured to be more consistent with the perception of the human eye, which effectively solves the problem of large-area purple fringing removal in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0157] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0158] Figure 1 It is a schematic diagram of the chromatic aberration light path.
[0159] Figure 2 It is a flowchart of the application method.
[0160] Figure 3 is a schematic diagram of the color sharpening method.
[0161] Figure 4 It is a schematic diagram of purple degree calculation. DETAILED DESCRIPTION
[0162] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail in conjunction with the accompanying drawings.
[0163] The present invention proposes a method for removing purple fringing in a large area. By analyzing the causes of purple fringing, it can be known that the axial chromatic aberration of the lens will cause the color edge to diffuse. Therefore, the color edge sharpening method is first used to sharpen the purple fringing and reduce the purple fringing area. Secondly, the image is transferred to the HSV and YUV color spaces, and the H component is used to determine the color range of the purple fringing, the V component determines the highlight area near the purple fringing, the gradient information of the U and V components detects the color fringing, and the S component is designed to obtain the saturation threshold. Finally, the detected purple fringing area is classified and corrected. The specific process is as follows Figure 2 As shown:
[0164] S1, first, use the color edge sharpening method to sharpen the purple edge and reduce the purple edge area, including:
[0165] Obtain local extreme value; Correct signal; Overshoot control;
[0166] S2, secondly, purple fringing detection is performed, the image is converted to HSV and YUV color space, the H component is used to determine the color range of the purple fringing, the V component is used to determine the highlight area near the purple fringing, the gradient information of the U and V components is used to detect the color fringing, and the S component is designed to obtain the saturation threshold, including: RGB->YUV, HSV conversion; then:
[0167] Color range area determination; highlight area determination; gradient information determination; saturation threshold limit;
[0168] S3, finally, purple fringing correction, classifies and corrects the detected purple fringing areas, including:
[0169] Purple fringed area; restore purple fringed color; reduce purple fringing saturation.
[0170] The present invention is described in further detail below.
[0171] S1, color edge sharpening
[0172] like Figure 3 As shown, the color edge algorithm aims to correct the color diffusion problem caused by axial chromatic aberration, and adjusts the values of the R and B channels based on the G channel.
[0173] S1.1, find the maximum and minimum values of each pixel in the vertical and horizontal directions in the R and B channel windows to obtain the local extreme value. The calculation process is as follows:
[0174] Hrange=C hmax -C hmin
[0175] Vrange=C vmax -C vmin
[0176] if Hrange>Vrange
[0177] C max =C hmax
[0178] C min =C hmin
[0179] else
[0180] C max =C vmax
[0181] C min =C vmin
[0182]
[0183] S1.2, using the first-order gradient C' of the current pixel, calculate the gain control function, and the sharpened color information can be expressed as:
[0184] C(x,y) new =C(x,y) ori -|C(x,y)' / k|×(C(x,y) ori -C min )
[0185] Where k is the normalization factor; C ori is the current pixel value; C new is the value after sharpening;
[0186]
[0187] S1.3, the updated value of the anti-overshoot limit is in the local extreme value calculated above, and the updated channel value cannot be less than the G channel value,
[0188] C(x,y) new =max(max(min(C(x,y) new ,C max ),C min ),G(x,y));
[0189]
[0190] S2, purple fringing detection:
[0191] The color region range determination: convert the image to HSV color space. Figure 4 As shown in the figure, the purple edge area is determined by the purple degree. The calculation process of the purple degree is as follows:
[0192]
[0193]
[0194] Described highlight area determination: Since purple fringing often appears near a highlight area, by establishing a window centered on the point, when there are several points in the window whose brightness components are greater than a fixed threshold, it can be determined that the point is near the highlight area.
[0195] The gradient information determination is: convert the image to YUV space, use four truncated pyramid filters to obtain the gradient information of the UV component, thereby obtaining the color edge of the image and protecting the color of the non-edge area from being affected. The gradient calculation process is as follows:
[0196]
[0197]
[0198] U gradient =|h*u(x,y)|+|v*u(x,y)|+|b*u(x,y)|+|s*u(x,y)|
[0199] V gradient =|h*v(x,y)|+|v*v(x,y)|+|b*v(x,y)|+|s*v(x,y)|
[0200] Gradient=U gradient +V gradient
[0201] Where h, v, s, b represent four truncated pyramid filters and * represents a convolution operation.
[0202]
[0203] The saturation threshold limit: by limiting the saturation, the normal object color within a certain saturation range will not be detected.
[0204] S3, purple fringing correction, can be divided into the following two methods.
[0205] 1) The color of the purple-fringed area can be restored with the help of the color of the objects around the purple-fringed area.
[0206] 2) There is no reference for the colors around the object, so the only way to remove the purple fringing is to reduce the saturation.
[0207] The red-green color difference can be used as a basis for judging whether the color of the surrounding objects is referenceable. When the red-green color difference of the surrounding objects is close to the red-green color difference of the purple edge, the color is referenceable. The judgment process is as follows:
[0208] |Gap(x+i,y+j) normalGR-Gap(x,y) purfGR |≤Threshold i,j∈M
[0209] Where M is the window; Gap is the color difference; Threshold is the threshold for judging the degree of proximity.
[0210]
[0211] At this time, the relationship between the blue-green difference and the red-green difference is used to restore the purple edge area and the blue-green difference. The calculation process is as follows:
[0212]
[0213]
[0214] B new (x,y)=Gap(x,y)+G(x,y)
[0215]
[0216] When the color of the surrounding objects is not of reference, the purple fringing is removed by reducing the saturation. The saturation reduction is in the YUV domain, smoothed by the U and V components in the window, and the saturation and purple degree in the purple fringing detection are used as weights. The higher the purple degree and saturation, the lower the weight. The specific calculation process is as follows:
[0217]
[0218]
[0219]
[0220]
[0221] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for removing purple fringing in a large area, characterized in that: The method comprises the following steps: S1, first, use the color edge sharpening method to sharpen the purple edge and reduce the purple edge area, including: Obtain local extreme value; Correct signal; Overshoot control; S2, secondly, purple fringing detection is performed, the image is converted to HSV and YUV color space, the H component is used to determine the color range of the purple fringing, the V component is used to determine the highlight area near the purple fringing, the gradient information of the U and V components is used to detect the color fringing, and the S component is designed to obtain the saturation threshold, including: RGB->YUV, HSV conversion; then: Color range area determination; highlight area determination; gradient information determination; saturation threshold limit; S3, finally, purple fringing correction, classifies and corrects the detected purple fringing areas, including: Purple fringed area; restore purple fringed color; reduce purple fringing saturation.
2. The method for removing purple fringing in a large area according to claim 1, characterized in that: The step S1, the color edge sharpening, in order to correct the color diffusion problem caused by axial chromatic aberration, adjusts the values of the R and B channels based on the G channel, further comprising: S1.1, obtain the local extreme value, find the maximum and minimum values of each pixel in the vertical and horizontal directions in the R and B channel windows, and obtain the local extreme value. The calculation formula is as follows: Hrange=C hmax -C hmin Wrong=C vmax -C vmin if Hrange>Vrange C max =C hmax C min =C hmin else C max =C vmax C min =C vmin The calculation process of local extreme values in each direction is expressed as follows: Input:C hmax Maximum horizontal value C hmin Horizontal minimum C vmax Maximum vertical value C vmin Minimum vertical value Output:C max Local maximum C min Local Minimum if Hrange>Vrange C max =C hmax C min =C hmin else C max =C vmax C min =C vmin endif S1.2, correction signal, using the current pixel first-order gradient C', calculate the gain control function, the formula of the sharpened color information can be expressed as: C(x,y) new =C(x,y) ori -|C(x,y)' / k|×(C(x,y) ori -C min ); Where k is the normalization factor; C ori is the current pixel value; C new is the value after sharpening; The calculation process of color information sharpening is as follows: Input: C_ori: current pixel value C_min: minimum pixel value C_gradient: first-order gradient K: normalization factor Output:C_new delta=abs(C_gradient / k)*(C_ori-C_min) C_new = C_ori – delta; S1.3, overshoot limit, the updated value of the anti-overshoot limit is in the local extreme value calculated above, and the updated channel value cannot be less than the G channel value. C(x,y) new =max(max(min(C(x,y) new ,C max ),C min ),G(x,y)); The calculation process of overshoot control is expressed as follows: Input: C_ori: current pixel value C_min: local minimum C_max: local minimum G: pixel value of G channel Output: C_new: channel value after overshoot limiting temp1=abs(C_gradient / k)*(C_ori-C_min) temp2=max(temp1,C_min) C_new=max(temp,G).
3. The method for removing purple fringing in a large area according to claim 1, characterized in that: The step S2, purple fringing detection, further comprises: The color region range determination is as follows: the image is converted to the HSV color space, and the purple edge region is determined by the purple degree, wherein the purple degree calculation formula is as follows: The process of purple calculation is as follows: Input:Fsita: purple angle value sita: current angle value sita_max: Maximum angle value Output:Pd: purple degree temp1=abs(Fsita-sita) temp2=min(temp1,sita_max) Pd=(sita_max-temp2) / sita_max; Determination of the highlight area: Since purple fringes often appear near the highlight area, a window centered on the point is established. When there are several points in the window whose brightness components are greater than a fixed threshold, the point can be determined to be near the highlight area. The gradient information is determined by converting the image to the YUV space and using four truncated pyramid filters to obtain the gradient information of the UV component, thereby obtaining the color edge of the image and protecting the color of the non-edge area from being affected. The gradient calculation formula is expressed as follows: U gradient =|h*u(x,y)|+|v*u(x,y)|+|b*u(x,y)|+|s*u(x,y)| V gradient =|h*v(x,y)|+|v*v(x,y)|+|b*v(x,y)|+|s*v(x,y)| Gradient=U gradient +V gradient Where h, v, s, b represent four truncated pyramid filters, and * represents the convolution operation; The gradient information of the UV component is expressed as follows: Input: h: horizontal truncated pyramid filter v: vertical truncated pyramid filter s: diagonal truncated pyramid filter b: diagonal horizontal truncated pyramid filter U: U component value V: V component value Output:Gradient: Gradient of UV component U gradient =abs(h*U)+abs(v*U)+abs(b*U)+abs(s*U) V gradient =abs(h*V)+abs(v*V)+abs(b*V)+abs(s*V) G radient =U gradient +V gradient ; The saturation threshold limit: by limiting the saturation, the normal object color within a certain saturation range will not be detected.
4. The method for removing purple fringing in a large area according to claim 1, characterized in that: In step S3, purple fringing correction is divided into the following two methods: 1) Restore the color of the purple-fringed area by using the color of the objects around the purple-fringed area; The red-green color difference can be used as a basis for judging whether the color of the surrounding objects is referenceable. When the red-green color difference of the surrounding objects is close to the red-green color difference of the purple edge, the color is referenceable. The judgment formula is as follows: |Gap(x+i,y+j) normalGR -Gap(x,y) purfGR |≤Threshold i,j∈M The process of color reference determination is as follows: Input: GapGRnor: Red and green difference of surrounding objects GappurfGR: Purple edge red and green difference M: Window Threshold: Threshold Output: Judgment result 1:for i in M: 2:for j in M: 3:diff=abs(GapGRnor(x+i,y+j)-GappurfGR) 4:if diff<=Threshold: 5:print("satisfies the conditions") 6:endif 7:endfor 8:endfor Where M is the window; Gap is the color difference; Threshold is the threshold for judging the degree of proximity; At this time, the relationship between the blue-green difference and the red-green difference is used to restore the purple edge area and the blue-green difference. The calculation formula is as follows: B new (x,y)=Gap(x,y)+G(x,y) The process of restoring the blue-green color difference is as follows: Input: GapGRnor: Red and green difference of surrounding objects GappurfGR: Purple edge red and green difference GappurfGB: Purple edge blue-green difference M: Window Output:Bnew: B channel repair value for i in M: for j in M: GapGB=GapnorGR(x+i,y+j)-GappurfGR+GappurfGB Bnew=GapGB+G endfor endfor; 2) There is no reference for the surrounding colors of the object, so the only way to remove the purple fringing is to reduce the saturation; When the color of the surrounding objects is not of reference, the purple fringing is removed by reducing the saturation. The saturation reduction is in the YUV domain, and the U and V components in the window are smoothed. The saturation and purple degree in the purple fringing detection are used as weights. The higher the purple degree and saturation, the lower the weight. The specific calculation formula is as follows: The calculation process of U and V component smoothing is as follows: Input:W: smoothing weight M: Window sat: saturation Pd: purple degree C: U, V components Output:Cnew: U, V component update for i in M: for j in M: w(x+i,y+j)=1 / (sat(x+i,y+j)+eps)*1 / (pd(x+i,y+j)+eps) Sumw=Sumw+w(x+i,y+j) endfor for i in M: for j in M: normalized_w(x+i,y+j)=w(x+i,y+j) / Sumw Cnew(x+i,y+j)=Cnew(x+i,y+j)+normalized_w(x+i,y+j)*C(x+i,y+j)Endfor.