Method and device for removing image color noise

By calculating the gradient and brightness of the pixel points of the image in the cache window, judging the texture area, and performing filtering processing to remove color noise, the problem of difficulty in removing color noise in the prior art is solved, and the effect of effectively removing noise while retaining texture details is achieved.

CN119603561APending Publication Date: 2025-03-11CHENGDU LIGHT COLLECTOR TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411904546.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

During the image signal processing, it is difficult for existing imaging devices to effectively remove color noise while retaining image texture details, especially when the image sensor performance is poor or the photography environment is dark, affecting image quality.

Method used

By calculating the gradient and average brightness of the current pixel point in the cache window, and calculating the gradient of the central pixel point in the adjacent neighboring window, we can judge whether there is a texture in the area where the current pixel point is located. According to the judgment result, filtering is performed in the cache window where the current pixel point is located to remove color noise.

Benefits of technology

Effectively distinguish between flat areas and texture areas, filter only flat areas, remove color noise, preserve image texture details, and improve image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119603561A_ABST
    Figure CN119603561A_ABST
Patent Text Reader

Abstract

The invention provides a method and a device for removing color noise of an image. The method comprises the following steps: acquiring an RGB (Red, Green and Blue) image; the gradient of the current pixel point and the average brightness of the cache window where the current pixel point is located are calculated in the cache window, and the gradient of the center pixel point is calculated in the adjacent window; judging whether texture exists in the region where the current pixel point is located or not; according to a judgment result, filtering processing is carried out in a cache window where the current pixel point is located so as to remove color noise; and outputting the RGB image after the color noise is removed. The gradient in the RGB image and the average brightness of the cache window are calculated, whether the texture exists in the area where the current pixel point is located is judged by means of the gradient and the brightness, a flat area and a texture area can be effectively distinguished, and therefore only the flat area can be filtered, color noise can be removed, and the image quality can be improved. The color noise of the flat area is effectively removed while the texture details of the image are reserved, and the problem of how to effectively remove the color noise of the image while the texture details of the image are reserved is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and device for removing image color noise. Background Art

[0002] Current imaging devices, such as cameras, usually use a single image sensor with a filter for cost considerations. After the image sensor captures the image, the ISP system is used to process the captured image, and finally outputs an RGB color image. ISP (Image Signal Processing) usually includes linear error correction, denoising, bad pixel removal, white balance, color correction, tone mapping, de-mosaicing, etc.

[0003] However, in the process of image signal processing by the ISP system, there are multiple processes that will affect the accuracy of image color restoration, such as tone mapping, demosaicing, automatic white balance, etc. When the image sensor performance is not enough or the shooting environment is relatively dark, color noise is likely to appear on the color image processed by the ISP, which seriously affects the quality of the final output color image. Therefore, it is necessary to remove the color noise to ensure that the image color is clear and accurate, the texture details are not destroyed, and the viewing experience is good. Summary of the invention

[0004] The purpose of the present invention is to provide a method and device for removing image color noise, so as to solve the problem of how to effectively remove image color noise while retaining image texture details.

[0005] In order to solve the above technical problems, the present invention provides a method for removing color noise from an image, comprising: Get RGB image; In the cache window, the gradient of the current pixel and the average brightness of the cache window where the current pixel is located are calculated, and in the adjacent window adjacent to the cache window, the gradient of the central pixel is calculated; According to the gradient and brightness of the current pixel in the cache window and the gradient of the central pixel of the adjacent window, it is determined whether there is a texture in the area where the current pixel is located; According to the texture judgment result, filtering is performed in the cache window where the current pixel is located to remove color noise; Output the RGB image after removing color noise.

[0006] Optionally, in the method for removing color noise from an image, the method of calculating the gradient of the current pixel and the average brightness of the cache window where the current pixel is located in the cache window, and calculating the gradient of the central pixel in a neighboring window adjacent to the cache window includes: Extracting a cache window and a neighboring window, wherein the current pixel is located in the middle row and middle column of the cache window, and the neighboring window and the cache window have at least one pixel overlapped; In the cache window, the G channel horizontal gradient and the G channel vertical gradient of the current pixel are calculated based on the G channel; Calculate the average brightness within the cache window based on the G channel; In the cache window, based on the GR color difference and the GB color difference, the GR color difference horizontal gradient, the GR color difference vertical gradient, the GR color difference diagonal gradient, the GR color difference anti-diagonal gradient, the GB color difference horizontal gradient, the GB color difference vertical gradient, the GB color difference diagonal gradient, and the GB color difference anti-diagonal gradient of the current pixel are calculated respectively; Within the 8 neighboring windows where the current pixel is located, the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window are calculated based on GR color difference and GB color difference.

