Image pseudo color removing method and device, electronic equipment and storage medium

By calculating the pseudo-color removal weight of the demosaic image and performing low-pass filtering and saturation reduction processing, combined with weight fusion technology, the image quality decline caused by the pseudo-color phenomenon is solved and the visual quality is improved.

CN119831853APending Publication Date: 2025-04-15HUNAN GOKE MICROELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411812464.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The existing technology often experiences pseudo-color phenomena during the demosaic process, resulting in a decline in the visual quality of the image, especially in high-frequency detail areas, which has become a challenge for image demosaic technology.

Method used

By obtaining the image after demosaic processing, calculating its color edge and saturation to obtain the pseudo-color weight, and low-pass filtering and desaturation processing on the image, and finally obtaining the target image based on the image after the weight fusion process and the original image.

Benefits of technology

Effectively remove the pseudo-color phenomenon, while avoiding unnecessary processing of non-pseudo-color areas, improving the overall visual quality of the image and solving the problems of overall image saturation reduction and color edge diffusion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119831853A_ABST
    Figure CN119831853A_ABST
Patent Text Reader

Abstract

The invention discloses an image pseudo color removing method and device, electronic equipment and a storage medium, and relates to the technical field of image processing, and the method comprises the steps: obtaining a demosaiced first image; determining a pseudo-color removal weight of the first image, wherein the pseudo-color removal weight is obtained by calculating a color edge and saturation of the first image; processing the first image to obtain a second image, wherein the processing is used for reducing a high-frequency color component in the first image; and fusing the first image and the second image based on the pseudo-color removal weight to obtain a target image. By implementing the technical scheme provided by the invention, unnecessary processing on a non-pseudo-color region can be avoided, so that the problems of reduction of the overall saturation of the image and color edge diffusion in the prior art are solved, and the overall visual quality of the image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image color removal method, device, electronic device, and storage medium. Background Art

[0002] With the widespread application of digital image processing technology, image demosaicing has become an important research field. However, pseudo-color phenomenon often occurs in the demosaicing process. This phenomenon manifests as unnatural color spots or stripes in the image, which seriously affects the visual quality of the image and the subsequent processing effect. Especially in the high-frequency detail area, the pseudo-color phenomenon is more obvious, which has become a major challenge faced by image demosaicing technology.

[0003] At present, the common method of removing pseudo-color is to directly perform low-pass filtering on the demosaiced image. This method can reduce the pseudo-color performance to a certain extent by applying a low-pass filter to the entire image, thereby improving the image quality.

[0004] However, this simple low-pass filtering method has obvious limitations. Although it can reduce pseudo-color to a certain extent, it will also have a negative impact on other areas of the image, mainly manifested in the reduction of overall image saturation and color edge diffusion, thereby reducing the overall visual quality of the image. Summary of the invention

[0005] The present invention provides an image pseudo-color removal method, device, electronic device, and storage medium, which can remove pseudo-color while avoiding unnecessary processing of non-pseudo-color areas, thereby overcoming the problems of reduced overall image saturation and color edge diffusion in the prior art and improving the overall visual quality of the image.

[0006] In a first aspect of the present invention, a method for removing false color from an image is provided, comprising: Acquire a first image after demosaicing; Determining a color aliasing weight of the first image, wherein the color aliasing weight is calculated based on a color edge and a saturation of the first image; Processing the first image to obtain a second image, wherein the processing is used to reduce high-frequency color components in the first image; The first image and the second image are fused based on the anti-aliasing weight to obtain a target image.

[0007] In a second aspect of the present invention, there is provided an image color aliasing removal device, comprising: An image acquisition module, used for acquiring the first image after demosaicing; A color aliasing weight determination module, used to determine the color aliasing weight of the first image, wherein the color aliasing weight is calculated based on the color edge and saturation of the first image; An image preprocessing module, used for processing the first image to obtain a second image, wherein the processing is used to reduce high-frequency color components in the first image; An image processing module is used to fuse the first image and the second image based on the anti-aliasing weight to obtain a target image.

[0008] In a third aspect of the present invention, an electronic device is provided, 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 image de-aliasing method described above is implemented.

[0009] In a fourth aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the image aliasing removal method as described above is implemented.

[0010] In summary, one or more technical solutions provided in the present invention have at least the following technical effects or advantages: By obtaining the first image after mosaicking and combining the color edge and saturation to calculate the pseudo-color removal weight, the pseudo-color area is accurately located. At the same time, the first image is processed to obtain the second image with reduced high-frequency color components, and the first image and the second image are fused based on the pseudo-color removal weight, so that the processing result of the second image is mainly used in the pseudo-color area to remove the pseudo-color, while the original information of the first image is retained in the non-pseudo-color area.

[0011] Compared with the method of directly low-pass filtering the entire image in the prior art, the above-mentioned weight-based fusion strategy can not only effectively remove pseudo-color, but also avoid unnecessary processing of non-pseudo-color areas, thereby overcoming the problems of reduced overall image saturation and color edge diffusion in the prior art, and improving the overall visual quality of the image. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0013] Figure 1 The present invention is a flowchart of a method for removing false color from an image provided by an embodiment of the present invention.

