Image color edge processing method, device, storage medium and electronic device
The chromaticity information of edge pixels in the image is corrected through digital image processing methods, which solves the problem of false color edges caused by chromatic aberration and achieves efficient image processing effects.
Patent Information
- Application Number
- CN201910797161.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-27
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2039-08-27
AI Technical Summary
Existing technology is difficult to effectively solve the problem of false color edges caused by chromatic aberration in images, and hardware solutions are costly and ineffective.
Through digital image processing methods, edge detection is performed on the target image to determine edge pixels and their color edge transition areas, and chromaticity information is corrected based on the final sharpened chromaticity information to achieve accurate processing of color edges.
It achieves accurate processing of color edges, ensuring picture continuity and picture quality, without being restricted by hardware cost and R&D difficulty.
Smart Images

Figure CN112446830B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of image processing technology, and in particular to a method, device, storage medium, and electronic device for processing image color fringing. Background Art
[0002] With the development of science and technology, people have higher and higher requirements for the display effect of images. However, lenses have different refractive indices for different colors of light, resulting in different propagation paths for different colors of light after passing through the optical imaging system, and ultimately resulting in different imaging positions and imaging magnifications. This difference in imaging is called chromatic aberration. Chromatic aberration is divided into positional chromatic aberration and magnification chromatic aberration. Magnification chromatic aberration means that the off-axis image points of various colors of light do not overlap. When the magnification chromatic aberration is serious, the image of the object will have false color fringing. Positional chromatic aberration refers to the different focal planes corresponding to different colors of light, resulting in a certain amount of edge blur on the image plane. The existence of positional chromatic aberration increases the width of the false color fringing, and the appearance of false color fringing seriously affects the visual effect of the image. The method of eliminating the color fringing phenomenon through hardware equipment is costly, difficult to develop, and the effect cannot be guaranteed. Summary of the Invention
[0003] The embodiments of the present application provide a method, device, storage medium and electronic device for processing image color edges, which can process color edges through digital image processing, obtain accurate processing results, and ensure that the image quality is not affected.
[0004] In a first aspect, an embodiment of the present application provides a method for processing image color fringing, the method comprising:
[0005] Perform edge detection on the target image to determine the edge pixel points in the target image;
[0006] Determining a color fringing transition region to which the edge pixel belongs; and determining a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region;
[0007] The chromaticity information of the edge pixel point is corrected according to the target chromaticity information correction value of the edge pixel point.
[0008] Optionally, determining a color fringing transition region to which the edge pixel belongs; and determining a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region, including:
[0009] If the edge pixel point is an edge pixel point of the target image in a direction, determining a color edge transition region of the edge pixel point in the direction; and determining a target chromaticity information correction value of the edge pixel point based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition region;
[0010] If the edge pixel point is an edge pixel point of the target image in at least two directions, determining a color edge transition area of the edge pixel point in at least two directions;
[0011] Determining at least two chromaticity information correction values of the edge pixel point according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixels of at least two color edge transition areas;
[0012] A target chromaticity information correction value of the edge pixel point is determined according to the at least two chromaticity information correction values of the edge pixel point.
[0013] Optionally, determining a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color edge transition area includes:
[0014] Determine a target chromaticity information correction value of the edge pixel point based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the boundary point of the color edge transition area;
[0015] or,
[0016] The target chromaticity information correction value of the edge pixel is determined according to the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of a preset number of reference points in the color edge transition area.
[0017] Optionally, determining a color edge transition area of the edge pixel point in at least two directions includes:
[0018] Determine the edge gradient direction based on the G component of the three primary colors of the edge pixel;
[0019] In the edge gradient direction, at least two detection points are set, and the at least two detection points are respectively arranged on both sides of the edge pixel point;
[0020] From the edge pixel point to both sides, it is identified whether the detection point meets the preset boundary conditions. If so, the detection point is determined to be a boundary point of the color edge transition area.
[0021] Optionally, correcting the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points includes:
[0022] Determining a correction result of the G component of the three primary colors according to the target chromaticity information correction value of the edge pixel point and the brightness information of the edge pixel point;
[0023] According to the correction result of the G component and the target chromaticity information correction value of the edge pixel point, the correction results of the R component and the correction results of the B component in the three primary colors are determined.
[0024] Optionally, before performing edge detection on the target image to determine edge pixels in the target image, the method further includes:
[0025] Filtering the initial chromaticity information of the target pixel in the target image to determine the high-frequency component of the chromaticity information of the target pixel;
[0026] Sharpening the chromaticity information of the target pixel point according to the high-frequency component of the chromaticity information of the target pixel point to obtain preliminary sharpened chromaticity information of the target pixel point;
[0027] The final sharpened chromaticity information of the target pixel is determined according to the preliminary sharpened chromaticity information of the target pixel and the initial chromaticity information of the neighboring pixels of the target pixel.
[0028] Optionally, performing sharpening processing on the target pixel according to the high-frequency component of the chromaticity information of the target pixel to obtain preliminary sharpened chromaticity information of the target pixel includes:
[0029] The product of the high-frequency component of the chromaticity information of the target pixel and the preset sharpening gain is determined as the sharpening amplitude of the target pixel;
[0030] The sum of the initial chromaticity information of the target pixel and the sharpening amplitude of the target pixel is used as the preliminary sharpened chromaticity information of the target pixel.
[0031] Optionally, determining the final sharpened chromaticity information of the target pixel point based on the preliminary sharpened chromaticity information of the target pixel point and the image chromaticity information of the neighboring pixels of the target pixel point includes:
[0032] Determine the value range of the chromaticity information of the target pixel point based on the chromaticity information of the neighboring pixels in the reference area to which the target pixel point belongs;
[0033] The final sharpened chromaticity information of the target pixel is determined according to the preliminary sharpened chromaticity information of the target pixel and the value range of the chromaticity information.
[0034] Optionally, determining a value range of the chromaticity information of the target pixel according to the chromaticity information of neighboring pixels in the reference area to which the target pixel belongs includes:
[0035] The maximum chromaticity value of a neighboring pixel in the reference area to which the target pixel belongs is used as the upper limit of the chromaticity information value range of the target pixel;
[0036] The minimum chromaticity value of the neighboring pixel in the reference area to which the target pixel belongs is used as the lower limit value of the chromaticity information value range of the target pixel.
[0037] In a second aspect, an embodiment of the present application provides a device for processing image color fringing, the device comprising:
[0038] An edge pixel point determination module is used to perform edge detection on a target image and determine edge pixel points in the target image;
[0039] a correction value determination module, configured to determine the color fringing transition region to which the edge pixel belongs; and determine a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region;
[0040] The color edge correction processing module is used to correct the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points.
[0041] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for processing image color fringes as described in the embodiment of the present application.
[0042] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for processing image color edges as described in the embodiment of the present application is implemented.
[0043] The technical solution provided in the embodiment of the present application performs edge detection on a target image to determine edge pixels in the target image; determines the color edge transition region to which the edge pixels belong; and determines a target color information correction value for the edge pixels based on the final sharpened color information of the edge pixels and the final sharpened color information of the reference pixels in the color edge transition region; and corrects the color information of the edge pixels based on the target color information correction value of the edge pixels. By adopting the technical solution provided in the present application, color edges can be processed by digital image processing, and the resulting processing results are accurate, the image is continuous, and the quality of the image is not affected. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 This is a flow chart of a method for processing image color fringes provided in an embodiment of the present application;
[0045] Figure 2 This is a flow chart of a method for processing image color fringes provided in an embodiment of the present application;
[0046] Figure 3 is a schematic diagram of image color edge processing provided by an embodiment of the present application;
[0047] Figure 4 is a schematic diagram of image color edge sharpening processing provided by an embodiment of the present application;
[0048] Figure 5 Schematic diagram of the structure of the image color edge processing device provided in an embodiment of the present application;
[0049] Figure 6 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are intended only to illustrate the present application and are not intended to limit the present application. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions of the present application, not all of the structures.
[0051] Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe the steps as sequential processes, many of the steps can be implemented in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0052] Figure 1 This is a flowchart of the method for processing image color fringing provided in an embodiment of the present application. This embodiment can be applied to situations where abnormal image color fringing affects image quality. The method can be executed by the image color fringing processing device provided in an embodiment of the present application. The device can be implemented by software and / or hardware and can be integrated into electronic devices such as smart terminals.
[0053] like Figure 1 As shown, the method for processing image color fringes includes:
[0054] S110 , performing edge detection on the target image to determine edge pixels in the target image.
[0055] The target image may be an image requiring color fringing processing. The input image may be a pre-processed image, or an image that has undergone color fringing sharpening processing may be used as the input image. Color fringing sharpening processing may narrow the transition region of the color fringing, thereby reducing the width of the color fringing and enhancing the rendering effect of the color fringing. Edge detection is performed on the target image. Specifically, edge detection models in different directions may be convolved with the target image to achieve edge detection in different directions. Edge pixel points in the target image can be obtained through edge detection.
[0056] Edge pixels can be points in an image where edge detection results meet preset criteria. They can also be points where the gradient value of each pixel is obtained through a convolution operation, and points where the gradient value meets preset criteria are identified as edge pixels. For example, a point with a gradient value greater than 50 can be identified as an edge pixel.
[0057] In this technical solution, the edge pixel points in the target image determined can be multi-directional. For example, if the edge detection of the target image is performed in two directions, or more directions, the edge pixel points in each direction can be obtained. For example, the edge pixel points in the first direction include point A, point B, and point C, and the edge pixel points in the second direction include point A, point D, and point E. This means that the same pixel point is an edge pixel point in two or more directions at the same time, such as point A in the above example. In this embodiment, for this situation, one of the directions can be taken for processing. Preferably, the multi-directional color edges of point A can be processed simultaneously.
[0058] S120. Determine the color edge transition area to which the edge pixel belongs; and determine the target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color edge transition area.
[0059] After determining the edge pixel points, the color fringing transition region of the edge pixel points can be determined. The color fringing transition region can be determined according to a direction perpendicular to the edge direction, or can be understood as the color change gradient direction of the edge pixel points, which is the direction of the color fringing transition region. After determining the direction, the boundary points of the color fringing transition region can be determined based on the chromaticity information of each pixel point or the amplitude of the chromaticity information change between each pixel point, with the edge pixel point as the center. After determining the color fringing boundary points, the target chromaticity information correction value of the edge pixel point can be determined based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color fringing transition region. The chromaticity information can be related to the grayscale value of the three primary colors of each pixel point. For example, the chromaticity information can include two chromaticity components, DR and DB, wherein the DR chromaticity component represents the difference between the R component and the G component of the three primary colors of the pixel point, and the DB chromaticity component represents the difference between the B component and the G component of the three primary colors of the pixel point.
[0060] It can be understood that the input image here is considered to be a sharpened image. Then, between the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area, the correction value of the edge pixel point can be determined by comparing the final sharpened chromaticity information of the edge pixel point with the final sharpened chromaticity information of the two boundary points. To illustrate with the DB chromaticity component, for example, the DB chromaticity components in the final sharpened chromaticity information of the two boundary points are 10 and 30 respectively. If the DB chromaticity component in the final sharpened chromaticity information of the edge pixel point is 20, then its own DB chromaticity component can be determined as the final correction value. If the DB chromaticity component of the edge pixel point is 5, then the smaller of the DB chromaticity components of the two boundary points is used as the final correction value of the edge pixel point, that is, 10. If the DB chromaticity component of the edge pixel point is 35, then the larger of the DB chromaticity components of the two boundary points is used as the final correction value of the edge pixel point, that is, 30.
[0061] S130 , correcting the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points.
[0062] After the target chromaticity information correction value of the edge pixel point is determined, the chromaticity information of the edge pixel point can be corrected.
[0063] In this embodiment, optionally, the chromaticity information of the edge pixel points is corrected according to the target chromaticity information correction value of the edge pixel points, including: determining the correction result of the G component in the three primary colors according to the target chromaticity information correction value of the edge pixel points and the brightness information of the edge pixel points; determining the correction result of the R component and the correction result of the B component in the three primary colors according to the correction result of the G component and the target chromaticity information correction value of the edge pixel points.
[0064] Specifically, the following formula can be used for calculation:
[0065]
[0066] Among them, derR(i,j) is the correction value of the DR chromaticity component in the target chromaticity information correction value, derB(i,j) is the correction value of the DB chromaticity component in the target chromaticity information correction value, outG(i,j) is the correction result of the G component in the three primary colors, outR(i,j) is the correction result of the R component in the three primary colors, and outB(i,j) is the correction result of the B component in the three primary colors.
[0067] The technical solution provided in the embodiment of the present application performs edge detection on a target image to determine edge pixels in the target image; determines the color edge transition region to which the edge pixels belong; and determines a target color information correction value for the edge pixels based on the final sharpened color information of the edge pixels and the final sharpened color information of the reference pixels in the color edge transition region; and corrects the color information of the edge pixels based on the target color information correction value of the edge pixels. By adopting the technical solution provided in the present application, color edges can be processed by digital image processing, and the resulting processing results are accurate, the image is continuous, and the quality of the image is not affected.
[0068] On the basis of the above technical solutions, optionally, the color fringing transition area to which the edge pixel point belongs is determined; and a target chromaticity information correction value of the edge pixel point is determined based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color fringing transition area, including: if the edge pixel point is an edge pixel point of the target image in one direction, the color fringing transition area of the edge pixel point in the direction is determined; and the target chromaticity information correction value of the edge pixel point is determined based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color fringing transition area; if the edge pixel point is an edge pixel point of the target image in at least two directions, the color fringing transition areas of the edge pixel point in at least two directions are determined; at least two chromaticity information correction values of the edge pixel point are determined based on the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel points in the at least two color fringing transition areas; and the target chromaticity information correction value of the edge pixel point is determined based on the at least two chromaticity information correction values of the edge pixel point.
[0069] If an edge pixel is an edge pixel in only one direction, the range of the color fringing transition region in that direction can be determined, and the target chromaticity information correction value for the edge pixel can be determined based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region. If an edge pixel is simultaneously an edge pixel in two or more color fringing transition regions, the chromaticity information correction value for each color fringing transition region can be calculated separately. The calculation method for the chromaticity information correction value can be the same as the above-mentioned scheme and will not be repeated here. After obtaining multiple chromaticity information correction values, one chromaticity information correction value can be determined as the target chromaticity information correction value. Specifically, the target chromaticity information correction value can be selected from the multiple chromaticity information correction values with the smallest absolute value. In addition, other methods can be used to determine the target chromaticity information correction value, such as using the median value to determine the target chromaticity information correction value among the multiple chromaticity information correction values. A weighted average method can be used for determination, and a specific weighting method can be used to set the weight based on the relationship between the correction value and the current sharpened chromaticity information of the edge pixel. The advantage of this configuration of the technical solution is that it can achieve more accurate determination of the chromaticity information correction value of the edge pixel points, thereby achieving the effect of improving the image color edge quality.
[0070] Based on the above technical solutions, the target chromaticity correction value for the edge pixel can optionally be determined based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region. This includes determining the target chromaticity correction value for the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the boundary points in the color fringing transition region; or determining the target chromaticity correction value for the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of a preset number of reference points in the color fringing transition region. Alternatively, a preset number of pixels in the color fringing transition region can be used as reference points. For example, four reference points can be used, one on each side of the edge pixel, and weights can be assigned to each reference point. The weights can be determined based on the distance between the reference point and the edge pixel. Alternatively, the weights can be determined based on the chromaticity information of the reference point, with the smaller the absolute chromaticity value, the greater the weight. This configuration has the advantage of reducing the chromaticity value of the color fringing point. Distance weighting and chromaticity weighting can also be combined. The advantage of this setting is that it can improve the consistency of color transition in the gradient direction of pixels in the entire color edge area.
[0071] Based on the above technical solutions, optionally, determining the color fringing transition region of the edge pixel in at least two directions includes: determining the edge gradient direction based on the G component of the three primary colors of the edge pixel; setting at least two detection points along the edge gradient direction, the at least two detection points being arranged on either side of the edge pixel; and identifying whether the detection points meet preset boundary conditions from the edge pixel to either side. If so, determining the detection point as a boundary point of the color fringing transition region. The edge gradient direction can be determined based on the G component, and further, the width of the color fringing transition region can be determined by setting detection points along the edge gradient direction. Specifically, based on the preset boundary conditions, each detection point can be sequentially detected from the edge pixel to either side. If the first point that meets the preset boundary conditions is found, the point can be determined as a boundary point. Alternatively, if two consecutive detection points meet the preset boundary conditions, the first of the two consecutive detection points is determined as a boundary point. This configuration improves the accuracy of determining the edge region to which the edge pixel belongs, thereby improving image quality.
[0072] Figure 2 This is a flowchart of the image color edge processing method provided by the embodiment of the present application. The image color edge processing method provided by this solution can achieve the color edge sharpening effect of suppressing the ringing effect. This solution can be used as the sharpening processing process of the input image in the above solution and can be performed before the implementation steps of the above solution. Specifically, Figure 2 As shown, the method for processing image color fringes includes:
[0073] S210 , performing filtering processing on the initial chromaticity information of the target pixel in the target image to determine a high-frequency component of the chromaticity information of the target pixel.
[0074] In this embodiment, the target image in the above scheme can be subjected to color fringing determination. Specifically, the strength of the edge details can be identified. If the edge is strong, it indicates that it has been sharpened and can be directly processed in the above scheme. If it has not been sharpened, the color fringing sharpening process of this scheme can be used. Alternatively, it can be directly used as the input image for the above scheme. However, direct input will result in the image color fringing processing not achieving the highest quality effect. Therefore, the target image can optionally be subjected to the sharpening step in this scheme.
[0075] The target pixel can be any pixel in the target image, and the initial chromaticity information can be chromaticity information directly extracted from the target image. The initial chromaticity information of the target pixel can be filtered to obtain a high-frequency component of the chromaticity information of the target pixel. In this embodiment, the chromaticity information of the target image can optionally be subjected to Gaussian smoothing filtering and Laplacian filtering to obtain the high-frequency component of the target pixel.
[0076] S220 , performing sharpening processing on the target pixel according to the high-frequency component of the chromaticity information of the target pixel to obtain preliminary sharpened chromaticity information of the target pixel.
[0077] After obtaining the high-frequency component of the chromaticity information of the target pixel, the chromaticity information of the target pixel may be sharpened using the high-frequency component of the chromaticity information of the target pixel to obtain preliminary sharpened chromaticity information of the target pixel. The obtained sharpening result may be related to a sharpening parameter, which may be a sharpening gain applicable to most images obtained through statistical methods or other means.
[0078] In this technical solution, the target pixel is optionally sharpened based on the high-frequency component of the chromaticity information of the target pixel to obtain preliminary sharpened chromaticity information of the target pixel, including: multiplying the high-frequency component of the chromaticity information of the target pixel by a preset sharpening gain to determine the sharpening amplitude of the target pixel; and taking the sum of the initial chromaticity information of the target pixel and the sharpening amplitude of the target pixel as the preliminary sharpened chromaticity information of the target pixel. The advantage of this setting is that the sharpening result can be controlled based on the sharpening gain, and the objective sharpening result can be determined for each pixel, avoiding the situation where the sharpening result is inaccurate due to subjective factors.
[0079] S230 , determining final sharpened chromaticity information of the target pixel according to the preliminary sharpened chromaticity information of the target pixel and the initial chromaticity information of the neighboring pixels of the target pixel.
[0080] After determining the preliminary sharpening result, the final sharpened chromaticity information of the target pixel can be determined by comparing the preliminary sharpened chromaticity information with the initial chromaticity information of the neighborhood pixel points of the target pixel point. The neighborhood pixel points of the target pixel point can be the pixels within the area composed of 3×3 pixels or the area composed of 5×5 pixels centered on the target pixel point. Since the neighborhood pixel points have their own initial chromaticity information, the optional range of the final sharpened chromaticity information of the target pixel point can be determined based on the range of the initial chromaticity information of the neighborhood pixel points, and then the final sharpened chromaticity information can be determined.
[0081] In this technical solution, the final sharpened chromaticity information of the target pixel is optionally determined based on the preliminary sharpened chromaticity information of the target pixel and the image chromaticity information of the target pixel's neighboring pixels, including: determining a chromaticity information value range of the target pixel based on the chromaticity information of the neighboring pixels in the reference area to which the target pixel belongs; and determining the final sharpened chromaticity information of the target pixel based on the preliminary sharpened chromaticity information of the target pixel and the chromaticity information value range. By using the initial chromaticity information of the neighboring pixels as a constraint condition, the sharpened color edge can achieve the effect of suppressing the ring effect.
[0082] Based on the above technical solution, optionally, the chromaticity information value range of the target pixel is determined based on the chromaticity information of the neighboring pixels in the reference area to which the target pixel belongs, including: using the maximum chromaticity value of the neighboring pixels in the reference area to which the target pixel belongs as the upper limit of the chromaticity information value range of the target pixel; using the minimum chromaticity value of the neighboring pixels in the reference area to which the target pixel belongs as the lower limit of the chromaticity information value range of the target pixel. By setting the upper and lower limits of the value range, this technical solution can effectively avoid the ring effect caused by color edge sharpening and improve the quality of color edge sharpening processing.
[0083] Based on the above technical solutions, this technical solution provides a color edge sharpening method. By adopting this sharpening method, the ring effect can be avoided while sharpening the color edge, thereby improving the image processing effect.
[0084] In order to enable those skilled in the art to more accurately understand the technical solution provided by this application, this application also provides a preferred implementation.
[0085] The ringing effect, also known as the ringing effect, refers to the loss of high-frequency information during image processing, making it difficult to restore it later. This phenomenon manifests as oscillations in the high-frequency portion of the output image, similar to the vibrations in the air caused by the striking of a bell. The ringing phenomenon caused by sharpening is primarily due to the continuous overlay of high-frequency information during edge enhancement, causing oscillations at the edges. While a moderate ringing effect can help highlight image edges, it can interfere with subsequent image processing modules.
[0086] Figure 3It is a schematic diagram of the image color edge processing provided by the embodiment of the present application. The present invention provides a method for eliminating the pseudo-color edge of an image, which mainly includes three parts: chroma image sharpening, multi-directional color edge transition area detection and pseudo-color edge correction. First, by using a sharpening algorithm that suppresses the ring effect to optimize the edge of the chroma image, the blurring effect of positional chromatic aberration on the pseudo-color edge is reduced, and the width of the pseudo-color edge is reduced. Then, through parallel processing of multi-directional pseudo-color edge transition area detection, the pseudo-color edge correction value of the corresponding direction is obtained, and finally the final correction value of the pseudo-color edge point is determined according to the brightness of the center point and the correction values of multiple directions. The specific process is as follows Figure 3 As shown, in order to improve the running speed, the detection module can be simplified to the pseudo-color edge transition area detection in both horizontal and vertical directions.
[0087] The first step is to extract luminance and chrominance information. The chrominance information is sharpened to suppress the ring effect, optimize the image chrominance edge, improve the edge clarity, and reduce the blurring effect of positional chromatic aberration on the color edge. Among them, the luminance information Y and the chrominance information DR and DB can be obtained according to formula (1).
[0088]
[0089] Suppresses the ring effect of sharpening by limiting the sharpened values to not exceed the local maximum and minimum values. The sharpening algorithm is not specifically restricted. Figure 4 This is a schematic diagram of image color edge sharpening processing provided in an embodiment of the present application.
[0090] The specific process is to extract the high-frequency component I of the image through Gaussian smoothing filtering and Laplace filtering. det , corresponding to formulas (2) and (3) respectively. Where D represents the two chrominance components DR and DB, and Gaussian smoothing filtering and Laplace filtering are performed on the two chrominance components DR and DB respectively. base It represents the result of Gaussian smoothing filtering of the two chrominance components DR and DB. det Indicates I base The high-frequency component of the chrominance information is obtained through Laplace filtering.
[0091]
[0092]
[0093] Then, the chroma images DR and DB are filtered for maximum and minimum values within the neighborhood. The specific operation is: with the target pixel as the center point, the pixels within a certain radius of the neighborhood are sorted, and the maximum value I of the original image chroma (DR and DB are calculated separately) in the neighborhood is obtained. max and minimum value I min, then assign the maximum (minimum) value to the center pixel to obtain the corresponding maximum (minimum) filtering result. In this embodiment, the neighborhood radius is set to 3×3. The sharpening operation is completed using formula (4), where Gain is the sharpening gain, which controls the intensity of the high-frequency increase.
[0094] I shrp =D+Gain·I det ; (4)
[0095] Finally passed I max and I min Limit I shrp The final sharpening value that suppresses the ring effect is obtained by adjusting the value of
[0096]
[0097] The second step is multi-directional pseudo-color edge region detection, which mainly includes the following steps:
[0098] 1. Edge direction detection, using edge points that meet edge detection conditions as target points.
[0099] 2. Centered on the target point, the corresponding pseudo-color edge transition region is expanded according to the edge gradient direction. Pseudo-color edge points do not exist singly, but rather appear as a gradient within a specific region. Pixels within the pseudo-color edge transition region must have at least one color component that changes, and the rate of change must meet certain requirements.
[0100] The present invention provides a preferred embodiment, the specific steps are:
[0101] 1. Directional edge detection: There are many implementation schemes, such as LOG edge detection operator, Robert edge detection operator, Canny edge detection operator, etc. In this embodiment, a preferred scheme is provided, which first uses low-frequency filtering to remove noise, and then calculates the high-frequency components of each channel (the high-frequency component calculation can use Sobel filter operator, Laplace filter operator, Robert filter operator, etc., which is not limited in this article). Take the maximum value of the high-frequency components of the R, G, and B channels, and then perform threshold processing. Pixels greater than the preset threshold are regarded as edge points. The low-frequency components in this embodiment are obtained by Gaussian filtering, and the method is the same as shown in formula (2). The high-frequency components are obtained by Sobel directional filtering operator, such as extracting the high-frequency components in the vertical direction, as shown in formula (6). Where C represents the result of the three color components R, G, and B after Gaussian filtering, and i and j represent the horizontal and vertical coordinates corresponding to the image respectively.
[0102] E C(i,j)=C(i-1,j-1)+2C(i,j-1)+C(i+1,j-1)-C(i-1,j+1)-2C(i,j+1)-C(i+1,j+1); (6)
[0103] 10% of the maximum high-frequency value of each channel in the vertical direction is set as the vertical edge threshold T1, that is, the pixel points with high-frequency component values greater than T1 are vertical edge points.
[0104] The edge point obtained in the previous step is used as the target point. With the target point as the center, the detection point is determined to be within the color edge transition area according to certain prior conditions along the edge gradient direction to obtain the color edge transition area corresponding to the target point. In this embodiment, considering that the green component accounts for a large proportion of the brightness component and the lens is focused on the green component, the direction of the brightness change of the edge is determined by the gradient direction of the green component. Therefore, only when the color change of the detection point and the sign product of the green component of the center point are greater than a certain chromaticity threshold can it be determined as a pseudo-color edge transition area. Among them, the advantage of using the boundary point of the color edge transition area as a reference point is that it can effectively avoid the ringing effect and improve the color mark processing effect. Among them, the change direction s(P) of the green component is represented by the sign of the high-frequency component of the G channel of the center point.
[0105]
[0106] H(X|P) represents the maximum value of the product of the high-frequency values of the R, G, and B components of the detection point X and s(P), as shown in formula (8):
[0107] H(X|P)=max(s(P)E C (X)); (8)
[0108] Take the vertical edge pseudo-color edge transition area detection as an example to explain in detail: Assume that point P is the detected vertical edge point, the corresponding coordinates in the image are (i, j), and the corresponding gradient direction is the horizontal direction. With point P as the center, detect to the right along the horizontal direction, and the coordinates corresponding to the first detection point X are (i, j+1). In this implementation, the chroma threshold T2 is set to 20% of the edge threshold T1. When H(x|p)≥T2, it means that the detection point at this time is located in the color edge transition area. The detection point X moves one pixel to the right and continues the conditional judgment until H(X|P)<T2. The coordinates (i, j+k) corresponding to the detection point X at this time are the coordinates of the right boundary point n of the transition area corresponding to point P. Similarly, the coordinates of the left boundary point m of the transition area corresponding to point P are obtained. At the same time, it is necessary to set N as the threshold to limit the range of the transition area to ensure k≤N, and the value is usually 10.
[0109] According to the chromaticity value of the boundary point, the reasonable range of chromaticity change in the pseudo-color edge transition area in the corresponding direction is obtained. Taking the vertical direction as an example, the chromaticity range in the transition interval is DR ZoneMin ~DR ZoneMax and DB ZoneMin ~DB ZoneMax ;
[0110]
[0111]
[0112] In this embodiment, the correction value in the direction corresponding to the center point is obtained by limiting the chromaticity of the center point to the chromaticity values of the boundary points of the transition interval. For example, the center point correction values cfR2 and cfB2 corresponding to the vertical edge are shown in formulas (11) and (12):
[0113]
[0114]
[0115] The third step is to correct the false color edge points. Based on the multiple directional color edge correction values obtained in step 2, the one with the smallest absolute chromaticity value is selected as the final chromaticity correction value. The number of directions is not limited. Taking two directions as an example, if the absolute value of the chromaticity correction value in the vertical direction is less than the absolute value of the chromaticity correction value in the horizontal direction, then the chromaticity correction value in the vertical direction is taken as the final chromaticity correction value, as shown in equations (13) and (14). Among them, cfR1 and cfB1 represent the correction values in the horizontal edge direction, and cfR2 and cfB2 represent the correction values in the vertical edge direction.
[0116]
[0117]
[0118] Finally, according to the final chromaticity correction value and the brightness information of the original image, the corresponding RGB value of the image is corrected, while the color of the color edge is corrected without changing the original brightness value.
[0119]
[0120] The technical solution provided in this embodiment includes a sharpening algorithm that suppresses the ring effect; parallel processing of multi-directional pseudo-color edge transition region detection to obtain pseudo-color edge correction values corresponding to multiple directions; combining the color edge correction values corresponding to multiple directions to obtain a final chromaticity correction value; and finally, correcting the color of the pseudo-color edge point by combining the color edge correction value and the brightness information of the center point. Furthermore, parallel processing of multi-directional pseudo-color edge region detection detects pseudo-color edges based on the difference between pseudo-color edges and normal edges. This includes using a directional edge detection operator to obtain high-frequency components in the corresponding direction, taking the maximum value of the high frequency of each channel, and then performing edge thresholding processing. Pixels greater than a preset threshold are defined as edge points. The edge point is used as the target point. With the target point as the center, the corresponding color edge transition region is detected along the gradient direction, and the chromaticity correction value of the center point in each direction is obtained.
[0121] By adopting this technical solution, we fully consider the chromaticity information of surrounding points, achieving greater scene adaptability. The corrected pseudo-color edge image transitions are more natural, enhancing visual perception. Furthermore, pseudo-color edges are detected based on the differences between color edges and normal edges. First, a directional filter operator is used to extract high-frequency components. A reasonable threshold is set to filter out central points with significant brightness or chromaticity changes. Then, along the edge gradient, the extent of the pseudo-color edge transition region is determined based on the brightness variation pattern. This results in a more comprehensive and reasonable correction, resulting in a more accurate pseudo-color edge region.
[0122] Figure 5 Schematic diagram of the structure of the image color edge processing device provided in the embodiment of the present application. Figure 5 As shown, the image color edge processing device includes:
[0123] The edge pixel point determination module 510 is used to perform edge detection on the target image and determine the edge pixel points in the target image;
[0124] Correction value determination module 520 is configured to determine the color fringing transition region to which the edge pixel belongs; and determine a target chromaticity information correction value for the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region;
[0125] The color edge correction processing module 530 is configured to correct the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points.
[0126] The technical solution provided in the embodiment of the present application performs edge detection on a target image to determine edge pixels in the target image; determines the color edge transition region to which the edge pixels belong; and determines a target color information correction value for the edge pixels based on the final sharpened color information of the edge pixels and the final sharpened color information of the reference pixels in the color edge transition region; and corrects the color information of the edge pixels based on the target color information correction value of the edge pixels. By adopting the technical solution provided in the present application, color edges can be processed by digital image processing, and the resulting processing results are accurate, the image is continuous, and the quality of the image is not affected.
[0127] The above-mentioned product can execute the method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method.
[0128] An embodiment of the present application further provides a storage medium containing computer-executable instructions. When the computer-executable instructions are executed by a computer processor, the computer-executable instructions are used to perform a method for processing image color fringing. The method includes:
[0129] Perform edge detection on the target image to determine the edge pixel points in the target image;
[0130] Determining a color fringing transition region to which the edge pixel belongs; and determining a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region;
[0131] The chromaticity information of the edge pixel point is corrected according to the target chromaticity information correction value of the edge pixel point.
[0132] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROMs, floppy disks, or tape drives; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disks or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the computer system in which the program is executed, or may be located in a different second computer system that is connected to the computer system via a network (such as the Internet). The second computer system may provide program instructions to the computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations (e.g., in different computer systems connected via a network). The storage medium may store program instructions (e.g., embodied as a computer program) that can be executed by one or more processors.
[0133] Of course, the storage medium containing computer-executable instructions provided in an embodiment of the present application, whose computer-executable instructions are not limited to the image color edge processing operations described above, can also execute related operations in the image color edge processing method provided in any embodiment of the present application.
[0134] An embodiment of the present application provides an electronic device, in which the image color fringing processing device provided by the embodiment of the present application can be integrated. Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 As shown, this embodiment provides an electronic device 600, which includes: one or more processors 620; a storage device 610 for storing one or more programs. When the one or more programs are executed by the one or more processors 620, the one or more processors 620 implement the image color fringing processing method provided in the embodiment of the application. The method includes:
[0135] Perform edge detection on the target image to determine the edge pixel points in the target image;
[0136] Determining a color fringing transition region to which the edge pixel belongs; and determining a target chromaticity information correction value of the edge pixel based on the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of the reference pixel in the color fringing transition region;
[0137] The chromaticity information of the edge pixel point is corrected according to the target chromaticity information correction value of the edge pixel point.
[0138] Of course, those skilled in the art will appreciate that the processor 620 also implements the technical solution of the image color edge processing method provided in any embodiment of the present application.
[0139] Figure 6 The electronic device 600 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.
[0140] like Figure 6 As shown, the electronic device 600 includes a processor 620, a storage device 610, an input device 630, and an output device 640; the number of processors 620 in the electronic device can be one or more. Figure 6 In the figure, a processor 620 is used as an example; the processor 620, the storage device 610, the input device 630 and the output device 640 in the electronic device can be connected via a bus or other means. Figure 6 The connection via bus 650 is taken as an example.
[0141] The storage device 610 is a computer-readable storage medium that can be used to store software programs, computer executable programs, and module units, such as program instructions corresponding to the image color edge processing method in the embodiment of the present application.
[0142] The storage device 610 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data generated based on the use of the terminal, etc. Furthermore, the storage device 610 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state memory device. In some instances, the storage device 610 may further include memory remotely located relative to the processor 620, and such remote memory may be connected via a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0143] The input device 630 may be used to receive input numbers, character information or voice information, and generate key signal input related to user settings and function control of the electronic device. The output device 640 may include a display screen, a speaker and other devices.
[0144] The electronic device provided in the embodiment of the present application can process color fringes through digital image processing, and the obtained processing results are accurate, the picture is continuous, and it can be ensured that the quality of the picture is not affected.
[0145] The image color fringing processing apparatus, storage medium, and electronic device provided in the above embodiments can implement the image color fringing processing method provided in any embodiment of the present application, and possess the corresponding functional modules and beneficial effects of executing the method. For technical details not fully described in the above embodiments, please refer to the image color fringing processing method provided in any embodiment of the present application.
[0146] Note that the above are only preferred embodiments of the present application and the technical principles employed. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present application. The scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for processing image color fringes, characterized in that: include: Perform edge detection on the target image to determine the edge pixel points in the target image; Determine the color edge transition area to which the edge pixel belongs; And, determining a target chromaticity information correction value of the edge pixel point according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area; Correcting the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points; The color edge transition area is an area determined by the color change gradient direction of the edge pixel point as the direction of the color edge transition area, extending to both sides with the edge pixel point as the center, and the chromaticity information of each pixel point or the chromaticity information change amplitude between each pixel point as the boundary point determination condition of the color edge transition area; Among them, the edge detection of the target image includes: using edge detection models in different directions to perform convolution processing with the target image to achieve edge detection in different directions; the edge pixel points are points where the edge detection results meet preset conditions.
2. The method according to claim 1, characterized in that Determine the color edge transition area to which the edge pixel belongs; And, according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area, determining the target chromaticity information correction value of the edge pixel point, including: If the edge pixel point is an edge pixel point of the target image in a direction, a color edge transition area of the edge pixel point in the direction is determined; and a target chromaticity information correction value of the edge pixel point is determined according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area; If the edge pixel point is an edge pixel point of the target image in at least two directions, determining a color edge transition area of the edge pixel point in at least two directions; Determine at least two chromaticity information correction values of the edge pixel point according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel points in at least two color edge transition areas; A target chromaticity information correction value of the edge pixel point is determined according to at least two chromaticity information correction values of the edge pixel point.
3. The method according to claim 2, characterized in that According to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area, the target chromaticity information correction value of the edge pixel point is determined, including: Determine a target chromaticity information correction value of the edge pixel point according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the boundary point of the color edge transition area; or, The target chromaticity information correction value of the edge pixel is determined according to the final sharpened chromaticity information of the edge pixel and the final sharpened chromaticity information of a preset number of reference points in the color edge transition area.
4. The method according to claim 2, characterized in that: Determining the color edge transition area of the edge pixel point in at least two directions includes: Determine the edge gradient direction according to the G component of the three primary colors of the edge pixel; In the edge gradient direction, at least two detection points are set, and the at least two detection points are respectively arranged on both sides of the edge pixel point; From the edge pixel point to both sides, it is respectively identified whether the detection point meets the preset boundary conditions. If so, it is determined that the detection point is a boundary point of the color edge transition area.
5. The method according to claim 1, characterized in that Correcting the chromaticity information of the edge pixel points according to the target chromaticity information correction value of the edge pixel points includes: Determine a correction result of the G component in the three primary colors according to the target chromaticity information correction value of the edge pixel point and the brightness information of the edge pixel point; According to the correction result of the G component and the target chromaticity information correction value of the edge pixel point, the correction result of the R component and the correction result of the B component in the three primary colors are determined.
6. The method according to claim 1, characterized in that Before performing edge detection on the target image to determine edge pixel points in the target image, the method further includes: Filtering the initial chromaticity information of the target pixel in the target image to determine the high-frequency component of the chromaticity information of the target pixel; Sharpening the chromaticity information of the target pixel point according to the high-frequency component of the chromaticity information of the target pixel point to obtain preliminary sharpened chromaticity information of the target pixel point; The final sharpened chromaticity information of the target pixel is determined according to the preliminary sharpened chromaticity information of the target pixel and the initial chromaticity information of the neighboring pixels of the target pixel.
7. The method according to claim 6, characterized in that Sharpening the target pixel according to the high-frequency component of the chromaticity information of the target pixel to obtain preliminary sharpened chromaticity information of the target pixel, including: The product of the high-frequency component of the chromaticity information of the target pixel and the preset sharpening gain is determined as the sharpening amplitude of the target pixel; The sum of the initial chromaticity information of the target pixel and the sharpening amplitude of the target pixel is used as the preliminary sharpened chromaticity information of the target pixel.
8. The method according to claim 6, characterized in that Determining final sharpening chromaticity information of the target pixel point according to preliminary sharpening chromaticity information of the target pixel point and image chromaticity information of neighboring pixels of the target pixel point includes: Determine the value range of the chromaticity information of the target pixel point according to the chromaticity information of the neighboring pixels in the reference area to which the target pixel point belongs; The final sharpened chromaticity information of the target pixel is determined according to the preliminary sharpened chromaticity information of the target pixel and the value range of the chromaticity information.
9. The method according to claim 8, characterized in that According to the chromaticity information of the neighboring pixels in the reference area to which the target pixel belongs, the value range of the chromaticity information of the target pixel is determined, including: The maximum neighboring pixel chromaticity value in the reference area to which the target pixel belongs is used as the upper limit value in the chromaticity information value range of the target pixel; The minimum chromaticity value of a neighboring pixel in the reference area to which the target pixel belongs is used as the lower limit value of the chromaticity information value range of the target pixel.
10. A device for processing color fringes of an image, characterized in that: include: An edge pixel point determination module is used to perform edge detection on a target image and determine edge pixel points in the target image; A correction value determination module is used to determine the color edge transition area to which the edge pixel point belongs; And, determining a target chromaticity information correction value of the edge pixel point according to the final sharpened chromaticity information of the edge pixel point and the final sharpened chromaticity information of the reference pixel point in the color edge transition area; A color edge correction processing module, used to correct the chromaticity information of edge pixels according to the target chromaticity information correction value of the edge pixels; The color edge transition area is an area determined by the color change gradient direction of the edge pixel point as the direction of the color edge transition area, extending to both sides with the edge pixel point as the center, and the chromaticity information of each pixel point or the chromaticity information change amplitude between each pixel point as the boundary point determination condition of the color edge transition area; Among them, the edge detection of the target image includes: using edge detection models in different directions to perform convolution processing with the target image to achieve edge detection in different directions; the edge pixel points are points where the edge detection results meet preset conditions.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for processing image color fringes as described in any one of claims 1 to 9 is implemented.
12. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for processing image color fringes according to any one of claims 1 to 9 is implemented.