[0007] Optionally, in the image color noise removal method, the method of calculating the G channel horizontal gradient and the G channel vertical gradient of the current pixel point based on the G channel in the cache window includes: The G channel horizontal gradient of the current pixel is calculated by using the G channel value of the pixel in the same row as the current pixel in the cache window and the G channel value of the current pixel; The G channel vertical gradient of the current pixel is calculated using the G channel value of the pixel in the same column as the current pixel in the cache window and the G channel value of the current pixel.

[0008] Optionally, in the method for removing image color noise, the method for calculating the average brightness in the cache window based on the G channel includes: Calculate the average G channel value of the eight pixels adjacent to the current pixel to obtain the average brightness.

[0009] Optionally, in the method for removing color noise from an image, the method for respectively calculating the GR color difference horizontal gradient, the GR color difference vertical gradient, the GR color difference diagonal gradient, the GR color difference anti-diagonal gradient, the GB color difference horizontal gradient, the GB color difference vertical gradient, the GB color difference diagonal gradient, and the GB color difference anti-diagonal gradient of the current pixel point in the cache window based on the GR color difference and the GB color difference includes: The GR color difference value of the pixel in the same row as the current pixel and the GR color difference value of the current pixel in the cache window are used to calculate the GR color difference horizontal gradient of the current pixel, and the GB color difference value of the pixel in the same row as the current pixel and the GB color difference value of the current pixel are used to calculate the GB color difference horizontal gradient of the current pixel; The GR color difference value of the pixel in the same column as the current pixel and the GR color difference value of the current pixel in the cache window are used to calculate the GR color difference vertical gradient of the current pixel, and the GB color difference value of the pixel in the same column as the current pixel and the GB color difference value of the current pixel are used to calculate the GB color difference vertical gradient of the current pixel; The GR color difference diagonal gradient of the current pixel is calculated by using the GR color difference value of the pixel on the same diagonal as the current pixel and the GR color difference value of the current pixel in the cache window, and the GB color difference diagonal gradient of the current pixel is calculated by using the GB color difference value of the pixel on the same diagonal as the current pixel and the GB color difference value of the current pixel; The GR color difference value of the pixel point that is diagonally opposite to the current pixel point in the cache window and the GR color difference value of the current pixel point are used to calculate the GR color difference anti-diagonal gradient of the current pixel point, and the GB color difference value of the pixel point that is diagonally opposite to the current pixel point and the GB color difference value of the current pixel point are used to calculate the GB color difference anti-diagonal gradient of the current pixel point.

[0010] Optionally, in the method for removing image color noise, the size of the neighboring window is consistent with the size of the cache window; and a manner of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window based on GR color difference and GB color difference in the neighboring window is consistent with a manner of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the current pixel point based on GR color difference and GB color difference in the cache window.

[0011] Optionally, in the method for removing color noise from an image, the method for determining whether there is a texture in the area where the current pixel is located based on the gradient and brightness of the current pixel in the cache window and the gradient of the central pixel of the adjacent window includes: If the larger value of the G channel horizontal gradient and the G channel vertical gradient of the current pixel is greater than the first multiple of the average brightness, it is determined that the current pixel meets the first judgment condition; The second judgment condition is: if the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference horizontal gradient, then in the two adjacent windows in the vertical direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference horizontal gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference horizontal gradient, then in the two adjacent windows in the vertical direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference horizontal gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference vertical gradient, then in the two adjacent windows in the horizontal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference vertical gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference vertical gradient, then in the two adjacent windows in the horizontal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference vertical gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference diagonal gradient, then in the two neighboring windows in the anti-diagonal direction, if the maximum GR color difference gradient in any one of the neighboring windows is the GR color difference diagonal gradient, and the maximum GR color difference gradient in the neighboring window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference diagonal gradient, then in the two neighboring windows in the anti-diagonal direction, if the maximum GB color difference gradient in any one of the neighboring windows is the GB color difference diagonal gradient, and the maximum GB color difference gradient in the neighboring window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference anti-diagonal gradient, then in the two adjacent windows in the diagonal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference anti-diagonal gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference anti-diagonal gradient, then in the two adjacent windows in the diagonal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference anti-diagonal gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the current pixel point satisfies both the first judgment condition and the second judgment condition, it is determined that there is texture in the area where the current pixel point is located.

[0012] Optionally, in the method for removing color noise from an image, the method for removing color noise by performing filtering within the cache window where the current pixel is located according to the texture judgment result includes: If it is determined that there is texture in the area where the current pixel is located, no filtering is performed; If it is determined that there is no texture in the area where the current pixel is located, filtering processing is performed based on GR color difference and GB color difference in the cache window where the current pixel is located to remove color noise.

[0013] Optionally, in the method for removing color noise from an image, the method for outputting an RGB image after color noise removal includes: If the current pixel is not filtered, its original RGB value is retained; If the current pixel is filtered, the GR color difference value and GB color difference value after filtering are subtracted from the original G channel value to obtain the R channel value and B channel value after filtering, and the original G channel value and the R channel value and B channel value after filtering are combined to obtain the RGB value.