[0014] Figure 2 The present invention is a schematic diagram of the structure of an image pseudo-color removal device provided by an embodiment of the present invention.

[0015] Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0016] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0017] Please refer to Figure 1 , Figure 1 The present invention provides a flowchart of a method for removing color artifacts from an image provided by an embodiment of the present invention. The method can be implemented by a computer program, can be implemented by a single-chip microcomputer, or can be run on an image color artifact removal system based on a von Neumann system. The computer program can be integrated into an application or run as an independent tool application. Specifically, the method can include the following steps: S101, obtaining a first image after demosaicing.

[0018] Specifically, before performing image pseudo-color removal processing, it is first necessary to obtain a first image that has been de-mosaiced. In the embodiment of the present invention, the first image can be understood as a digital image that has been processed by a certain de-mosaic algorithm, because the de-mosaic algorithm is difficult to accurately determine the edge direction information of the image in these areas, and thus an inappropriate interpolation method is used, resulting in the possibility of pseudo-color phenomenon in the first image. This pseudo-color phenomenon is usually manifested as unnatural color spots or stripes appearing in high-frequency areas of the image, such as edges or areas with complex textures. The first image can be an RGB image or a YUV image. If the image pseudo-color removal of the present application is processed in the YUV domain and the first image is an RGB image, the RGB image needs to be converted into a YUV image; if the image pseudo-color removal of the present application is processed in the RGB domain and the first image is a YUV image, the YUV image needs to be converted into an RGB image.

[0019] After obtaining the first image, if it is processed in the YUV domain and the input is an RGB format image, it needs to be converted to the YUV format. This is because in the YUV color space, the Y channel represents brightness information, the UV channel represents chromaticity information, and pseudo-color is mainly reflected in the color information. Therefore, processing in the YUV color space can more effectively remove pseudo-color operations.

[0020] Specifically, the RGB image can be converted into a YUV image through a color space conversion matrix, where Y represents the brightness component, U and V represent the chromaticity components, and each pixel has corresponding Y, U, and V three channel values, ranging from 0 to 255. After the first image is converted into the YUV format, only the UV channel data needs to be subsequently processed, so that pseudo-color removal can be achieved without affecting the image brightness information. The first image obtained in the above manner can provide a suitable data basis for subsequent pseudo-color area detection and processing, which is conducive to accurately identifying and removing pseudo-color phenomena in the image.

[0021] S102: Determine a color aliasing weight of the first image, where the color aliasing weight is calculated based on the color edge and saturation of the first image.

[0022] Specifically, after acquiring the first image, it is necessary to determine the color removal weights of each area in the first image to achieve accurate positioning and processing of the pseudo-color area. The color removal weight refers to a numerical indicator used to measure the severity of the pseudo-color phenomenon in each area of ​​the image, which can be understood as the intensity coefficient of the color removal processing required for each pixel. The larger the weight value, the more likely it is that the pseudo-color phenomenon exists in the area, and a stronger degree of color removal processing is required; conversely, the smaller the weight value, the more likely it is that the area is a true color detail in the image and should be retained. The color removal weight is used to adaptively adjust the fusion ratio of the original image data and the preprocessing results in the subsequent image processing process, so as to achieve accurate processing of the pseudo-color area.

[0023] In a feasible implementation, the anti-aliasing weight is calculated by the color edge and saturation of the first image. This is because the anti-aliasing phenomenon usually appears as unnatural color mutations in the high-frequency edge areas of the image, and these areas are often accompanied by abnormal color saturation. Therefore, combining color edge detection and saturation detection can more accurately identify the area that needs to be processed for anti-aliasing.

[0024] Specifically, the process may further include the following steps: S201. Determine the color edge of each pixel in a first image to obtain a first pixel.

[0025] Specifically, after obtaining the UV channel data of the first image, the color edge of each pixel needs to be detected to obtain the first pixel. Because the pseudo color phenomenon is often most obvious in the high-frequency edge area of ​​the image, the area where pseudo color may exist can be preliminarily located by detecting the color edge.

[0026] Specifically, for each pixel in the first image, edge detection is performed on the U channel and the V channel respectively. First, a The size of the window is 3, 5, 7, 9, etc. The choice of window size will affect the accuracy and computational efficiency of color edge detection. In this window, the mean of the window pixel values ​​is first calculated, and then the square of the difference between each pixel value in the window and the mean is calculated, and these square differences are averaged to obtain the variance value as the color edge detection result of the pixel under this chromaticity channel. After performing the same processing on the U channel and the V channel respectively, the variance values ​​of the two channels are added to obtain the final color edge detection result of the pixel as the value of the first pixel.

[0027] S202: Determine the saturation of each pixel in the first image to obtain a second pixel.

