A Bayer image noise reduction method, device and equipment

By designing noise reduction windows and weight distribution for different channels in Bayer images, combined with DCT transformation and coefficient mask adjustment, the problem of noise pollution in low-light environments is solved, efficient Bayer image noise reduction is achieved, and color image quality is improved. .

CN118552439BActive Publication Date: 2024-10-15HU NAN X CHIP MICROELECTRONICS TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411009150.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-10-15
Estimated Expiration
2044-07-26

AI Technical Summary

Technical Problem

The existing Bayer image denoising algorithm results in low image signal-to-noise ratio in low-illumination environments, serious noise pollution, affecting color interpolation results, and filtering of the entire image results in loss of details.

Method used

The noise reduction window design of different channels is adopted, the appropriate window range and weight distribution are selected according to the pixel channel type, adaptive noise reduction is performed through DCT transformation and coefficient mask adjustment, and the noise suppression factor is adjusted according to the exposure gain.

Benefits of technology

Effectively reduce and eliminate noise in Bayer images, improve noise reduction effect, retain image details, and improve color image quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552439B_ABST
    Figure CN118552439B_ABST
Patent Text Reader

Abstract

The present invention provides a Bayer image denoising method, device and equipment, which relates to the field of image processing technology, including: S1, obtaining a Bayer format initial image; S2, sampling the initial image through a denoising window to obtain local image data, and assigning weights to neighborhood pixels; S3, calculating pixel differences based on the differences and weights between neighborhood pixels and central pixels; S4, generating coefficient masks based on pixel differences; S5, performing DCT transformation on local image data to obtain DCT coefficients, and adjusting the DCT coefficients through coefficient masks; S6, performing DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image; S7, adjusting the noise suppression factor based on the exposure gain to obtain the final denoised image. When the present invention denoises the Bayer image, different neighborhood ranges and sampling templates are adopted for different channels, effectively reducing and eliminating noise in the image, and greatly improving the denoising effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a Bayer image noise reduction method, device and equipment. Background Art

[0002] Bayer image is the raw data after photoelectric conversion by CMOS or CCD image sensor, and is a lossless image data format. Taking the acquisition of image information by CMOS image sensor as an example, the light from the light source or reflected by the object passes through the Bayer filter to generate a color filter array, and each pixel position has only a single R / G / B value. In order to restore the real scene image, it is necessary to have three pieces of information R / G / B at each pixel position, so it is necessary to perform color interpolation on the image. When performing interpolation operation to extract boundary information, it is necessary to refer to the information of adjacent pixels, and the presence of noise will reduce the accuracy of boundary detection. Especially in low-light environments, insufficient incident light will reduce the amplitude of the effective signal, resulting in a low image signal-to-noise ratio, and the boundaries of real objects will be contaminated by noise, which will have a greater impact on the color interpolation algorithm, causing the quality of the restored color image to decline.

[0003] In order to ensure the image quality, it is necessary to suppress the noise of the Bayer format image. Since the noise distribution is uneven and the amplitude is random, the current noise reduction algorithms such as median filtering, mean filtering, bilateral filtering and non-local mean filtering, etc., filter the entire image with the same intensity, which will lead to the loss of image details and affect the subsequent color interpolation results. Summary of the invention

[0004] In order to overcome the deficiencies in the background technology, the present invention discloses a Bayer image noise reduction method, device and equipment.

[0005] In order to achieve the above-mentioned invention object, the present invention adopts the following technical scheme:

[0006] In a first aspect, the present invention provides a Bayer image noise reduction method, comprising the following steps:

[0007] S1, obtain the initial image in Bayer format;

[0008] S2, sampling the initial image through the denoising window to obtain local image data, and assigning weights to the neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window;

[0009] S3, calculating pixel difference according to the difference and weight between the neighborhood pixel and the central pixel;

[0010] S4, generating a coefficient mask according to the pixel difference;

[0011] S5, performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask;

[0012] S6, performing inverse DCT transformation on the adjusted DCT coefficients to obtain a preliminary denoised image;

[0013] S7. After adjusting the noise suppression factor according to the exposure gain, the preliminary denoised image is adjusted to obtain a final denoised image.

[0014] Specifically, the noise reduction window in step S2 has different window sizes according to different pixel channel types, and the range of the noise reduction window is an area surrounded by a first preset number of pixels of the same channel type that are closest to the center pixel.

[0015] Specifically, the step S2 of assigning weights to neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window is as follows: in the denoising window, the weights of pixels with the same channel type as the central pixel are inversely proportional to the spatial distance to the central pixel, and the weight assignment follows a power exponential relationship.

[0016] Specifically, the formula for calculating the pixel difference according to the difference between the neighborhood pixel and the central pixel and the weight in step S3 is:

[0017] ,

[0018] Among them, dif is the pixel difference; w is the weight of the neighborhood pixel in the denoising window, is the grayscale value of the i-th point in the window, is the grayscale value of the center pixel, m is the value of the first preset number, and mid is the center pixel number.

[0019] Specifically, the coefficient mask generation formula in step S4 is:

[0020] ;

[0021] Among them, mask is the coefficient mask; is the first threshold, is the second threshold; is the first mask; is the second mask; For the third mask.

[0022] Specifically, the formula for DCT transformation in step S5 is as follows:

[0023] ;

[0024] in, is the coefficient value after DCT transformation, i.e., the DCT coefficient, is the grayscale value before pixel transformation, N is the number of pixels of the window size; i, j are the pixel coordinate indexes of the NxN window before DCT transformation; u, v are the coefficient coordinate indexes of the NxN window after DCT transformation; and They are the first compensation factor and the second compensation factor respectively, and the calculation formulas of the first compensation factor and the second compensation factor are: .

[0025] Specifically, the DCT coefficient is adjusted by the coefficient mask in step S5 as follows: for a position where the coefficient mask is 1, the original coefficient of the DCT coefficient at that position is retained; for a position where the coefficient mask is 0, the value of the DCT coefficient at that position is set to 0.

[0026] Specifically, step S7 includes:

[0027] The difference noise image is obtained by taking the difference between the initial image and the preliminary denoised image, as shown in the following formula:

[0028] ;

[0029] Among them, s1 is the initial image, s2 is the preliminary denoised image, and d is the difference noise image;

[0030] Adding noise suppression factor to difference noisy image , and then superimposed on the original image to obtain the final denoised image , as shown below:

[0031] ;

[0032] in, is the noise suppression factor, and the calculation formula of the noise suppression factor is as follows:

[0033] ;

[0034] Among them, str0 is the suppression factor corresponding to 1 times exposure gain; str1 is the suppression factor corresponding to 2 times exposure gain; str2 is the suppression factor corresponding to 4 times exposure gain; str3 is the suppression factor corresponding to 8 times exposure gain; str4 is the suppression factor corresponding to 16 times exposure gain; str5 is the suppression factor corresponding to 32 times exposure gain; str6 is the suppression factor corresponding to 64 times exposure gain; str7 is the suppression factor corresponding to 128 times and above exposure gain; gain is the exposure gain.

[0035] Specifically, step S3 further includes: removing abnormal pixels in the noise reduction window by a truncation processing function to obtain an optimized pixel difference dif, as shown in the following formula:

[0036] ;

[0037] in, is the preset cutoff threshold; is the truncation processing function, and its expression is: , where x is the grayscale value.

[0038] In a second aspect, the present invention provides a Bayer image noise reduction device, comprising the following units:

[0039] An initial image acquisition unit, used for acquiring an initial image in a Bayer format;

[0040] A weight allocation unit, configured to obtain local image data by sampling the initial image through a denoising window, and to allocate weights to neighbouring pixels according to the spatial distance between the neighbouring pixels and the central pixel in the denoising window;

[0041] A pixel difference calculation unit, used for calculating the pixel difference according to the difference and weight between the neighborhood pixel and the central pixel;

[0042] A coefficient mask generating unit, configured to generate a coefficient mask according to the pixel difference;

[0043] A DCT coefficient optimization unit, used for performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask;

[0044] A preliminary denoised image generating unit, used for performing DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image;

[0045] The exposure gain optimization unit is used to adjust the preliminary denoised image after adjusting the noise suppression factor according to the exposure gain to obtain a final denoised image.

[0046] In a third aspect, the present invention provides an electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.

[0047] The present invention provides a Bayer image noise reduction method, comprising the following steps:

[0048] S1, obtain the initial image in Bayer format; S2, select the corresponding denoising window according to the channel type of the current pixel to sample and obtain the local data of the image, and assign weights to the neighboring pixels in the denoising window according to the channel type and spatial distance of the neighboring pixels in the denoising window; S3, calculate the pixel difference according to the difference and weight between the neighboring pixels and the central pixel, and calculate the window detail intensity according to the pixel difference; S4, generate a coefficient mask according to the detail intensity; S5, perform DCT transformation on the local data of the image to obtain DCT coefficients, and adjust the DCT coefficients through the coefficient mask; S6, perform DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image; S7, adjust the preliminary denoised image after adjusting the noise suppression factor according to the exposure gain to obtain the final denoised image. When denoising the Bayer image, the present invention designs different templates for the data of the G channel and the R / B channel, adopts different neighborhood ranges, effectively reduces and eliminates the noise in the Bayer image, and greatly improves the denoising effect of the algorithm.