[0014] In order to solve the above technical problems, the present invention also provides a device for removing image color noise, comprising a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the method for removing image color noise as described in any one of the above items is executed.

[0015] The method and device for removing color noise of an image provided by the present invention include: obtaining an RGB image; calculating the gradient of the current pixel point and the average brightness of the cache window where the current pixel point is located in a cache window, and calculating the gradient of the central pixel point in an adjacent window adjacent to the cache window; judging whether there is a texture in the area where the current pixel point is located according to the gradient and brightness of the current pixel point in the cache window and the gradient of the central pixel point in the adjacent window; performing filtering processing in the cache window where the current pixel point is located according to the judgment result of the texture to remove color noise; and outputting the RGB image after the color noise is removed. By calculating the gradient in the RGB image and the average brightness of the cache window where the current pixel point is located, and judging whether there is a texture in the area where the current pixel point is located by means of the gradient and brightness, it is possible to effectively distinguish between flat areas and texture areas, so that filtering processing can be performed only on flat areas to remove color noise, so that the color noise in the flat areas can be effectively removed while retaining the image texture details, and the problem of how to effectively remove the image color noise while retaining the image texture details is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A flowchart of a method for removing color noise from an image provided by this embodiment; Figure 2 A schematic diagram of the pixel arrangement coordinates of the G channel of the cache window provided in this embodiment; Figure 3 A schematic diagram of the pixel arrangement coordinates of the GR channel of the cache window provided in this embodiment; Figure 4 A schematic diagram of setting adjacent windows provided for this embodiment; Figure 5 A schematic diagram showing the names of adjacent windows provided in this embodiment; Figure 6 A schematic diagram of setting a cache window and two adjacent windows on the anti-diagonal line in a texture area provided in this embodiment. DETAILED DESCRIPTION

[0017] The following is a further detailed description of the image color noise removal method and device proposed by the present invention in conjunction with the accompanying drawings and specific embodiments. It should be noted that the accompanying drawings are all in a very simplified form and use non-precise proportions, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In addition, the structure shown in the accompanying drawings is often a part of the actual structure. In particular, the emphasis that each accompanying drawing needs to show is different, and sometimes different proportions are used.

[0018] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present invention are used to distinguish similar objects in order to describe the embodiments of the present invention, rather than to describe a specific order or sequence. It should be understood that the structures used in this way can be interchanged under appropriate circumstances. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0019] This embodiment provides a method for removing color noise from an image. Figure 1 As shown, including: S1, obtain RGB image; S2, in the cache window, calculate the gradient and brightness of the current pixel, and in the adjacent window adjacent to the cache window, calculate the gradient of the central pixel; S3, judging whether there is texture in the area where the current pixel is located according to the gradient of the current pixel in the cache window, the average brightness of the cache window where the current pixel is located, and the gradient of the central pixel of the adjacent window; S4, based on the texture judgment result, filtering is performed in the cache window where the current pixel is located to remove color noise; S5, outputs the RGB image after removing the color noise.

[0020] The method for removing image color noise provided by this embodiment calculates the gradient in the RGB image and the average brightness of the cache window where the current pixel is located, and uses the gradient and brightness to determine whether there is a texture in the area where the current pixel is located. It can effectively distinguish between flat areas and texture areas, so that only flat areas can be filtered to remove color noise, so that the color noise in the flat area can be effectively removed while retaining the image texture details, solving the problem of how to effectively remove image color noise while retaining the image texture details.

[0021] Specifically, in this embodiment, in step S1, the method for obtaining the RGB image may be to obtain the RGB image from various photographic and video equipment after image processing.

[0022] The RGB color model is a color standard in the industry. It obtains various colors by changing the three color channels of red (R), green (G), and blue (B) and superimposing them on each other. RGB represents the colors of the three channels of red, green, and blue. This standard covers almost all colors that human vision can perceive and is one of the most widely used color systems. Usually, RGB has 256 levels of brightness, which are represented by numbers from 0, 1, 2... to 255.

[0023] Further, in this embodiment, in step S2, within the cache window, the method of calculating the gradient of the current pixel and the average brightness of the cache window where the current pixel is located, and calculating the gradient of the central pixel within the adjacent window adjacent to the cache window includes: S21, extracting a cache window and a neighboring window, wherein the current pixel is located in the middle row and middle column of the cache window, and the neighboring window and the cache window have at least one pixel overlapped.

[0024] Specifically, in practical applications, a cache window of M rows and N columns may be extracted, where M and N are both positive integers greater than or equal to 3. It will be appreciated by those skilled in the art that, when the size of the extracted cache window is larger, the amount of calculation is larger, and more hardware resources are occupied, but the accuracy of the calculation result is also correspondingly improved.