[0028] Specifically, in order to further improve the accuracy of pseudo-color region detection, it is necessary to determine the saturation of each pixel in the first image to obtain the second pixel. Because pseudo-color regions not only show color edge abnormalities, but are also often accompanied by unnatural saturation changes, detecting saturation can provide another important basis for identifying pseudo-color regions.

[0029] Specifically, for each pixel in the first image, saturation detection is performed on the U channel and the V channel respectively. First, a window of a preset size is taken around each pixel, and the mean of the U channel and the V channel is calculated in the window. Then, the absolute difference between the two means and the median is calculated and summed to obtain the saturation value of the pixel. After performing the same process on all pixels, the second pixel is obtained.

[0030] For example, assume that the values ​​of each pixel in the U and V channels are U(x,y) and V(x,y); for each pixel (x,y), take the value of the surrounding pixel. The set of pixels in the window is recorded as W(x,y).

[0031] For the pixels in the window, the mean values ​​of the U channel and the V channel are calculated respectively, which can be expressed as: The saturation value of the pixel can be expressed as: S ; In the formula, Indicates the number of pixels in the window, and Respectively represent the U and V channel values ​​of each pixel in the window, and 128 is the median value of the UV channel.

[0032] The second pixel point obtained in the above manner can effectively reflect the saturation characteristics of each area in the image, and its value indicates whether the area is a low-saturation area. This saturation detection method based on local statistical characteristics can accurately identify low-saturation areas in the image that may contain pseudo-color.

[0033] S203: Determine a color aliasing weight of each pixel in the first image based on each first pixel and each second pixel.

[0034] Specifically, for each pixel position in the first image, the first pixel value corresponding to the position is multiplied by the second pixel value, and normalized to obtain the color aliasing weight of the position. This calculation method ensures that only in areas with obvious color edge features and low saturation features, a larger color aliasing weight is obtained. On the contrary, if a region only exhibits a single feature, or both features are not obvious, a smaller color aliasing weight will be obtained.

[0035] Through the above-mentioned weight calculation method based on dual features, the area that really needs to be processed for pseudo-color removal can be more accurately identified. The calculated pseudo-color removal weight not only reflects the possibility of pseudo-color phenomenon in the area, but also represents the intensity of pseudo-color removal processing required.

[0036] Based on the above embodiment, as an optional embodiment, in S203: the step of determining the color aliasing weight of each pixel in the first image based on each first pixel and each second pixel may further include the following steps: S301. Perform color edge detection on the first image based on a pixel value of a first pixel in the first image to obtain a color edge detection result.

[0037] Specifically, after obtaining each first pixel point, it is necessary to perform color edge detection on the first image to obtain a color edge detection result. Color edge detection is an important basis for identifying pseudo-color areas, because pseudo-color phenomena usually appear as abnormal color mutations in the edge areas of images.

[0038] In a feasible implementation, a color edge detection threshold needs to be preset first, and the value range of the color edge detection threshold is 0 to 255. The selection of the color edge detection threshold needs to be determined according to the specific characteristics of the image: when the noise level of the image is high, a larger threshold can be selected to reduce the false detection rate; when the image noise is small, a smaller threshold can be selected to improve the detection sensitivity. In practical applications, the color edge detection threshold is usually selected between 0 and 100, so that a good balance can be achieved between detection accuracy and robustness.

[0039] Specifically, for each first pixel in the first image, its current color edge detection result is compared with a preset color edge detection threshold. If the color edge detection result of the pixel is greater than the color edge detection threshold, the original color edge detection result is retained, indicating that there may be a pseudo-color edge that needs to be processed; conversely, if the color edge detection result is less than or equal to the color edge detection threshold, the color edge detection result at that location is set to 0, indicating that the edge feature at that location is not significant and may be a normal image detail. Through this threshold-based judgment method, the significant edge area in the image can be preliminarily screened out.

[0040] The color edge detection result obtained after the above processing actually constitutes a color edge detection result map with the same size as the original image, in which the value of each pixel position represents whether there is an edge feature that needs to be processed for color aliasing. This threshold-based edge detection method not only retains significant edge information, but also effectively suppresses the interference of noise and weak edges.

[0041] It is worth noting that the accuracy of color edge detection results directly affects the final pseudo-color removal effect. If the threshold is set too low, normal image details may be misjudged as pseudo-color edges that need to be processed; if the threshold is set too high, some pseudo-color areas that need to be processed may be missed. Therefore, in practical applications, the color edge detection threshold can be adjusted to optimize the detection effect according to specific image features and processing requirements.

[0042] S302. Based on the saturation of the second pixel in the first image, perform low saturation detection on the first image to obtain a low saturation detection result.

[0043] Specifically, after obtaining the color edge detection result, it is also necessary to perform low saturation detection on the first image. Because in the pseudo-color area, there are not only abnormal edge features, but also often accompanied by unnatural saturation changes. By introducing low saturation detection, another important judgment basis can be provided for the identification of pseudo-color areas, thereby improving the accuracy of detection.