[0049] In addition, when calculating the detail intensity of the window, the present invention takes into account the influence of spatial distance and grayscale distance, assigns a weight that follows a power exponential relationship to each pixel, and can replace floating-point multiplication operations with shift operations during calculations, effectively improving calculation efficiency.

[0050] In addition, when calculating the detail intensity of the window, the present invention adopts truncation processing on the obtained difference result to reduce and eliminate the influence of abnormal values, thereby further improving the noise reduction effect.

[0051] Furthermore, the present invention uses DCT transformation to filter the image, and selects different coefficient masks according to the detail intensity to adjust the DCT coefficients, thereby performing adaptive noise reduction.

[0052] Furthermore, the present invention introduces exposure gain to link the ambient brightness and the noise suppression factor, thereby further optimizing the noise reduction effect. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0054] Figure 1 1 is a schematic diagram of a Bayer image noise reduction method according to an embodiment of the present invention;

[0055] Figure 2is a schematic diagram of G channel noise reduction window weights provided according to an embodiment of the present invention;

[0056] Figure 3 is a schematic diagram of R / B channel noise reduction window weights provided according to an embodiment of the present invention;

[0057] Figure 4 is a schematic diagram of the relationship between exposure gain and noise suppression factor provided according to an embodiment of the present invention;

[0058] Figure 5 is a schematic diagram of a Bayer image noise reduction device provided according to an embodiment of the present invention;

[0059] Figure 6 Schematic diagram of a Bayer image noise reduction device provided according to an embodiment of the present invention. DETAILED DESCRIPTION

[0060] The present invention can be explained in detail through the following embodiments. The purpose of disclosing the present invention is to protect all technical improvements within the scope of the present invention. In the description of the present invention, it should be understood that if there are terms such as "upper", "lower", "front", "back", "left", "right", etc. indicating directions or positional relationships, they only correspond to the drawings of the present application for the convenience of describing the present invention, and do not indicate or imply that the device or element referred to must have a specific direction.

[0061] Embodiment 1

[0062] refer to Figure 1 , this embodiment provides a Bayer image noise reduction method, including the following steps:

[0063] S1, obtain the initial image in Bayer format;

[0064] Each pixel in the Bayer image captures light through a color filter to produce a color filter array. The Bayer image generally contains three color channels, namely R channel, G channel and B channel. Each pixel position has only a single R / G / B value. These filters are arranged according to the specific pattern of the Bayer filter array. The most common Bayer filter array is a 2x2 grid. Depending on the Bayer arrangement, the color information in the image presents different distributions.

[0065] The noise reduction method described in this embodiment is applicable to all Bayer format images, including RG / GB, BG / GR, GR / BG, GB / RG arrangement formats.

[0066] Preferably, in this embodiment, the Bayer format initial image adopts the Bayer arrangement format of RG / GB, and the R / B channels are completely consistent except for the position offset.

[0067] S2, sampling the initial image through the denoising window to obtain local image data, and assigning weights to the neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window;

[0068] Different pixel channel types have different noise reduction window sizes, which include shape and size. In this embodiment, the noise reduction window includes a G channel noise reduction window and an R / B channel noise reduction window. The shapes of the G channel noise reduction window and the R / B channel noise reduction window are different, such as Figure 2-Figure 3 As shown, the denoising window size can be selected to have the best denoising effect on the pixel channel type, which can be obtained through prior experiments.

[0069] It can be considered that the range of the noise reduction window is the area surrounded by the first preset number of pixels of the same channel type closest to the central pixel;

[0070] The value of the first preset number is greater than or equal to 8 and is a multiple of 8. It can be specifically selected according to the size of the noise reduction window actually required, such as 24 or 48. Preferably, the value of the first preset number in this embodiment is 8.

[0071] For example, the current pixel channel is the G channel. Along the diagonal direction of the image, from bottom to top and from left to right, 9 G channel pixels are selected in sequence. The area surrounded by these 9 pixels is used as the G channel denoising window. The pixel corresponding to the center of the G channel denoising window is used as the central pixel, and the remaining 8 G channel pixels are neighborhood pixels.

[0072] For example, the current pixel channel is the R / B channel. Along the horizontal direction of the image, from bottom to top and from left to right, select 9 R / B channel pixels in sequence, and use the area surrounded by these 9 pixels as the R / B channel denoising window. The pixel corresponding to the center of the R / B channel denoising window is used as the central pixel, and the remaining 8 R / B channel pixels are neighborhood pixels.

[0073] The specific traversal method for sampling is not limited here. This is the existing technology and will not be described in detail here.