[0025] In order to ensure that there are enough pixels in the horizontal, vertical, diagonal and anti-diagonal directions for gradient calculation, in this embodiment, the values ​​of the selected cache windows M and N are consistent, that is, the cache window is a square. At the same time, the current pixel is placed in the middle row and middle column of the cache window.

[0026] For some pixels at the upper, lower, left, and right edges of the image, mirror expansion can be performed using nearby row and column pixels to ensure that a buffer window of sufficient size can be extracted. The mirror expansion method is well known to those skilled in the art and will not be described in detail in this application.

[0027] In a specific embodiment, the size of the extracted cache window is 5 rows and 5 columns, and the current pixel is located at the 3rd row and the 3rd column.

[0028] Furthermore, the extracted neighboring window and the cache window have at least one pixel overlapped, thereby ensuring that the cache window and the neighboring window are continuous on the image, thereby ensuring the accuracy of subsequent texture judgment. At the same time, in order to facilitate the gradient calculation of the central pixel of the neighboring window, the size of the neighboring window is consistent with the size of the cache window, so that the gradient calculation method of the current pixel can be used to calculate the gradient of the central pixel of the neighboring window.

[0029] S22, in the cache window, calculating the G channel horizontal gradient and the G channel vertical gradient of the current pixel based on the G channel.

[0030] Specifically, in this embodiment, the G channel horizontal gradient of the current pixel is calculated using the G channel values ​​of the pixels in the same row as the current pixel in the cache window and the G channel value of the current pixel; the G channel vertical gradient of the current pixel is calculated using the G channel values ​​of the pixels in the same column as the current pixel in the cache window and the G channel value of the current pixel.

[0031] In this embodiment, if Figure 2 As shown, the coordinates of the pixel point in the cache window are (i, j). Taking a 5×5 cache window as an example, i=0,1,2,3,4, j=0,1,2,3,4, and the coordinates of the current pixel point are (2,2). The G channel value of the pixel point in the cache window is recorded as G(i,j), where the specific method of obtaining the G channel value from the RGB image is well known to those skilled in the art and will not be described in detail in this application.

[0032] The horizontal gradient gradGh of the G channel of the current pixel can be expressed as:

[0033] The vertical gradient gradGv of the G channel of the current pixel can be expressed as:

[0034] In this way, the horizontal gradient of the G channel is calculated through the pixels in the same row, and the vertical gradient of the G channel is calculated through the pixels in the same column, so that more accurate gradient information can be obtained with less calculation amount.

[0035] It should be noted that this application only takes the calculation process of a 5×5 cache window as an example to illustrate the implementation of the image color noise removal method of this application, but the protection scope of this application should not be limited to this. Of course, those skilled in the art can obtain the G channel horizontal gradient and G channel vertical gradient of the current pixel point under other size cache windows through the above-mentioned gradient calculation method, and this application will not go into details.

[0036] S23, calculating the average brightness in the cache window based on the G channel.

[0037] Specifically, in this embodiment, the average of the G channel values ​​of the eight pixels adjacent to the current pixel is calculated to obtain the average brightness, that is, the average brightness lumG can be expressed as:

[0038] In this way, the average brightness is obtained by averaging only the G channel values ​​of the eight pixels immediately adjacent to the current pixel, so that more accurate brightness information can be obtained with less calculation.

[0039] S24, within the cache window, calculate the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the current pixel point based on GR color difference and GB color difference.

[0040] Specifically, in this embodiment, if Figure 3 As shown, the GR color difference value of the pixel point in the cache window is recorded as GR (i, j), wherein the specific method of obtaining the GR color difference value and the GB color difference value from the RGB image is well known to those skilled in the art and will not be described in detail in this application.

[0041] In this embodiment, the calculation method of GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient and GB color difference anti-diagonal gradient is consistent with the method of GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient and GR color difference anti-diagonal gradient. Therefore, this embodiment only takes the gradient calculation of GR color difference in four directions as an example to illustrate the calculation method of color difference gradient. The calculation method of GB color difference gradient in four directions can refer to the calculation method of GR color difference gradient in four directions.

[0042] The GR color difference horizontal gradient gradGRh of the current pixel is calculated by using the GR color difference value of the pixel in the same row as the current pixel in the cache window and the GR color difference value of the current pixel, which can be expressed as:

[0043] The GR color difference value of the pixel in the same column as the current pixel in the cache window and the GR color difference value of the current pixel are used to calculate the GR color difference vertical gradient gradGRv of the current pixel, which can be expressed as:

[0044] The GR color difference diagonal gradient gradGRd of the current pixel is calculated by using the GR color difference value of the pixel on the same diagonal as the current pixel in the cache window and the GR color difference value of the current pixel, which can be expressed as:

[0045] The GR color difference value of the pixel point on the same diagonal as the current pixel point and the GR color difference value of the current pixel point in the cache window are used to calculate the GR color difference anti-diagonal gradient gradGRad of the current pixel point, which can be expressed as:

[0046] In this way, the horizontal gradient of color difference is calculated through the pixels in the same row, the vertical gradient of color difference is calculated through the pixels in the same column, the diagonal gradient of color difference is calculated through the pixels in the same diagonal line, and the anti-diagonal gradient of color difference is calculated through the pixels in the same anti-diagonal line. More accurate gradient information can be obtained with less calculation amount.

[0047] S25, within the 8 neighboring windows where the current pixel is located, calculate the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window based on GR color difference and GB color difference.

[0048] Specifically, in this embodiment, if Figure 4 As shown, 8 neighboring windows (dashed boxes) are set around the cache window (solid box), and the current pixel point (coordinate is (4,4)) is located at the center of the cache window and the edge of the neighboring window, where the current pixel point is located at the lower right corner of the neighboring window in the upper left corner; the current pixel point is located at the lower middle position of the neighboring window directly above; the current pixel point is located at the lower left corner of the neighboring window in the upper right corner; the current pixel point is located at the rightmost middle position of the neighboring window on the left; the current pixel point is located at the leftmost middle position of the neighboring window on the right; the current pixel point is located at the upper right corner of the neighboring window in the lower left corner; the current pixel point is located at the upper middle position of the neighboring window directly below; and the current pixel point is located at the upper left corner of the neighboring window in the lower right corner.

[0049] In this embodiment, when the size of the neighboring window is consistent with the size of the cache window, which is 5×5, and each neighboring window contains the current pixel, together with the cache window and the neighboring window, a 9×9 data window is selected for gradient calculation. Of course, in other embodiments, the size of the cache window and the neighboring window, the number of overlapping pixels, etc. can have other settings, and this application does not limit this.

[0050] Furthermore, a method of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window based on the GR color difference and the GB color difference in the neighboring window is consistent with a method of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the current pixel point based on the GR color difference and the GB color difference in the cache window.

[0051] In practical applications, the pixel interval for differential selection in gradient calculation can be adjusted according to actual needs, and is not limited to the 1 pixel interval method selected in this application. Of course, those skilled in the art can foresee that when the interval is large, more computing resources and storage resources will be consumed, and it may affect the accuracy of the calculation, thereby affecting the final color noise removal effect. In practical applications, comprehensive considerations need to be made to reasonably determine.

[0052] Also, in practical applications, step S24 and step S25 may be performed first, and then step S22 and step S23; step S23 may be performed first, and then step S24... The order of implementation of each step may be changed according to actual needs, and this application does not limit this. The scheme after the step order is changed without violating the purpose of this application should also fall within the scope of protection of this application.

[0053] Furthermore, in this embodiment, step S3 determines whether there is a texture in the area where the current pixel is located based on the gradient and brightness of the current pixel in the cache window and the gradient of the central pixel of the adjacent window.

[0054] Specifically, in this embodiment, if Figure 5 As shown, the cache window is recorded as winCrt, the two adjacent windows in the horizontal direction of the cache window are recorded as winH1 and winH2, the two adjacent windows in the vertical direction of the cache window are recorded as winV1 and winV2, the two adjacent windows in the diagonal direction of the cache window are recorded as winD1 and winD2, and the two adjacent windows in the anti-diagonal direction of the cache window are recorded as winAd1 and winAd2.

[0055] If the larger value of the horizontal gradient of the G channel and the vertical gradient of the G channel of the current pixel is greater than the first multiple of the average brightness, that is, , it means that the area where the current pixel is located has a larger gradient compared to its brightness, so it is judged that there is texture in the area where the current pixel is located, that is, it is judged that the current pixel meets the first judgment condition. The typical value of is, for example, 0.5. Of course, in practical applications, the first multiple The value of needs to be reasonably set according to the actual situation, and this application does not impose any restrictions on this.