[0044] In a feasible implementation, firstly, a low saturation detection threshold needs to be pre-set, and the low saturation detection threshold also takes values ​​in the range of 0 to 255. For each second pixel in the first image, its saturation value is compared with the low saturation detection threshold. If the saturation value of the current pixel is greater than the low saturation detection threshold, it means that the place has a higher saturation and does not meet the characteristics of the pseudo-color area. At this time, the saturation detection result of the place is set to 0; conversely, if the saturation value is less than or equal to the low saturation detection threshold, it means that there may be a pseudo-color phenomenon at this place. At this time, the saturation detection result of the place is set to 255 minus the current saturation value. The above processing method actually constructs a reverse saturation response, so that the lower the saturation area, the higher the response value.

[0045] The low saturation detection result obtained through the above processing also forms a response map with the same size as the original image. Each pixel value in the response map reflects whether the corresponding position is a low saturation area. The larger the value, the more likely it is that the area needs to be de-aliased. The above threshold-based low saturation detection method can effectively identify low saturation areas in the image that may have pseudo colors, while avoiding unnecessary processing of normal high saturation areas.

[0046] S303: Locate the pseudo-color region of the first image based on the color edge detection result and the low-saturation detection result.

[0047] Specifically, after obtaining the color edge detection result and the low saturation detection result, the two detection results need to be combined to jointly locate the pseudo-color area in the first image.

[0048] Specifically, for each pixel position in the first image, the color edge detection result corresponding to the position is multiplied by the low saturation detection result and then normalized to obtain the fusion weight. The product operation is used here instead of a simple weighted average because the pseudo-color area usually needs to satisfy both edge anomaly and low saturation. Through the product operation, it can be ensured that only when the two features are significant at the same time, the area will be determined as a pseudo-color area. And the normalization is performed by dividing by 255 squares in order to control the final positioning result within a reasonable numerical range for subsequent processing.

[0049] After the above processing, the pseudo-color area positioning result can actually be understood as a weight map, in which the value of each pixel position represents whether it is a pseudo-color area and the severity of the pseudo-color phenomenon. The larger the weight value, the more likely it is that the area is a pseudo-color area, and a stronger degree of pseudo-color removal processing is required; the smaller the weight value, the more likely it is that the area is a normal area in the image and should be retained. This weight-based positioning method can not only indicate the location of the pseudo-color area, but also provide an intensity reference for subsequent pseudo-color removal processing.

[0050] S304: Determine a color aliasing weight of each pixel in the first image based on all first pixels and second pixels in the pseudo-color area of ​​the first image.

[0051] After completing the basic positioning of the pseudo-color area, in order to further improve the accuracy of the pseudo-color removal process, the embodiment of the present invention provides two optional weight optimization schemes. The purpose of these two schemes is to achieve more refined processing control in the identified pseudo-color area, but different technical paths are used.

[0052] In a feasible implementation, the pseudo-color removal weight can be calculated in the located pseudo-color region. Specifically, for each pixel in the pseudo-color region, the color edge and saturation distribution characteristics in its local window are considered to calculate the weight value of this point. The above-mentioned method pays more attention to the accurate description of local features, and by carrying out a more meticulous feature analysis inside the pseudo-color region, a weight distribution that is more in line with actual needs can be obtained. For example, even in the same pseudo-color region, the pixel near the edge may need a larger weight value to fully remove the pseudo-color, and the pixel away from the edge may need a smaller weight value to better retain image details.

[0053] In another feasible implementation, the calculated pseudo-color removal weight may be adjusted a second time. Specifically, the pseudo-color area is used as a modulation factor to correct the initial pseudo-color weight. The initial pseudo-color weight may be the pseudo-color removal weight determined in S203.

[0054] The above method retains the continuity feature in the original weight calculation, and the local optimization of the weight is achieved by introducing regional information. For example, the weight can be appropriately enlarged or reduced according to the position relationship of the pixel point in the pseudo-color area, so that the final processing intensity is more in line with actual needs.

[0055] S103: Process the first image to obtain a second image, where the processing is used to reduce high-frequency color components in the first image.

[0056] Among them, processing refers to a signal processing method that improves image quality by adaptively adjusting different frequency components in an image. In the embodiment of the present invention, it can be understood as a selective processing operation based on a local window on the chromaticity information of the first image, which is used to reduce the high-frequency color component that may cause pseudo-color. The high-frequency color component refers to the part of the chromaticity channel of the image where the adjacent pixel values ​​change dramatically. This rapid color change is often closely related to the pseudo-color phenomenon.

[0057] In a feasible implementation, the processing may include low-pass filtering and desaturation processing. Because the pseudo-color phenomenon is usually manifested as abnormal mutations of local colors and unnatural high-frequency changes, low-pass filtering can effectively suppress such high-frequency changes, and desaturation can further reduce abnormal color performance. Through the combination of the above two processing, the high-frequency color components that cause pseudo-color can be more comprehensively reduced.

[0058] Based on the above embodiment, as an optional embodiment, in S103: the step of processing the first image to obtain the second image may further include the following steps: S401: Divide the first image into multiple windows.