[0074] This embodiment designs two noise reduction windows for different sampling of the G channel and the R / B channel, namely the G channel noise reduction window and the R / B channel noise reduction window. The pixel corresponding to the center of the noise reduction window is used as the center pixel, and the other pixels of the same channel except the center pixel in the noise reduction window are the neighborhood pixels. In addition, different weights are assigned to each neighborhood pixel in the noise reduction window according to the spatial distance between the center pixel and the neighborhood pixel in the noise reduction window.

[0075] Specifically, the weights are assigned to the neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the noise reduction window as follows:

[0076] In the noise reduction window, the weight of pixels with the same channel type as the central pixel is inversely proportional to the spatial distance from the central pixel, and the distribution of the weight follows a power exponential relationship;

[0077] exist Figure 2 In the G channel denoising window shown, each square in the window represents each pixel, and the value in the box is the weight of each pixel. The weight is inversely proportional to the spatial distance from the neighborhood pixel to the center pixel, and the designed weights are all powers of 2.

[0078] The weight of the central pixel is set to 1, the weight of the 4 G channel pixels closest to the central pixel is 0.5, and the weight of the 4 G channel pixels second closest to the central pixel is 0.25. If the window size is expanded, the weights of other color channel pixels are set to 0 according to the distance between the neighboring pixels and the central pixel.

[0079] Figure 3 The pixel weight allocation process in the R / B channel noise reduction window shown in is similar to the weight allocation process in the G channel noise reduction window, so it will not be repeated here.

[0080] In this embodiment, the weights of the neighboring pixels at different spatial distances from the central pixel are designed to be powers of 2, and the floating-point multiplication operation can be replaced by the shift operation during the operation, thereby effectively improving the operation efficiency.

[0081] The weights with decimal places used in this embodiment have two values, namely 0.25 and 0.5, both of which can be calculated using shift operations. For example, 100*0.25 can be converted to (100>>2), and 100*0.5 can be converted to (100>>1), thereby improving the computing efficiency.

[0082] refer to Figure 3 The weight allocation process in the R / B channel noise reduction window is similar to that in the G channel noise reduction window, so it will not be repeated here.

[0083] The Bayer image can obtain local image data through window sampling, and the local image data includes local pixel information, including pixel color data and pixel grayscale value, etc.; local features and statistics, such as edges, corners, textures, etc., as well as calculation of local statistics, such as mean, variance, etc., local filtering results, such as Gaussian filtering, median filtering, etc., to smooth noise or sharpen edges, etc. This is the existing technology and will not be repeated here.

[0084] In this embodiment, pixels of the G channel are sampled through the G channel noise reduction window, and pixels of the R / B channel are sampled through the R / B channel noise reduction window. After sampling, local image information corresponding to the corresponding channels is obtained, thereby obtaining the color of the pixel.

[0085] After Bayer image sampling, image data windows of the same channel type are obtained. Subsequent noise reduction processes are all processed on the same channel to avoid interference between data from different channels.

[0086] S3, calculating pixel difference according to the difference and weight between the neighborhood pixel and the central pixel;

[0087] In image processing, detail intensity refers to the intensity of detail and texture information contained in an image. The greater the detail intensity, the more details and textures contained in the image, the clearer and more delicate the image looks, and the better it can show the complex structure in the image.

[0088] In this embodiment, the pixel difference dif is used to represent the detail intensity, which is obtained by calculating the pixel difference between the central pixel and the neighboring pixels.

[0089] Detail intensity is used to describe the texture strength of a local area of ​​an image. Generally, a first-order difference operator, such as the Sobel operator, is used to calculate detail intensity. A second-order difference operator, such as the Laplacian operator, can also be used to calculate detail intensity.

[0090] Whether it is a first-order operator or a second-order operator, the main purpose is to extract the grayscale difference in the region. In this embodiment, a method similar to the first-order operator is used to extract the difference between the central pixel and the surrounding pixels, thereby describing the detail intensity in the neighborhood window.

[0091] In step S2, the influence of position is taken into account when setting weights for neighboring pixels, and pixels with a weight of 0 are pixels of other color channels, and their weights are not included in the difference calculation. Only the neighboring pixels of the same color channel as the central pixel in the denoising window need to be considered.

[0092] Specifically, the calculation formula of the pixel difference dif is:

[0093] ,

[0094] Among them, w is the weight of the neighborhood pixels in the denoising window, is the grayscale value of the i-th point in the window, is the grayscale value of the center pixel, m is the value of the first preset number, and the center pixel number is mid=m / 2.

[0095] This implementation provides a specific implementation method for calculating pixel difference dif. Figure 2-3 The value of the first preset number m is 8, and only pixels with non-zero weights are numbered. The numbering is from top to bottom and from left to right, and still increases. The numbering values ​​are from 0 to m, and the center pixel is numbered mid, mid=m / 2.

[0096] Specifically, the calculation formula of the pixel difference dif is:

[0097] ;