[0056] If the maximum GR color difference gradient of the current pixel in the cache window winCrt is the GR color difference horizontal gradient gradGRh, then in the two adjacent windows winV1 and winV2 in the vertical direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference horizontal gradient (recorded as gradGRh2), and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, that is, , it is determined that there is texture in the area where the current pixel is located, that is, it is determined that the current pixel satisfies the second judgment condition; Similarly, the GB color difference domain can be judged: if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference horizontal gradient , then in the two adjacent windows winV1 and winV2 in the vertical direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference horizontal gradient (denoted as gradGBh2), and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, that is , it is determined that there is texture in the area where the current pixel is located, that is, it is determined that the current pixel satisfies the second judgment condition; Similar to the judgment method in the horizontal direction, if the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference vertical gradient gradGRv, then in the two adjacent windows winH1 and winH2 in the horizontal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference vertical gradient (recorded as gradGRv2), and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, that is, , then it is determined that the current pixel satisfies the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference vertical gradient gradGBv, then in the two adjacent windows winH1 and winH2 in the horizontal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference vertical gradient (recorded as gradGBv2), and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, that is, , it is determined that the current pixel meets the second judgment condition; And, if the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference diagonal gradient gradGRd, then in the two adjacent windows winAd1 and winAd2 in the anti-diagonal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference diagonal gradient (denoted as gradGRd2), and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, that is, , then it is determined that the current pixel satisfies the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference diagonal gradient gradGBd, then in the two adjacent windows winAd1 and winAd2 in the anti-diagonal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference diagonal gradient (denoted as gradGBd2), and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, that is, , it is determined that the current pixel meets the second judgment condition; And, if the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference anti-diagonal gradient gradGRad, then in the two adjacent windows winD1 and winD2 in the diagonal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference anti-diagonal gradient (denoted as gradGRad2), and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, that is, , then it is determined that the current pixel satisfies the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference anti-diagonal gradient gradGBad, then in the two adjacent windows winD1 and winD2 in the diagonal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference anti-diagonal gradient (denoted as gradGBad2), and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, that is, , then it is determined that the current pixel meets the second judgment condition.

[0057] Among them, the second multiple The typical value of is, for example, 0.6; the third multiple The typical value of is, for example, 1.4. Of course, in practical applications, the second multiple The value and third multiple of The value of needs to be reasonably set according to the actual situation, and this application does not impose any restrictions on this.

[0058] When determining the second judgment condition, the judgment method of the GB color difference domain is the same as that of the GR color difference domain, and both the GR color difference domain and the GB color difference domain need to be judged. As a result, as long as one of the GR color difference domain or the GB color difference domain meets the above judgment conditions, it is considered that the current pixel point meets the second judgment condition.

[0059] If the current pixel point satisfies both the first judgment condition and the second judgment condition, it is determined that there is texture in the area where the current pixel point is located.

[0060] by Figure 6 Taking the texture area shown in the figure as an example, the pixels contained in the cache window (gray solid line box in the figure) and its two adjacent windows on the anti-diagonal line (gray dotted line boxes in the figure) are located in the texture area, then the maximum gradient directions of the cache window and the two adjacent windows on the anti-diagonal line are both diagonal directions, and the maximum gradient values ​​are close, satisfying "the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window", it is judged that the area where the current pixel is located has texture in the anti-diagonal direction, and Figure 6 The texture features displayed are consistent.

[0061] By judging the texture area twice, the texture area and the flat area can be effectively distinguished. Therefore, in the subsequent color noise removal, only the flat area can be removed without processing the texture area, thereby ensuring that the texture details of the texture area are intactly preserved, so that the final output image can reflect the texture details while being free of color noise, thereby improving the image quality.

[0062] In practical applications, only when the first judgment condition and the second judgment condition are satisfied at the same time, it is considered that there is texture in the area where the current pixel is located, and the calculation amount of the first judgment condition is significantly less than that of the second judgment condition. Therefore, in order to reduce the calculation amount as much as possible, the first judgment condition is determined first, and if the first judgment condition is satisfied, the second judgment condition is determined, otherwise the second judgment condition is not determined. In this way, when the first judgment condition is not satisfied, the color difference gradient calculation and the judgment of the second condition in step S24 and step S25 can be omitted, which greatly saves the consumption of calculation amount and hardware resources.

[0063] Furthermore, in this embodiment, in step S4, according to the texture determination result, filtering is performed in the cache window where the current pixel point is located to remove the color noise, which method includes: S41, if it is determined that there is texture in the area where the current pixel is located, no filtering is performed; S42, if it is determined that there is no texture in the area where the current pixel is located, filtering processing is performed based on GR color difference and GB color difference in the cache window where the current pixel is located to remove color noise.

[0064] Specifically, Gaussian filtering can be used to remove color noise. Gaussian filtering is a linear smoothing filter that can perform well in removing color noise. The specific implementation of Gaussian filtering is well known to those skilled in the art, and this application will not go into details.

[0065] Of course, in other embodiments, other filtering methods may be selected to remove color noise, and this application does not limit this. The selection of other filtering methods without violating the purpose of this application should also fall within the protection scope of this application.

[0066] Furthermore, in this embodiment, corresponding to step S4 and step S5, the method for outputting the RGB image after removing the color noise includes: S51, if the current pixel is not filtered, retain its original RGB value; S52: If the current pixel is filtered, the GR color difference value and GB color difference value after filtering are subtracted from the original G channel value to obtain the R channel value and B channel value after filtering, and the original G channel value and the R channel value and B channel value after filtering are combined to obtain the RGB value.

[0067] Finally, by outputting the RBG values ​​in sequence, we can get the RGB image after removing the color noise.