[0059] Specifically, when processing the first image to obtain the second image, the first image needs to be divided into multiple windows. Because the pseudo-color phenomenon usually manifests as color anomalies in a local area, local adaptive processing of the image can be achieved through window division, so that subsequent filtering and desaturation operations can better adapt to the image characteristics of different areas, and filtering and desaturation operations are performed on each pixel in the first image on the U channel and the V channel respectively.

[0060] In a feasible implementation, the first image can be divided by using a sliding window. Specifically, a sliding window of size A square window of size S, where S can be 3, 5, 7, 9, etc. In practical applications, a smaller odd number is usually selected as the window size, which can ensure that the window has a unique center point and guarantee the locality of processing.

[0061] For each pixel of the first image, it is used as the center of the window, and (S-1) / 2 pixels are expanded in all directions to form a complete processing window. When the window exceeds the image boundary, the boundary pixel filling method can be used for processing. This pixel-based sliding window division method ensures that each pixel in the image can obtain complete local area support, providing sufficient local information for subsequent processing. At the same time, since each pixel participates in the calculation as the window center, the continuity of the processing result can be guaranteed to avoid block artifacts.

[0062] Through the above window division method, the first image is divided into a series of overlapping local areas. This division method provides a good local calculation basis for the subsequent low-pass filtering and desaturation processing, so that the processing can be adaptively adjusted according to the specific features in each window, thereby better protecting the local structural features of the image while reducing the high-frequency color components.

[0063] S402, determining the center point of each window, and performing the low-pass filtering process on the pixel points in the window whose difference value is less than the corresponding threshold, wherein the difference value is the difference between the pixel point in the window and the center point.

[0064] Specifically, after completing the window division of the first image, each window needs to be subjected to selective low-pass filtering based on the center point. The high-frequency color component is reduced by counting the pixel values ​​in the local area, and the smoothing across the real edge is avoided by judging the difference value, so as to better protect the image structure while suppressing pseudo-color.

[0065] In a feasible implementation, it is first necessary to determine the center point of each window. Since a square window of a preset size is used and the side length of the window is an odd number, each window has a unique geometric center point. For each pixel point in the first image, it is used as the center point of the current processing window, and the pixel value of the point is recorded as a reference value. This pixel-centered processing method can ensure the continuity of the result.

[0066] After determining the center point, a filter threshold needs to be set in advance, with a value range of 0 to 255. The filter threshold is used to determine whether the pixel points in the window should participate in the low-pass filter calculation.

[0067] Specifically, for each pixel in the window, the difference between it and the center point is calculated, that is, the absolute difference between the pixel value and the center point pixel value. When the difference value is less than or equal to the filtering threshold, it indicates that the pixel and the center point have similar color characteristics, and the pixel is included in the average calculation; conversely, when the difference value is greater than the filtering threshold, it indicates that the pixel may be on the other side of the color edge, and it is excluded from the average calculation.

[0068] After traversing all the pixels in the window, the average value of the pixels involved in the calculation is used as the filtering result of the center point.

[0069] Specifically, the initial value of the accumulated value is set to zero, and the initial value of the counter is set to zero. When a pixel point in the window satisfies that the difference between its value and the center point pixel value is less than or equal to the filtering threshold, the center point pixel value is added to the accumulated value, and the counter is incremented by one. After the traversal is completed, the quotient of the accumulated value divided by the counter is calculated as the final filtering result. This accumulation method based on the center point value rather than the actual pixel value can achieve better noise reduction while maintaining edge sharpness.

[0070] Exemplarily, the gap value calculation can be expressed as: In the formula, The input image at pixel The value of The value of the center pixel of the window of preset size; The accumulation and counter update can be expressed as: ; In the formula, Indicated in pixels Centered window; is the filtering threshold, Indicates the accumulated value of the accumulator. Indicates the count value of the counter.

[0071] The filtering result can be expressed as: ; is the pixel value after filtering.

[0072] For example, for any pixel point, filtering is performed under the U channel and the V channel in the above manner to obtain the filtering value of the pixel point under the U channel. And the filtering value under V channel .

[0073] Through the above low-pass filtering process, pixels in the window with colors close to the center point will participate in the average calculation, while pixels with large color differences from the center point will be excluded. This can effectively reduce the high-frequency color components in the image while avoiding excessive smoothing at the real edge. The choice of filtering threshold directly affects the intensity of the processing: a larger threshold will cause more pixels to participate in the calculation, resulting in a stronger smoothing effect; a smaller threshold will retain more details, but may reduce the effect of removing pseudo-color.

[0074] In practical applications, the value of the filter threshold can be adjusted according to the specific characteristics of the image and processing requirements, so as to achieve a better balance between the anti-aliasing effect and detail retention.

[0075] S403: Perform the desaturation processing on the first image after the low-pass filtering processing to obtain the second image.