[0098] Among them, w is the weight of the neighborhood pixels in the denoising window, is the grayscale value of the i-th point in the window, is the grayscale value of the center pixel.

[0099] The pixel difference dif is used to calculate the difference between the central pixel and the surrounding m pixels. If the value is larger, it means that the difference between the central pixel and the surrounding pixels is larger, and the details in the image area are stronger.

[0100] For example, if a neighborhood window is selected in a flat area of ​​the image, the grayscale difference of the pixels in the window is small, and the calculated dif value is small. If a neighborhood window is selected at the boundary of an image object, the grayscale difference between the central pixel and the surrounding pixels is large, and the calculated dif value is large. Therefore, the larger the pixel difference dif value is, the greater the detail intensity in the denoising window.

[0101] Due to factors such as device process defects, large particle noise and hardware circuit defects, there are a small number of abnormal points in the images collected by the image sensor, which usually appear as white dots or black dots. These abnormal points will have a great impact on the value of detail intensity, causing the detail intensity to deviate seriously from the true value. The noise reduction process will expand the range of white dots and black dots. The points are all pixel points.

[0102] In this embodiment, a truncation process is adopted when calculating the difference within the noise reduction window, so as to reduce the influence of abnormal pixels. The calculation formula of the pixel difference dif after the truncation process is optimized is:

[0103] ;

[0104] in, is the preset cutoff threshold; It is the truncation processing function.

[0105] The truncation processing function can suppress the influence of abnormal points and preset the truncation threshold Determines the degree of influence of the outlier on the pixel difference dif. The smaller the parameter, the greater the degree of suppression. The expression of the truncation processing function is:

[0106] .

[0107] The preset cutoff threshold The value is selected according to the actual situation of the image.

[0108] For example, the cutoff threshold Set to 30, in a low-texture neighborhood, the grayscale value of the central pixel is 50, and the grayscale values ​​of the surrounding 8 pixels are 48, 49, 47, 51, 52, 57, 45, 200. The last pixel is affected by noise and other factors and presents a larger value. After adding truncation processing, the influence of the pixel with a grayscale value of 200 on the pixel difference dif will be significantly reduced, and the final calculated detail intensity can better reflect the characteristics of the real scene.

[0109] S4, generating a coefficient mask according to the pixel difference;

[0110] This embodiment uses pixel differences to select coefficient mask types, thereby adjusting the DCT filtering strength; the coefficient mask generation formula is:

[0111] ;

[0112] in, is the first threshold, is the second threshold; , is a double threshold for determining detail intensity; is a low detail threshold, is a high detail threshold;

[0113] , are parameters in the image processing algorithm. When processing 8-bit images, the value range of the two parameters is between 0 and 765, and To be less than .

[0114] , The value can be obtained through debugging effects. If you want to get a stronger noise reduction effect, you can set the value to a larger value.

[0115] When the detail intensity is less than , the current window is considered to be the first region and the first mask is used As a coefficient mask; when the detail intensity is between and When the current window is between , the current window is considered to be a medium detail area and the second mask is used As a coefficient mask; when the detail intensity is greater than When the current window is considered to be a high-detail area, the third mask is used as a coefficient mask;

[0116] In this embodiment, the first mask The value of , the second mask The value of , the third mask The value of .

[0117] The first mask For low detail mask, second mask For medium detail mask, third mask For high detail mask.

[0118] S5, performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask;

[0119] Based on DCT transformation, adaptive noise reduction processing is performed according to detail intensity. In step S2, the pixels where the G channel is located are sampled to obtain a 3x3 data window.

[0120] For example, in the image denoising process, if the current pixel is in the G channel, use Figure 2 For the local image data obtained by sampling the window shown, select all pixels with non-zero weights, select 9 pixels along the diagonal direction, that is, from the lower left corner to the upper right corner (the weights corresponding to the 9 pixels are 0.25, 0.5, 0.25, 0.5, 1, 0.5, 0.25, 0.5,0.25 respectively), and then rearrange them into a 3x3 rectangular window to obtain a 3x3 data window.

[0121] If the current pixel is the R / B channel, use Figure 3 The local image data obtained by window sampling shown in the figure selects all pixels whose weights are not 0, selects 9 pixels in the horizontal direction, that is, from left to right, and then rearranges them into a 3x3 rectangular window to obtain a 3x3 data window.

[0122] After performing DCT transformation on the data in the data window, a DCT coefficient is obtained. The DCT coefficient is a 3x3 matrix, the upper left corner of the matrix corresponds to the low-frequency component, and the lower right corner of the matrix corresponds to the high-frequency component. The formula of the DCT transformation is as follows: ;