[0068] This embodiment also provides a device for removing image color noise, including a memory, a processor, and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the method for removing image color noise as described above is executed.

[0069] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. In addition, the different parts between the various embodiments can also be used in combination with each other, and the present invention is not limited to this.

[0070] The method and device for removing color noise of an image provided in this embodiment include: obtaining an RGB image; calculating the gradient and brightness of the current pixel in a cache window, and calculating the gradient of the central pixel in an adjacent window adjacent to the cache window; judging whether there is texture in the area where the current pixel is located based on the gradient of the current pixel in the cache window and the average brightness of the cache window where the current pixel is located, as well as the gradient of the central pixel in the adjacent window; performing filtering processing in the cache window where the current pixel is located based on the judgment result of the texture to remove color noise; and outputting the RGB image after removing color noise. By calculating the gradient in the RGB image and the average brightness of the cache window where the current pixel is located, and judging whether there is texture in the area where the current pixel is located by means of the gradient and brightness, it is possible to effectively distinguish between flat areas and texture areas, so that only flat areas can be filtered to remove color noise, so that color noise in flat areas can be effectively removed while retaining image texture details, solving the problem of how to effectively remove image color noise while retaining image texture details.

[0071] The above description is only a description of the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention. Any changes or modifications made by a person skilled in the art in the field of the present invention based on the above disclosure shall fall within the scope of protection of the claims.

Claims

1. A method for removing color noise from an image, characterized in that: include: Get RGB image; In the cache window, the gradient of the current pixel and the average brightness of the cache window where the current pixel is located are calculated, and in the adjacent window adjacent to the cache window, the gradient of the central pixel is calculated; According to the gradient and brightness of the current pixel in the cache window and the gradient of the central pixel of the adjacent window, it is determined whether there is a texture in the area where the current pixel is located; According to the texture judgment result, filtering is performed in the cache window where the current pixel is located to remove color noise; Output the RGB image after removing color noise.

2. The method for removing color noise from an image according to claim 1, characterized in that: The method of calculating the gradient of the current pixel and the average brightness of the cache window where the current pixel is located in the cache window, and calculating the gradient of the central pixel in a neighboring window adjacent to the cache window includes: Extracting a cache window and a neighboring window, wherein the current pixel is located in the middle row and middle column of the cache window, and the neighboring window and the cache window have at least one pixel overlapped; In the cache window, the G channel horizontal gradient and the G channel vertical gradient of the current pixel are calculated based on the G channel; Calculate the average brightness within the cache window based on the G channel; In the cache window, based on the GR color difference and the GB color difference, the GR color difference horizontal gradient, the GR color difference vertical gradient, the GR color difference diagonal gradient, the GR color difference anti-diagonal gradient, the GB color difference horizontal gradient, the GB color difference vertical gradient, the GB color difference diagonal gradient, and the GB color difference anti-diagonal gradient of the current pixel are calculated respectively; Within the 8 neighboring windows where the current pixel is located, the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window are calculated based on GR color difference and GB color difference.

3. The method for removing color noise of an image according to claim 2, characterized in that: The method for calculating the G channel horizontal gradient and the G channel vertical gradient of the current pixel point based on the G channel in the cache window includes: The G channel horizontal gradient of the current pixel is calculated by using the G channel value of the pixel in the same row as the current pixel in the cache window and the G channel value of the current pixel; The G channel vertical gradient of the current pixel is calculated using the G channel value of the pixel in the same column as the current pixel in the cache window and the G channel value of the current pixel.

4. The method for removing color noise from an image according to claim 2, characterized in that: The method for calculating the average brightness in the cache window based on the G channel includes: Calculate the average G channel value of the eight pixels adjacent to the current pixel to obtain the average brightness.

5. The method for removing color noise from an image according to claim 2, characterized in that: The method of respectively calculating the GR color difference horizontal gradient, the GR color difference vertical gradient, the GR color difference diagonal gradient, the GR color difference anti-diagonal gradient, the GB color difference horizontal gradient, the GB color difference vertical gradient, the GB color difference diagonal gradient, and the GB color difference anti-diagonal gradient of the current pixel point based on the GR color difference and the GB color difference in the cache window includes: The GR color difference value of the pixel in the same row as the current pixel and the GR color difference value of the current pixel in the cache window are used to calculate the GR color difference horizontal gradient of the current pixel, and the GB color difference value of the pixel in the same row as the current pixel and the GB color difference value of the current pixel are used to calculate the GB color difference horizontal gradient of the current pixel; The GR color difference value of the pixel in the same column as the current pixel and the GR color difference value of the current pixel in the cache window are used to calculate the GR color difference vertical gradient of the current pixel, and the GB color difference value of the pixel in the same column as the current pixel and the GB color difference value of the current pixel are used to calculate the GB color difference vertical gradient of the current pixel; The GR color difference diagonal gradient of the current pixel is calculated by using the GR color difference value of the pixel on the same diagonal as the current pixel and the GR color difference value of the current pixel in the cache window, and the GB color difference diagonal gradient of the current pixel is calculated by using the GB color difference value of the pixel on the same diagonal as the current pixel and the GB color difference value of the current pixel; The GR color difference value of the pixel point that is diagonally opposite to the current pixel point in the cache window and the GR color difference value of the current pixel point are used to calculate the GR color difference anti-diagonal gradient of the current pixel point, and the GB color difference value of the pixel point that is diagonally opposite to the current pixel point and the GB color difference value of the current pixel point are used to calculate the GB color difference anti-diagonal gradient of the current pixel point.