[0076] Specifically, for each pixel point in the first image after filtering, filtering and desaturation operations are performed on the U channel and the V channel respectively, that is, after completing the low-pass filtering, and After that, it is necessary to perform desaturation processing to obtain the second image. Because low-pass filtering alone may not completely eliminate the pseudo-color phenomenon, and appropriately reducing the color saturation of the image can further suppress pseudo-color and obtain a cleaner preprocessing result. At the same time, desaturation processing can reduce the color noise that may exist in the image.

[0077] In a feasible implementation, a desaturation intensity parameter needs to be preset first, with a value range of 0 to 1. The parameter is used to control the degree of desaturation processing, and a larger value indicates a stronger degree of desaturation. For the first image after low-pass filtering, its chrominance component needs to be desaturated.

[0078] Specifically, for each pixel point in the image after filtering, its chroma value is linearly interpolated toward the chroma median according to the set desaturation intensity parameter.

[0079] Exemplarily, the U channel desaturation can be expressed as: ; In the formula, is the U channel value after low-pass filtering, is the desaturation intensity parameter.

[0080] The V channel desaturation can be expressed as: ; In the formula, is the V channel value after low-pass filtering, and 128 is the preset chroma median value.

[0081] The above desaturation processing method based on linear interpolation can achieve smooth adjustment of saturation through a gradual transition to the chromaticity median, avoiding abrupt color changes in the processed result. Secondly, when the desaturation intensity parameter is zero, the original color remains unchanged; when the parameter is 1, the image is completely converted to grayscale. This continuously adjustable feature makes the processing intensity easier to control. In addition, since the processing is performed in the chromaticity space, the brightness information of the image will not be affected, thereby maintaining the overall brightness structure of the image.

[0082] In practical applications, the desaturation intensity parameter can be adjusted to balance the de-aliasing effect and the degree of color retention, thereby obtaining a processing effect that better meets specific needs.

[0083] It should be noted that desaturation processing is a further optimization of the low-pass filtering result. Low-pass filtering mainly acts on local high-frequency color changes, while desaturation adjusts color intensity from an overall perspective. The combination of these two processing can more comprehensively reduce various factors that cause pseudo-color, thereby providing a better pre-processing basis for subsequent image fusion.

[0084] S104: Fusing the first image and the second image based on the anti-aliasing weight to obtain a target image.

[0085] Specifically, after obtaining the de-aliasing weights and the second image, the first image and the second image need to be fused to obtain the target image. This weight-based fusion method can achieve adaptive de-aliasing processing for different regions, which can effectively remove abnormal colors in the pseudo-color area and better retain the true color details of the non-pseudo-color area.

[0086] Based on the above embodiment, as an optional embodiment, in S104: the step of fusing the first image and the second image based on the anti-aliasing weight to obtain the target image may further include the following steps: S501 , fusing a first image and a second image based on a dealiasing weight to obtain an intermediate target image.

[0087] In a feasible implementation manner, it is necessary to perform fusion processing on the UV channel data of the first image and the second image respectively, because the pseudo-color phenomenon is mainly reflected in the chromaticity information.

[0088] Specifically, for each pixel in the image, the U channel value of the corresponding position in the second image (that is, the U channel value of the pixel at the corresponding position in the second image obtained by low-pass filtering and desaturation operation on the first image) is multiplied by the de-aliasing weight of the point, and then the U channel value of the corresponding position in the first image is multiplied by 1 minus the difference of the pseudo-color weight, and finally the two are added to obtain the U channel value of the intermediate target image; the V channel data is processed in the same way, the V channel value of the corresponding position in the second image is multiplied by the de-aliasing weight of the point, and then the V channel value of the corresponding position in the first image is multiplied by 1 minus the difference of the pseudo-color weight, and finally the two are added to obtain the V channel value of the intermediate target image.

[0089] Exemplarily, the U channel fusion process can be expressed as: The V channel fusion process can be expressed as: In the formula, They represent the U channel value and the V channel value of the first image, that is, the pixel value of the first image after demosaicing, They represent the U channel value and V channel value of the corresponding pixel point in the second image, that is, the U channel value and V channel value of the pixel point at the corresponding position in the second image obtained by low-pass filtering and desaturation operation of the first image. is the weight for removing aliasing, Represent the U and V channel values ​​of the intermediate target image respectively.

[0090] This weight-based linear fusion method ensures that the processing result of the second image is mainly used in the pseudo-color area, while the original information of the first image is mainly retained in the non-pseudo-color area.

[0091] S502: Based on the saturation of the corresponding pixel in the first image, correct the saturation of each pixel in the intermediate target image to obtain the target image.

[0092] Specifically, after obtaining the intermediate target image, it is necessary to perform saturation correction on the intermediate target image based on the saturation of the corresponding pixel points in the first image to obtain the final target image. Because in the weight-based fusion process, color diffusion may occur in some areas, especially in the edge areas of the image, this diffusion will cause unnatural color penetration in the processed image, affecting the final visual effect.

[0093] In a feasible implementation, it is first necessary to calculate the saturation of each pixel in the intermediate target image and the first image.