[0123] in, is the coefficient value after DCT transformation, i.e., the DCT coefficient, is the grayscale value before pixel transformation, N is the number of pixels of the window size. In this embodiment, because the sampling window size is 3 pixels x 3 pixels, the value of N here is 3, and the value of N can be adjusted according to the number of pixels of the sampling window; i, j are the pixel coordinate indexes of the NxN window before DCT transformation; u, v are the coefficient coordinate indexes of the NxN window after DCT transformation; and They are the first compensation factor and the second compensation factor respectively, and the calculation formulas of the first compensation factor and the second compensation factor are: .

[0124] After DCT transformation, most of the energy is concentrated in the low-frequency components. When the detail intensity in the window is small, the proportion of low-frequency components is high; when the detail intensity in the window is large, it means that the proportion of high-frequency components is high. Therefore, the present invention uses the detail intensity to select the type of coefficient mask, thereby adjusting the filtering intensity of DCT.

[0125] Specifically, the process of processing the DCT coefficient by the coefficient mask is that when the coefficient mask is 1, the original coefficient of the DCT coefficient at that position is retained, and when the coefficient mask is 0, the value of the DCT coefficient at that position is set to 0, thereby achieving the effect of suppressing noise.

[0126] For example, the DCT coefficients are , the mask is , after processing the DCT coefficients through the coefficient mask, we get .

[0127] S6, performing inverse DCT transformation on the adjusted DCT coefficients to obtain a preliminary denoised image;

[0128] According to the reversibility of DCT transformation, the denoised local image after denoising can be restored by inverse DCT transformation. The formula of inverse DCT transformation is as follows:

[0129] ;

[0130] in, is the DCT coefficient after mask processing and adjustment, is the denoised local image after inverse DCT transformation, and are the third compensation factor and the fourth compensation factor, and The calculation formula of is the same as the calculation formula of the first compensation factor and the second compensation factor.

[0131] Specifically, the adjusted DCT coefficients are subjected to an inverse DCT transform to obtain a denoised local image, and a central pixel of the local image is taken as a denoised pixel.

[0132] Taking the current point of the original image as the center, a 3x3 sliding window is used to traverse all pixels in turn. After the above processing, the denoised pixels corresponding to all pixels can be obtained, thereby forming a complete preliminary denoised image.

[0133] S7. After adjusting the noise suppression factor according to the exposure gain, the preliminary denoised image is adjusted to obtain a final denoised image.

[0134] Finally, use the suppression factor adjusted according to the exposure gain. After the above steps, a preliminary noise-reduced Bayer-format image after noise reduction is obtained in this embodiment. However, the degree of noise suppression needs to be further adjusted. Refer to Figure 4 , in the process of acquiring an image by the hardware circuit, the strength of the noise is closely related to the exposure gain of the image. The magnitude of the exposure gain can represent the magnitude of the image noise. The larger the exposure gain, the darker the environment, the greater the image noise, and the larger the noise suppression factor needs to be set. Thus, the relationship between the exposure gain gain and the noise suppression factor is established as follows:

[0135] ;

[0136] where str0 is the suppression factor corresponding to 1-fold exposure gain; str1 is the suppression factor corresponding to 2-fold exposure gain; str2 is the suppression factor corresponding to 4-fold exposure gain; str3 is the suppression factor corresponding to 8-fold exposure gain; str4 is the suppression factor corresponding to 16-fold exposure gain; str5 is the suppression factor corresponding to 32-fold exposure gain; str6 is the suppression factor corresponding to 64-fold exposure gain; str7 is the suppression factor corresponding to 128-fold and above exposure gain;

[0137] The values of str0 - str7 need to be obtained through debugging, where str0 < str1 < str2 < str3 < str4 < str5 < str6 < str7. Generally, the larger the exposure gain, the heavier the image noise, and the larger the value of the suppression factor needs to be set.

[0138] The difference noise image is obtained by taking the difference between the initial image and the preliminary noise-reduced image, as shown in the following formula:

[0139] ,

[0140] where s1 is the initial image, s2 is the preliminary noise-reduced image, and d is the difference noise image;

[0141] Add the noise suppression factor to the difference noise image, and then superimpose it on the original image to obtain the final noise-reduced image , as shown in the following formula:

[0142] ,

[0143] A Bayer image noise reduction method provided in this embodiment includes the following steps:

[0144] S1. Obtain the initial image in Bayer format; S2. Sample the initial image through the denoising window to obtain local image data, and assign weights to the neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window; S3. Calculate the pixel difference according to the difference and weight between the neighboring pixels and the central pixel; S4. Generate a coefficient mask according to the pixel difference; S5. Perform DCT transformation on the local image data to obtain DCT coefficients, and adjust the DCT coefficients through the coefficient mask; S6. Perform DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image; S7. Adjust the preliminary denoised image after adjusting the noise suppression factor according to the exposure gain to obtain the final denoised image. When denoising the Bayer image, this embodiment designs different templates for the data of the G channel and the R / B channel, and adopts different neighborhood ranges, which effectively reduces and eliminates the noise in the Bayer image and greatly improves the denoising effect of the algorithm.