6. The method for removing color noise from an image according to claim 2, characterized in that: The size of the neighboring window is consistent with the size of the cache window; the manner of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the central pixel point of each neighboring window based on GR color difference and GB color difference in the neighboring window is consistent with the manner of respectively calculating the GR color difference horizontal gradient, GR color difference vertical gradient, GR color difference diagonal gradient, GR color difference anti-diagonal gradient, GB color difference horizontal gradient, GB color difference vertical gradient, GB color difference diagonal gradient, and GB color difference anti-diagonal gradient of the current pixel point based on GR color difference and GB color difference in the cache window.

7. The method for removing color noise from an image according to claim 2, characterized in that: The method for determining whether there is a texture in the area where the current pixel point is located according to the gradient and brightness of the current pixel point in the cache window and the gradient of the central pixel point of the adjacent window includes: If the larger value of the G channel horizontal gradient and the G channel vertical gradient of the current pixel is greater than the first multiple of the average brightness, it is determined that the current pixel meets the first judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference horizontal gradient, then in the two adjacent windows in the vertical direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference horizontal gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference horizontal gradient, then in the two adjacent windows in the vertical direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference horizontal gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference vertical gradient, then in the two adjacent windows in the horizontal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference vertical gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference vertical gradient, then in the two adjacent windows in the horizontal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference vertical gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference diagonal gradient, then in the two neighboring windows in the anti-diagonal direction, if the maximum GR color difference gradient in any one of the neighboring windows is the GR color difference diagonal gradient, and the maximum GR color difference gradient in the neighboring window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference diagonal gradient, then in the two neighboring windows in the anti-diagonal direction, if the maximum GB color difference gradient in any one of the neighboring windows is the GB color difference diagonal gradient, and the maximum GB color difference gradient in the neighboring window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the maximum GR color difference gradient of the current pixel in the cache window is the GR color difference anti-diagonal gradient, then in the two adjacent windows in the diagonal direction, if the maximum GR color difference gradient in any adjacent window is the GR color difference anti-diagonal gradient, and the maximum GR color difference gradient in the adjacent window is greater than the second multiple of the maximum GR color difference gradient in the cache window and less than the third multiple of the maximum GR color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; and / or, if the maximum GB color difference gradient of the current pixel in the cache window is the GB color difference anti-diagonal gradient, then in the two adjacent windows in the diagonal direction, if the maximum GB color difference gradient in any adjacent window is the GB color difference anti-diagonal gradient, and the maximum GB color difference gradient in the adjacent window is greater than the second multiple of the maximum GB color difference gradient in the cache window and less than the third multiple of the maximum GB color difference gradient in the cache window, then it is judged that the current pixel meets the second judgment condition; If the current pixel point satisfies both the first judgment condition and the second judgment condition, it is determined that there is texture in the area where the current pixel point is located.

8. The method for removing color noise from an image according to claim 1, characterized in that: The method of performing filtering processing in the cache window where the current pixel point is located according to the texture judgment result to remove color noise includes: If it is determined that there is texture in the area where the current pixel is located, no filtering is performed; If it is determined that there is no texture in the area where the current pixel is located, filtering processing is performed based on GR color difference and GB color difference in the cache window where the current pixel is located to remove color noise.

9. The method for removing color noise from an image according to claim 8, characterized in that: The method for outputting an RGB image after color noise removal comprises: If the current pixel is not filtered, its original RGB value is retained; If the current pixel is filtered, the GR color difference value and GB color difference value after filtering are subtracted from the original G channel value to obtain the R channel value and B channel value after filtering, and the original G channel value and the R channel value and B channel value after filtering are combined to obtain the RGB value.

10. A device for removing color noise from an image, characterized in that: The method comprises a memory, a processor and an executable program stored in the memory and capable of being run by the processor; when the processor runs the executable program, the method for removing color noise of an image as described in any one of claims 1 to 9 is executed.

Citation Information

Cited By

  • Red, green and blue (RGB) image disordered texture region identification method and device, electronic equipment and computer storage medium

    CN121708062A