[0094] Specifically, for each pixel in the image, its saturation value can be represented by the absolute difference between the U channel value of the point and the chromaticity median 128, and the sum of the absolute difference between the V channel value and the chromaticity median 128. The above saturation calculation method directly reflects the color intensity of the pixel, which is conducive to accurately identifying areas where color diffusion may exist. The saturation of each pixel in the intermediate target image and the first image is obtained in the above manner.

[0095] Through the above saturation correction processing, the target image obtained can effectively avoid the edge diffusion problem. When the color intensity of some areas is abnormally enhanced due to the anti-aliasing processing, by restoring the color information of these areas to the original value, it can be ensured that the final processing result will not have the phenomenon of excessive diffusion.

[0096] Based on the above embodiment, as an optional embodiment, in S502: based on the saturation of the corresponding pixel in the first image, the step of correcting the saturation of each pixel in the intermediate target image to obtain the target image may further include the following steps: The saturation of each intermediate target pixel in the intermediate target image and the saturation of each pixel in the first image are obtained. If the saturation of the intermediate target pixel is greater than the saturation of the corresponding pixel in the first image, the saturation of the intermediate target pixel is adjusted to the saturation of the corresponding pixel in the first image, and the adjusted intermediate target image is used as the target image; if the saturation of the intermediate target pixel is not greater than the saturation of the corresponding pixel in the first image, the saturation value of the intermediate target pixel is kept unchanged, and the adjusted intermediate target image is used as the target image.

[0097] Specifically, after obtaining the intermediate target image, it is necessary to obtain the saturation of each pixel in the intermediate target image and the first image and make comparative adjustments to solve the possible edge diffusion problem. Because in the early weight fusion process, some areas may have excessive color diffusion due to the calculation error of the anti-aliasing weight, which will cause unnatural color penetration in the edge and other areas of the processed image.

[0098] After the saturation adjustment is completed, the brightness information of the first image needs to be combined with the processed chromaticity information to obtain the final target image. Specifically, since the pseudo-color removal processing of the present invention only optimizes the chromaticity information of the image, the brightness component of the original image is directly retained, and it is combined with the chromaticity component after the saturation adjustment to obtain the target image after pseudo-color removal. This processing method not only ensures that the detail clarity of the image is not affected, but also effectively removes the pseudo-color phenomenon, so that the target image finally output has a better visual effect.

[0099] If the final output requires an image in RGB format, the target image in YUV format can be converted to RGB format through a standard color space conversion matrix and then output.

[0100] Exemplarily, the first image saturation can be expressed as: ; The intermediate target image saturation can be expressed as: .

[0101] In a feasible implementation, it is first necessary to calculate the saturation of each pixel in the intermediate target image and the first image respectively.

[0102] Specifically, after obtaining the saturation data of the two images, it is necessary to compare and adjust the saturation pixel by pixel: when it is found that the saturation value of a certain intermediate target pixel in the intermediate target image is greater than the saturation value of the pixel at the corresponding position in the first image, it indicates that color diffusion may have occurred there, and at this time, the UV channel value of the intermediate target pixel needs to be adjusted to the UV channel value of the corresponding position in the first image; conversely, if the saturation value of the intermediate target pixel is not greater than the saturation value of the pixel at the corresponding position in the first image, the UV channel value of the intermediate target pixel remains unchanged. Finally, the intermediate target image after saturation adjustment is output as the final target image.

[0103] Through the above-mentioned processing method based on saturation comparison and adjustment, the target image can well avoid the edge diffusion problem. The essence of the above process is to build a protection mechanism based on the saturation of the original image. When it is detected that the color saturation of a certain area is abnormally enhanced, its color information is restored to the original value to ensure that the processing result will not be over-diffused.

[0104] It should be noted that the introduction of this adjustment mechanism not only improves the robustness of the de-aliasing algorithm, enabling it to maintain good processing results even when there are errors in the calculation of de-aliasing weights, but also effectively ensures the naturalness of the final image by keeping the saturation after processing no higher than the original value, thus avoiding artifacts caused by over-processing.

[0105] Please refer to Figure 2 , Figure 2 An image color aliasing device provided in an embodiment of the present invention includes: An image acquisition module, used for acquiring the first image after demosaicing; A color aliasing weight determination module, used to determine the color aliasing weight of the first image, wherein the color aliasing weight is calculated based on the color edge and saturation of the first image; An image preprocessing module, used for processing the first image to obtain a second image, wherein the processing is used to reduce high-frequency color components in the first image; An image processing module is used to fuse the first image and the second image based on the anti-aliasing weight to obtain a target image.

[0106] Based on the above embodiments, as an optional embodiment, the de-aliasing weight determination module is also used to determine the color edge of each pixel in the first image to obtain a first pixel; determine the saturation of each pixel in the first image to obtain a second pixel; and determine the de-aliasing weight of each pixel in the first image based on each first pixel and each second pixel.