[0145] In addition, when calculating the detail intensity of the window, this embodiment takes into account the influence of spatial distance and grayscale distance, assigns a weight that follows a power exponential relationship to each pixel, and can replace floating-point multiplication operations with shift operations during calculations, effectively improving calculation efficiency.

[0146] In addition, when calculating the detail intensity of the window, this embodiment adopts truncation processing on the obtained difference result to reduce and eliminate the influence of abnormal values, thereby further improving the noise reduction effect.

[0147] Furthermore, this embodiment uses DCT transformation to filter the image, and selects different coefficient masks according to detail intensity to adjust the DCT coefficients, thereby performing adaptive noise reduction.

[0148] Furthermore, this embodiment introduces exposure gain to link the ambient brightness and the noise suppression factor, thereby further optimizing the noise reduction effect.

[0149] Embodiment 2

[0150] Please see attached Figure 5 The embodiment of the present invention discloses a Bayer image noise reduction device, comprising the following units:

[0151] An initial image acquisition unit, used for acquiring an initial image in a Bayer format;

[0152] A weight allocation unit, configured to obtain local image data by sampling the initial image through a denoising window, and to allocate weights to neighbouring pixels according to the spatial distance between the neighbouring pixels and the central pixel in the denoising window;

[0153] A pixel difference calculation unit, used for calculating the pixel difference according to the difference and weight between the neighborhood pixel and the central pixel;

[0154] A coefficient mask generating unit, configured to generate a coefficient mask according to the pixel difference;

[0155] A DCT coefficient optimization unit, used for performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask;

[0156] A preliminary denoised image generating unit, used for performing DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image;

[0157] The exposure gain optimization unit is used to adjust the preliminary denoised image after adjusting the noise suppression factor according to the exposure gain to obtain a final denoised image.

[0158] A Bayer image denoising device provided in an embodiment of the present invention can execute a Bayer image denoising method provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. It is worth noting that in the device provided in an embodiment of the present invention, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0159] Embodiment 3

[0160] Please see attached Figure 6 , Figure 6 1 is a schematic diagram of the structure of a Bayer image noise reduction device according to an embodiment of the present invention. The device 20 includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above device embodiments are implemented.

[0161] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the Bayer image noise reduction device 20. For example, the computer program may be divided into the modules in the second embodiment. For the specific functions of each module, please refer to the working process of the device described in the above embodiment, which will not be repeated here.

[0162] The Bayer image noise reduction device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art may understand that the schematic diagram is only an example of a Bayer image noise reduction device 20 and does not constitute a limitation on the Bayer image noise reduction device 20. The Bayer image noise reduction device 20 may include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the Bayer image noise reduction device 20 may also include input and output devices, network access devices, buses, etc.

[0163] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the Bayer image noise reduction device 20, and uses various interfaces and lines to connect various parts of the entire Bayer image noise reduction device 20.

[0164] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the Bayer image noise reduction device 20 by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0165] Wherein, if the module / unit integrated in the Bayer image noise reduction device 20 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor 21, the steps of the above-mentioned method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.

[0166] It should be noted that the device embodiments described above are merely schematic, 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 embodiments of the present invention. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between the modules, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement the invention without creative work.

[0167] So far, the technical solutions of the present invention have been described in combination with examples, but it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A Bayer image denoising method, characterized in that: include: S1, obtain the initial image in Bayer format; S2, sampling the initial image through the denoising window to obtain local image data, and assigning weights to the neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window; S3, calculating pixel difference according to the difference and weight between the neighborhood pixel and the central pixel; S4, generating a coefficient mask according to the pixel difference; S5, performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask; S6, performing inverse DCT transformation on the adjusted DCT coefficients to obtain a preliminary denoised image; S7, adjusting the noise suppression factor according to the exposure gain and adjusting the preliminary denoised image to obtain a final denoised image; Step S7 includes: obtaining an algorithm noise image by performing a difference between the initial image and the denoised image, as shown in the following formula: ; Among them, s1 is the initial image, s2 is the preliminary denoised image, and d is the difference noise image; Adding noise suppression factor to difference noisy image , and then superimposed on the original image to obtain the final denoised image , as shown below: ; in, is the noise suppression factor, and the calculation formula of the noise suppression factor is as follows: ; Among them, str0 is the suppression factor corresponding to 1 times exposure gain; str1 is the suppression factor corresponding to 2 times exposure gain; str2 is the suppression factor corresponding to 4 times exposure gain; str3 is the suppression factor corresponding to 8 times exposure gain; str4 is the suppression factor corresponding to 16 times exposure gain; str5 is the suppression factor corresponding to 32 times exposure gain; str6 is the suppression factor corresponding to 64 times exposure gain; str7 is the suppression factor corresponding to 128 times and above exposure gain; gain is the exposure gain.

2. The method according to claim 1, characterized in that The noise reduction window in step S2 has different window sizes according to different pixel channel types, and the range of the noise reduction window is an area surrounded by a first preset number of pixels of the same channel type that are closest to the center pixel.

3. The method according to claim 1, characterized in that In step S2, weights are assigned to neighboring pixels according to the spatial distance between the neighboring pixels and the central pixel in the denoising window. Specifically, in the denoising window, the weights of pixels having the same channel type as the central pixel are inversely proportional to the spatial distance to the central pixel, and the weight assignment follows a power exponential relationship.

4. The method according to claim 1, characterized in that: The formula for calculating the pixel difference according to the difference between the neighborhood pixel and the central pixel and the weight in step S3 is specifically: ; Among them, dif is the pixel difference; w is the weight of the neighborhood pixel in the denoising window, is the grayscale value of the i-th point in the window, is the grayscale value of the center pixel, m is the value of the first preset number, and mid is the center pixel number.

5. The method according to claim 1, characterized in that The formula for generating the coefficient mask in step S4 is: ; Among them, mask is the coefficient mask; is the first threshold, is the second threshold; is the first mask; is the second mask; For the third mask.

6. The method according to claim 1, characterized in that The formula for the DCT transformation in step S5 is as follows: ; in, is the coefficient value after DCT transformation, i.e., the DCT coefficient, is the grayscale value before pixel transformation, N is the number of pixels of the window size; i, j are the pixel coordinate indexes of the NxN window before DCT transformation; u, v are the coefficient coordinate indexes of the NxN window after DCT transformation; and They are the first compensation factor and the second compensation factor respectively, and the calculation formulas of the first compensation factor and the second compensation factor are: .

7. The method according to claim 4, characterized in that Step S3 also includes: removing abnormal pixels in the noise reduction window by a truncation processing function to obtain an optimized pixel difference dif, as shown in the following formula: ; in, is the preset cutoff threshold; is the truncation processing function, and its expression is: , where x is the grayscale value.

8. A Bayer image noise reduction device, characterized in that: The following units are included: An initial image acquisition unit, used for acquiring an initial image in a Bayer format; A weight allocation unit, configured to obtain local image data by sampling the initial image through a denoising window, and to allocate weights to neighbouring pixels according to the spatial distance between the neighbouring pixels and the central pixel in the denoising window; A pixel difference calculation unit, used for calculating the pixel difference according to the difference and weight between the neighborhood pixel and the central pixel; A coefficient mask generating unit, configured to generate a coefficient mask according to the pixel difference; A DCT coefficient optimization unit, used for performing DCT transformation on the local image data to obtain DCT coefficients, and adjusting the DCT coefficients through the coefficient mask; A preliminary denoised image generating unit, used for performing DCT inverse transformation on the adjusted DCT coefficients to obtain a preliminary denoised image; The exposure gain optimization unit is used to adjust the preliminary denoised image to obtain a final denoised image after adjusting the noise suppression factor according to the exposure gain; specifically, it includes: obtaining a difference noise image by taking a difference between the initial image and the preliminary denoised image, as shown in the following formula: ; Among them, s1 is the initial image, s2 is the preliminary denoised image, and d is the difference noise image; Adding noise suppression factor to difference noisy image , and then superimposed on the original image to obtain the final denoised image , as shown below: ; in, is the noise suppression factor, and the calculation formula of the noise suppression factor is as follows: ; Among them, str0 is the suppression factor corresponding to 1 times exposure gain; str1 is the suppression factor corresponding to 2 times exposure gain; str2 is the suppression factor corresponding to 4 times exposure gain; str3 is the suppression factor corresponding to 8 times exposure gain; str4 is the suppression factor corresponding to 16 times exposure gain; str5 is the suppression factor corresponding to 32 times exposure gain; str6 is the suppression factor corresponding to 64 times exposure gain; str7 is the suppression factor corresponding to 128 times and above exposure gain; gain is the exposure gain.

9. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • SAR image denoising method based on AD-NSCT algorithm

    CN103413279A

  • Image noise reduction method which utilizes partitioning ordering to detect noise

    CN105787902A

  • Bayer domain image noise reduction system and method based on non-local mean filtering

    CN110246089A

  • Image color noise reduction method and system

    CN112819721A

  • High-precision rapid focus detection method based on push-broom underwater hyperspectral original image

    CN113989143A