[0107] On the basis of the above embodiments, as an optional embodiment, the de-aliasing weight determination module is also used to perform color edge detection on the first image based on the pixel value of the first pixel in the first image to obtain a color edge detection result; perform low saturation detection on the first image based on the saturation of the second pixel in the first image to obtain a low saturation detection result; locate the pseudo-color area of ​​the first image based on the color edge detection result and the low saturation detection result; determine the de-aliasing weight of each pixel in the first image based on all the first pixel and second pixel points in the pseudo-color area of ​​the first image.

[0108] On the basis of the above embodiment, as an optional embodiment, the image preprocessing module is also used to divide the first image into multiple windows; determine the center point of each window, and perform the low-pass filtering processing on the pixel points in the window whose difference value is less than the corresponding threshold, and the difference value is the difference between the pixel point in the window and the center point; perform the desaturation processing on the first image after the low-pass filtering processing to obtain the second image.

[0109] Based on the above embodiment, as an optional embodiment, the image processing module is also used to fuse the first image and the second image based on the de-aliasing weight to obtain an intermediate target image; based on the saturation of the corresponding pixel in the first image, the saturation of each pixel in the intermediate target image is corrected to obtain the target image.

[0110] On the basis of the above embodiment, as an optional embodiment, the image processing module is also used to obtain the saturation of each intermediate target pixel in the intermediate target image and the saturation of each pixel in the first image. If the saturation of the intermediate target pixel is greater than the saturation of the corresponding pixel in the first image, the saturation of the intermediate target pixel is adjusted to the saturation of the corresponding pixel in the first image, and the adjusted intermediate target image is used as the target image.

[0111] Please refer to Figure 3 , Figure 3 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention is shown. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the image de-aliasing method.

[0112] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0113] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the image de-aliasing method provided by the above methods.

[0114] In yet another aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the image aliasing removal method provided by the above methods is implemented.

[0115] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0117] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for removing false colors from an image, characterized in that: include: Acquire a first image after demosaicing; Determining a color aliasing weight of the first image, wherein the color aliasing weight is calculated based on a color edge and a saturation of the first image; Processing the first image to obtain a second image, wherein the processing is used to reduce high-frequency color components in the first image; The first image and the second image are fused based on the anti-aliasing weight to obtain a target image.

2. The image color removal method according to claim 1, characterized in that: The step of determining a color aliasing weight of the first image includes: Determine the color edge of each pixel in the first image to obtain a first pixel; Determine the saturation of each pixel in the first image to obtain a second pixel; Based on each of the first pixels and each of the second pixels, a color aliasing weight of each pixel in the first image is determined.

3. The image color removal method according to claim 2, characterized in that: The step of determining the color aliasing weight of each pixel in the first image based on each of the first pixel and each of the second pixel includes: Based on the pixel value of the first pixel point in the first image, performing color edge detection on the first image to obtain a color edge detection result; Based on the saturation of a second pixel in the first image, performing low saturation detection on the first image to obtain a low saturation detection result; Based on the color edge detection result and the low saturation detection result, locate the pseudo color area of ​​the first image; Based on all first pixels and second pixels in the pseudo-color area of ​​the first image, a pseudo-color removal weight of each pixel in the first image is determined.

4. The image color removal method according to claim 1, characterized in that: The processing includes low-pass filtering and desaturation processing.

5. The image color removal method according to claim 4, characterized in that: The step of processing the first image to obtain a second image includes: dividing the first image into a plurality of windows; Determine the center point of each window, and perform the low-pass filtering process on the pixel points in the window whose difference value is less than the corresponding threshold, where the difference value is the difference between the pixel point in the window and the center point; The desaturation process is performed on the first image after the low-pass filtering process to obtain the second image.

6. The image color removal method according to claim 1, characterized in that: The fusing the first image and the second image based on the anti-aliasing weight to obtain a target image includes: Based on the anti-aliasing weight, the first image and the second image are fused to obtain an intermediate target image; Based on the saturation of the corresponding pixel in the first image, the saturation of each pixel in the intermediate target image is corrected to obtain the target image.

7. The image color removal method according to claim 6, characterized in that: The step of correcting the saturation of each pixel in the intermediate target image based on the saturation of the corresponding pixel in the first image to obtain the target image includes: Obtain the saturation of each intermediate target pixel in the intermediate target image and the saturation of each pixel in the first image. If the saturation of the intermediate target pixel is greater than the saturation of the corresponding pixel in the first image, adjust the saturation of the intermediate target pixel to the saturation of the corresponding pixel in the first image, and use the adjusted intermediate target image as the target image.

8. An image color removal device, characterized in that: include: An image acquisition module, used for acquiring the first image after demosaicing; A color aliasing weight determination module, used to determine the color aliasing weight of the first image, wherein the color aliasing weight is calculated based on the color edge and saturation of the first image; An image preprocessing module, used for processing the first image to obtain a second image, wherein the processing is used to reduce high-frequency color components in the first image; An image processing module is used to fuse the first image and the second image based on the anti-aliasing weight to obtain a target image.

9. 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 image anti-aliasing method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image anti-aliasing method according to any one of claims 1 to 7 is implemented.