Video noise reduction method based on hybrid filtering
By adopting a hybrid filtering method in video noise reduction, using pixel value weighting calculation and numerical sorting in local windows, dynamically adjusting the filter weight, the problem of insufficient mixed noise suppression ability in complex scenarios is solved, and better noise suppression and detail retention effects are achieved.
Patent Information
- Application Number
- CN202510448786.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-04-10
AI Technical Summary
When dealing with video noise reduction in complex scenes, the prior art faces the problems of insufficient mixed noise suppression capabilities, imbalance in detail retention and noise suppression.
The video noise reduction method based on mixed filtering is adopted, and the weights of the median and mean filters are dynamically adjusted through the weighting of the pixel value set in the local window, and the filtering mode is adaptively selected based on the local variance and preset thresholds to take into account noise suppression and detail retention.
It significantly improves the ability to suppress mixed noise, improves the visual consistency and subjective visual quality of the image, and avoids the imbalance between noise suppression and detail retention.
Smart Images

Figure CN120219228A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of video noise reduction processing, and particularly relates to a video noise reduction method based on hybrid filtering. Background Art
[0002] Video noise reduction technology is an important research direction in the field of image processing. Especially in complex scenarios such as industrial monitoring, security monitoring, and construction sites, the video quality is severely affected by noise interference (such as Gaussian noise, salt-and-pepper noise, electromagnetic interference, etc.), resulting in the loss of key information or misjudgment. Traditional noise reduction methods mainly rely on a single filter (such as mean filtering or median filtering), but there are significant limitations.
[0003] Mean filtering has a good effect on suppressing Gaussian noise, but it is easy to blur the image edges and texture details, and is ineffective against impulse noise (such as salt-and-pepper noise); median filtering can effectively remove impulse noise and retain edges, but has insufficient ability to suppress Gaussian noise, and has a high computational complexity under large windows, making it difficult to achieve real-time processing.
[0004] In recent years, adaptive hybrid filtering methods have gradually become a research hotspot, by dynamically adjusting the filtering strategy to balance noise suppression and detail preservation. For example, some methods judge the noise type through local statistical characteristics (such as gradient, variance) and switch the filtering mode.
[0005] However, traditional adaptive methods are mostly optimized for a single noise type and are difficult to handle mixed noise in complex scenarios (such as the Gaussian noise from sensors and the impulse noise caused by sudden radio wave interference existing simultaneously in construction site videos). Patent CN114399447B discloses a mean filtering method and system, which can process local regions, but has no ability to suppress impulse noise, resulting in salt-and-pepper noise points still existing in the denoised image.
[0006] Moreover, existing methods rely too much on mean filtering in flat regions (low texture), resulting in edge blurring, and rely on median filtering in edge regions (high gradient) to retain details, but cannot eliminate the residual Gaussian noise. For example, the sawtoothing or motion blur of the pile foundation contour in a construction site video will lose key features due to excessive smoothing by mean filtering.
[0007] When dealing with video noise reduction in complex scenarios, the existing technology faces core problems such as insufficient ability to suppress mixed noise and imbalance between detail preservation and noise suppression. Summary of the Invention
[0008] The present invention provides a video noise reduction method based on hybrid filtering to solve the problems of insufficient ability to suppress mixed noise and imbalance between detail preservation and noise suppression when the existing technology deals with video noise reduction in complex scenarios.
[0009] The technical solution adopted by the present invention is as follows:
[0010] A video noise reduction method based on hybrid filtering, comprising:
[0011] According to the frame-by-frame images in the video, through a selected local window, obtain a set of pixel values at each pixel position within the local window;
[0012] According to the set of pixel values, combined with pixel weight weighting, obtain a set of weighted pixel values, and through the numerical sorting of the set of weighted pixel values, obtain a corrected median pixel value and a corrected mean pixel value;
[0013] Obtain a local variance according to the corrected median pixel value and the corrected mean pixel value, combine a preset threshold to obtain a local weight, and combine the corrected median pixel value and the corrected mean pixel value to obtain a noise-reduced pixel value.
[0014] The video noise reduction method based on hybrid filtering in the present invention further includes the following additional technical features:
[0015] The size of the local window, the pixel weight, and the preset threshold are specifically:
[0016] According to the video position, obtain a target image;
[0017] Pre-set multiple groups of the size of the local window, the pixel weight, and the preset threshold, process at least one frame of the image in the video, and obtain a noise-reduced image;
[0018] According to the comprehensive cumulative variance between the noise-reduced image and the target image, obtain the size of the local window, the pixel weight, and the preset threshold.
[0019] Pre-setting multiple groups of the size of the local window, the pixel weight, and the preset threshold is specifically:
[0020] Pre-set the size of the local window to be 3×3 or 5×5;
[0021] The preset threshold is pre-set according to the noise level of the processed video image;
[0022] The pixel weight is pre-set according to the distance between the position of the pixel value and the center point of the local window. Among them, the smaller the distance, the greater the pixel weight, and the pixel weight corresponding to the center point of the local window is greater than or equal to 0.2.
[0023] The comprehensive cumulative variance between the noise-reduced image and the target image is specifically:
[0024] When processing one frame of the image in the video, obtain the cumulative variance between a noise-reduced image and the target image, and the comprehensive cumulative variance is the cumulative variance;
[0025] When processing multiple frames of images in a video, multiple cumulative variances between the denoised images and the target image are obtained, and the comprehensive cumulative variance is obtained by summing / averaging.
[0026] Through the numerical sorting of the weighted pixel value set, the corrected median pixel value and the corrected mean pixel value are obtained, specifically:
[0027] After the numerical sorting of the weighted pixel value set, the value corresponding to the median position is the corrected median pixel value;
[0028] The corrected mean pixel value is obtained by summing the values in the weighted pixel value set.
[0029] The local variance is obtained based on the corrected median pixel value and the corrected mean pixel value, specifically:
[0030] The squared difference is obtained based on the corrected median pixel value and the corrected mean pixel value;
[0031] Based on the squared differences corresponding to multiple pixel values within the local window, the sum of squared differences corresponding to the local window is obtained, and after normalization in combination with the size of the local window, the local variance is obtained.
[0032] The local variance is combined with a preset threshold to obtain the local weight, specifically:
[0033]
[0034] Among them, (i, j) is the coordinate of the pixel position, σ 2 (i,j) is the local variance of the local window corresponding to the pixel position, T is the preset threshold, and α(i,j) is the local weight corresponding to the pixel position.
[0035] The local weight is combined with the corrected median pixel value and the corrected mean pixel value to obtain the denoised pixel value, specifically:
[0036] Through the local weight, the weighting coefficients of the corrected median pixel value and the corrected mean pixel value are determined, and the corrected median pixel value and the corrected mean pixel value are weighted to obtain the denoised pixel value.
[0037] I out (i, j) = α(i, j)·I median (i, j) + (1 - α(i, j))·I mean (i, j)
[0038] Among them, I mean (i, j) is the corrected mean pixel value, I median (i,j) is the corrected median pixel value, I out(i,j) is the pixel value after noise reduction.
[0039] The video noise reduction method based on hybrid filtering further includes:
[0040] Perform noise reduction on the pixel points of each frame image in the video to obtain the pixel values after noise reduction;
[0041] After traversing and noise-reducing each pixel point of each frame image in the video, a noise-reduced video is obtained according to the combination of multiple said pixel values.
[0042] The present invention also provides an electronic device, including:
[0043] A memory for storing computer instructions;
[0044] A processor for implementing the video noise reduction method based on hybrid filtering when executing the computer instructions.
[0045] Due to the adoption of the above technical solutions, the beneficial effects achieved by the present invention are:
[0046] 1. In the present invention, the local variance is obtained according to the corrected median pixel value and the corrected mean pixel value, combined with a preset threshold to obtain the local weight, and combined with the corrected median pixel value and the corrected mean pixel value to obtain the pixel value after noise reduction. Through the local weight, combined with median and mean filtering, the weights of median and mean filtering in the region dominated by impulse noise (such as salt-and-pepper noise) and in the region dominated by Gaussian noise are adjusted. In the region dominated by impulse noise (such as salt-and-pepper noise), median filtering is preferentially used to suppress outliers, and in the region dominated by Gaussian noise, mean filtering is preferentially used to smooth the noise. The superimposed influence of dust interference (Gaussian noise) and electrical wave surges (impulse noise) in the construction site video is significantly reduced, and the noise suppression rate is improved.
[0047] In addition, median filtering retains the gradient information while suppressing noise in the edge region, and mean filtering reduces the Gaussian noise residue in the flat region, avoiding the loss of details caused by a single filtering mode in the traditional method.
[0048] 2. In the present invention, according to the set of pixel values, combined with pixel weighting, a set of weighted pixel values is obtained. Through the numerical sorting of the set of weighted pixel values, a corrected median pixel value and a corrected mean pixel value are obtained. By comprehensively processing the pixel points within a local window instead of only operating on a single pixel value, this method significantly improves the robustness and accuracy of image processing. First, in terms of noise suppression, the set of pixel values within the local window is weighted and sorted, effectively reducing the influence of isolated noise points. For example, in the salt-and-pepper noise area, outliers (such as mutated bright or dark points) are weakened after weighted sorting, and the corrected median pixel value is closer to the true value. At the same time, the combination of dynamic weight allocation enables the algorithm to handle both Gaussian noise and impulse noise simultaneously, avoiding the limitations of a single filter for complex noise scenarios.
[0049] Secondly, in terms of detail preservation, the pixel weight allocation will be automatically adjusted according to neighborhood features (such as gradient information), so as to preferentially preserve the pixel values with higher gradients in the edge area, avoiding the blurring effect caused by mean filtering; the corrected median pixel value can better preserve the edge sharpness while suppressing noise, while the corrected mean pixel value can reflect the overall trend of the local area, ensuring the continuity of details within the flat area.
[0050] In addition, this processing method improves the computational stability, reduces the interference of noise on the result, and through the numerical sorting of the set of weighted pixel values, the corrected median and the corrected mean more accurately reflect the true distribution characteristics of the local area, avoiding the deviation introduced by noise. Finally, this method not only enhances the visual consistency of the image, avoiding local incoordination phenomena (such as spots or jaggedness) caused by single-point processing, but also achieves a natural transition between noise reduction and smoothing, eliminating noise while retaining key details and improving the subjective visual quality of the image.
[0051] In summary, the method based on the comprehensive processing of pixel points within a local window has stronger noise suppression ability, higher detail preservation accuracy, and better computational stability. Brief Description of the Drawings
[0052] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0053] Figure 1 It is a schematic flowchart of the video noise reduction method based on hybrid filtering according to an embodiment of the present invention. Detailed Embodiment
[0054] In order to more clearly illustrate the overall concept of the present invention, the following will be described in detail by way of examples in combination with the drawings of the specification.
[0055] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the scope of protection of the present invention is not limited by the specific embodiments disclosed below.
[0056] As Figure 1 shown, a video noise reduction method based on hybrid filtering includes:
[0057] S100: According to the frame-by-frame images in the video, through a selected local window, obtain the set of pixel values at each pixel position within the local window.
[0058] The main purpose of this step is to extract the set of pixel values at each pixel position within the selected local window from the frame-by-frame images in the video. This step is the basis for subsequent processing. By obtaining the information of pixel values in the neighborhood, it provides data support for subsequent weighted calculation, sorting, and noise suppression.
[0059] Among them, the local window refers to a fixed-size area around the target pixel point for collecting adjacent pixel values. Common window sizes are 3×3, 5×5, etc.
[0060] It can be understood that this step processes each pixel position in the frame-by-frame images of the video. One pixel position corresponds to one local window, so as to comprehensively process this pixel position through all the pixel values within the local window.
[0061] After processing all pixel positions of an image, the denoised image corresponding to this frame is combined. After processing all frame images in the video, the denoised images are combined to obtain the denoised video. The pixel position refers to the pixels included in the width and height of the image, usually represented in the form of width×height. For example, 1280×720 means the image width is 1280 pixels and the height is 720 pixels.
[0062] First, it is necessary to collect video data on-site and select the highest currently supported resolution (such as 1280×720) for processing.
[0063] For each frame image, traverse each pixel position (i, j) and define a local window W. This local window is used to capture all relevant pixel values around this pixel position.
[0064] Let the currently processed pixel position be (i, j), and its neighborhood window size be k×k (such as 3×3 or 5×5). The set of pixel values within the window is:
[0065]
[0066] Among them, I(i,j) represents the pixel value of the original image at the position (i,j), and m and n are any integers between.
[0067] Specifically, the window size is usually selected as a 3×3 or 5×5 window. A too large window will result in loss of details, while a too small window may not be able to effectively capture neighborhood information. The choice of window size should be adjusted according to the specific application scenario to achieve the best noise reduction effect.
[0068] In addition, it can be understood that for the pixel positions at the edges of the image, if a part of the local window exceeds the image boundary, appropriate processing (such as padding or ignoring) needs to be performed on the exceeded part to ensure the validity of all pixel values.
[0069] In a specific embodiment, a real-time video stream of the construction site is collected by a high-definition camera with a resolution of 1280×720.
[0070] For each frame of the image, it is processed pixel by pixel. For example, in a certain frame, we focus on the pixel at the position (100,150).
[0071] Define a 3×3 local window, and the set of pixel values within this window is:
[0072] W = {I(99,149), I(99,150), I(99,151), I(100,149), I(100,150), I(100,151), I(101,149), I(101,150), I(101,151)}
[0073] If a part of this window exceeds the image boundary, the following several processing methods can be adopted: the padding method, using mirror reflection, copying edge pixels or constant values to pad the exceeded part. The ignoring method, directly ignoring the exceeded part and only considering the valid pixel values.
[0074] This step lays the foundation for subsequent weighted calculation and noise suppression by processing each frame of the image in the video pixel by pixel and defining an appropriate local window to obtain the set of pixel values in the neighborhood. This process not only ensures the integrity and validity of the data but also provides the necessary input data for implementing efficient hybrid filtering.
[0075] S200: According to the set of pixel values, combined with pixel weights for weighting, obtain a set of weighted pixel values, and through the numerical sorting of the set of weighted pixel values, obtain the corrected median pixel value and the corrected mean pixel value.
[0076] The purpose of this step is to perform weighted processing based on the set of pixel values within the local window in combination with pixel weights to obtain a set of weighted pixel values. Then, by sorting the set of weighted pixel values, the corrected median pixel value and the corrected mean pixel value are calculated. This process can effectively suppress noise and preserve image details, and is particularly suitable for video noise reduction in complex noise environments.
[0077] Among them, the set of weighted pixel values refers to the set obtained by multiplying each pixel value within the local window by its corresponding weight.
[0078] The corrected median pixel value refers to the pixel value corresponding to the median position after sorting the set of weighted pixel values, which is used to process salt-and-pepper noise.
[0079] The corrected mean pixel value refers to the weighted average of the set of weighted pixel values, which is used to process Gaussian noise.
[0080] In this step, for each pixel point within the local window, a weight matrix W is defined. The weight of the central pixel (i.e., the current pixel position being processed) is the highest, with a recommended value exceeding 0.2, and the weights of the remaining pixels decrease according to their distance from the central point.
[0081] Multiply each pixel value by its corresponding weight to obtain the set of weighted pixel values W:
[0082] W = {I(i + m, j + n) × w(i + m, j + n) | m, n ∈ [-k / 2, k / 2]}
[0083] Among them, w(i,j) is the weight of the central pixel, with a recommended value greater than or equal to 0.2; w(i + m, j + n) is the weight of other pixels.
[0084] Sort the set of weighted pixel values W and take the pixel value corresponding to the median position as the corrected median pixel value I median (i, j).
[0085] I median (i, j) = median (m,n)∈[-k / 2,k / 2] {I(i + m, j + n) × w(i + m, j + n)}
[0086] This step is suitable for processing salt-and-pepper noise and reducing radio interference.
[0087] Calculate the weighted average of the set of weighted pixel values W to obtain the corrected mean pixel value I mean (i, j).
[0088]
[0089] This step is suitable for processing Gaussian noise and reducing dust interference.
[0090] In this step, the weight of the central pixel should be set to a relatively high value (e.g., 0.2) to ensure its dominance in the weighting process. The weights of the remaining pixels decrease according to their distance from the central pixel, with the closer pixels having larger weights.
[0091] Through the weighting process, the influence of noise on the final result can be effectively reduced. For example, in the salt-and-pepper noise area, outliers will be significantly weakened; while in the Gaussian noise area, the weighted average can better smooth the noise.
[0092] Generally speaking, through the weighting process in this step, the corrected median pixel value and the corrected mean pixel value can more accurately reflect the true pixel values in the local area, thus effectively suppressing noise. For example, in the salt-and-pepper noise area, the corrected median pixel value can significantly reduce the sudden bright or dark points; in the Gaussian noise area, the corrected mean pixel value can smooth the background noise.
[0093] In addition, the corrected median pixel value can retain the edge information while suppressing noise, avoiding the blurring effect caused by traditional mean filtering. The corrected mean pixel value can reduce the noise residue in the flat area, ensuring the continuity of details.
[0094] As a specific embodiment, for the pixel position (100, 150) in a certain frame, a 3×3 local window is defined. Assuming the weight of the central pixel is 0.2 and the weights of the surrounding pixels are 0.1, 0.15, etc., a weight matrix W is formed.
[0095] Calculate the weighted pixel value set W:
[0096] W = {I(99, 149)×0.1, I(99, 150)×0.15, I(99, 151)×0.1, I(100, 149)×0.15, I(100, 150)×0.2, I(100, 151)×0.15, I(101, 149)×0.1, I(101, 150)×0.15, I(101, 151)×0.1}
[0097] Sort the weighted pixel value set W, and take the pixel value corresponding to the median position as the corrected median pixel value I median (100, 150). For example, if the median after sorting is 128, then I median (100, 150) = 128.
[0098] Calculate the weighted average of the weighted pixel value set W to obtain the corrected mean pixel value I mean (100, 150). For example, if the weighted average is 130, then I mean (100, 150) = 130.
[0099] In this step, by defining appropriate pixel weights, the pixel values within the local window are weighted, and the corrected median pixel value and the corrected mean pixel value are obtained through sorting. This process not only enhances the noise suppression effect but also effectively protects the edge and detail features of the image, and is particularly suitable for video noise reduction processing in complex noise environments. Through reasonable weight allocation and weighting processing, the quality and visual consistency of the image can be significantly improved.
[0100] S300: Obtain the local variance based on the corrected median pixel value and the corrected mean pixel value, combine it with a preset threshold to obtain the local weight, and combine the corrected median pixel value and the corrected mean pixel value to obtain the pixel value after noise reduction.
[0101] The purpose of this step is to achieve adaptive noise reduction for different noise type regions by dynamically adjusting the weights of median and mean filtering. Specifically, the local variance is used to quantify the noise intensity of the current region, distinguishing Gaussian noise (low variance) from impulse noise (high variance). According to the comparison result between the local variance and the preset threshold, the weights of median and mean filtering are dynamically adjusted, enabling the algorithm to preferentially suppress outliers (dominated by the median) in the impulse noise region and preferentially smooth the noise (dominated by the mean) in the Gaussian noise region. By weighted combination of the corrected median and the corrected mean, the pixel value after noise reduction is output, balancing noise suppression and detail preservation.
[0102] Among them, the local variance is used to measure the degree of dispersion of pixel values within the local window. The larger the variance, the higher the noise intensity, especially for impulse noise (such as salt-and-pepper noise).
[0103] The preset threshold is used to distinguish the critical value between Gaussian noise and impulse noise. Its size is preset according to the noise level and is usually determined through experiments or noise statistics.
[0104] The local weight is used to dynamically adjust the coefficients contributed by median and mean filtering, and its value range is [0,1]. The larger the weight, the higher the contribution of median filtering, and vice versa for the contribution of mean filtering.
[0105] For each pixel point (i,j), based on the corrected median pixel value I median (i,j) and the corrected mean pixel value I mean (i,j), calculate the local variance σ 2 (i,j),
[0106]
[0107] Among them, k×k is the size of the local window. The local variance can effectively measure the noise intensity. The larger the variance, the more significant the impulse noise (such as salt-and-pepper noise), and vice versa, Gaussian noise dominates.
[0108] According to the preset threshold T and the local variance σ 2 (i, j), calculate the local weight α(i, j) through the weight function,
[0109]
[0110] It can be understood that when σ 2 >> T (impulse noise dominates), α ≈ 1, and the weight biases towards the corrected median pixel value.
[0111] When σ 2 << T (Gaussian noise dominates), α ≈ 0, and the weight biases towards the corrected mean pixel value.
[0112] The weight function realizes smooth switching through a rational function form, avoiding the mutation problem of traditional binary thresholding and enhancing the robustness of the algorithm.
[0113] According to the weight α(i, j), linearly combine the corrected median and the corrected mean to obtain the denoised pixel value I out (i, j),
[0114] I out (i, j) = α(i, j) · I median (i, j) + (1 - α(i, j)) · I mean (i, j)
[0115] Through dynamic weight allocation, the algorithm preferentially preserves details in the edge region (high impulse noise) and preferentially eliminates noise residues in the flat region (Gaussian noise), avoiding the defects of traditional single filtering.
[0116] It can be understood that by comparing the local variance with the threshold T, quickly determine the noise type of the current region:
[0117] The closer α(i, j) is to 1, impulse noise dominates, that is, the median weight is high and outliers are suppressed; the closer α(i, j) is to 0, Gaussian noise dominates, that is, the mean weight is high and the noise is smoothed. The threshold T is preset according to the noise level and can be determined through experiments or noise estimation (such as dark area variance statistics) to ensure adaptability to different scenarios.
[0118] The weight function α(i, j) adopts a rational function form instead of hard threshold switching to ensure smooth weight change and avoid sudden changes in the filtering mode caused by instantaneous noise fluctuations.
[0119] In a specific embodiment, assume that when processing a pixel point (200, 300) in a construction site video, its local window is 3×3.
[0120] The corrected mean I mean = 120, the corrected median Imedian = 125.
[0121] Calculate the mean of the squared differences of each pixel within the calculation window:
[0122]
[0123] The variance is 25, indicating the presence of medium-intensity noise.
[0124] The preset threshold T = 10,
[0125]
[0126] The weight is biased towards median filtering (71.4%) because the variance is significantly higher than the threshold, suggesting the presence of impulse noise (such as radio interference).
[0127] According to the corrected median I median = 125 and the corrected mean I mean = 120, we get
[0128] I out = 0.714×125 + 0.286×120 ≈ 124.5
[0129] The output value is closer to the corrected median, effectively suppressing outliers (such as mutated highlighted pixels) while retaining edge details.
[0130] In this step, by comparing the local variance with the threshold, the algorithm can switch the filtering mode in real time. For example, in a construction site video, areas with dust interference (Gaussian noise) (low variance) mainly use mean filtering, while areas with radio spikes (impulse noise) (high variance) mainly use median filtering, significantly improving the noise suppression rate.
[0131] In addition, in the edge area (such as the pile foundation contour), due to the increase in variance caused by impulse noise, the weight is biased towards median filtering to avoid blurring the edge by mean filtering. For example, reducing the jaggedness of the pile driver's movement trajectory.
[0132] In this step, by quantifying the noise intensity with local variance, dynamic weight allocation, and hybrid filtering, adaptive suppression of mixed noise is achieved. In the construction site video scenario, this step significantly improves the noise reduction effect (such as the combined suppression of dust and radio interference), while retaining key details (such as the clarity of the pile foundation contour).
[0133] As a preferred embodiment of the present invention, the size of the local window, the pixel weight, and the preset threshold are specifically:
[0134] Obtain the target image according to the video position;
[0135] Preset multiple sets of the sizes of the local windows, the pixel weights, and the preset thresholds, process at least one frame of the video image, and obtain the denoised image;
[0136] Based on the comprehensive cumulative variance between the denoised image and the target image, obtain the sizes of the local windows, the pixel weights, and the preset thresholds.
[0137] The purpose of this embodiment is to preset multiple sets of parameters (local window size, pixel weight, preset threshold), combine the comprehensive cumulative variance between the target image and the denoised image, and dynamically select the optimal parameter combination. The parameters can automatically adapt to different types of noise in different scenarios (such as construction site dust, radio interference), without manual intervention, reduce the dependence on complex hardware or manual parameter adjustment, and adapt to low-computing-power devices (such as old cameras). Through the screening of parameter combinations, maximize the quality of the denoised image (such as reducing noise and retaining details).
[0138] It can be understood that the comprehensive cumulative variance is an index used to measure the difference between the denoised image and the target image. The smaller the value, the closer the denoising effect is to the noise-free benchmark.
[0139] According to the location of the video (such as a specific area at the construction site), select a clear and noise-free video segment as the target image. For example, in the pile foundation construction area, select a high-resolution image (such as 1280×720) without dust interference and radio wave surges as a reference. The target image provides a benchmark for parameter optimization to ensure that the parameter selection always aims to be close to the real scenario.
[0140] As an embodiment of this embodiment, presetting multiple sets of the sizes of the local windows, the pixel weights, and the preset thresholds specifically includes:
[0141] Preset the size of the local window to be 3×3 or 5×5;
[0142] The preset threshold is preset according to the noise level of the processed video image;
[0143] The pixel weight is preset according to the distance between the position of the pixel value and the center point of the local window. Among them, the smaller the distance, the greater the pixel weight, and the pixel weight corresponding to the center point of the local window is greater than or equal to 0.2.
[0144] It can be understood that the preset window size is 3×3 or 5×5. Among them, the 3×3 size is suitable for high-frequency detail areas (such as the edge of the pile foundation contour), reducing the computational complexity. The 5×5 size is suitable for large-scale noise (such as dust coverage), enhancing the global noise suppression ability.
[0145] The preset threshold T is preset according to the noise level. For example, for Gaussian noise (dust interference), set T = 10 to make the algorithm tend to mean filtering. For impulse noise (radio wave surge), set T = 20 to make the algorithm tend to median filtering.
[0146] Weights are assigned according to the distance between the pixel and the window center. The closer the distance, the greater the weight, and the center weight ≥ 0.2. For example: the weight of the central pixel is set to 0.3, the adjacent pixels are set to 0.15, and the corner pixels are set to 0.1. A high center weight can preferentially retain the details of the current pixel and avoid edge blurring.
[0147] Use each set of preset parameters to perform noise reduction on at least one frame of image (or multiple frames of images) in the video to obtain the noise-reduced image.
[0148] Calculate the cumulative variance between the noise-reduced image and the target image:
[0149]
[0150] where, I out is the pixel value after noise reduction, and I target is the pixel value of the target image.
[0151] Specifically, when denoising the video of the construction of the pile foundation at the construction site, select the image of the pile foundation construction area without dust and radio interference, with a resolution of 1280×720, as the noise-free reference.
[0152] Preset parameter groups, Group 1: window 3×3, center weight 0.3, threshold T = 10 (for Gaussian dust). Group 2: window 5×5, center weight 0.2, threshold T = 20 (for radio impulse noise). Group 3: window 3×3, center weight 0.25, threshold T = 15 (balanced type).
[0153] Perform noise reduction on 10 frames of video containing dust and radio interference. Group 1 performs well in the dust area (dominated by mean filtering), but the radio noise points are not completely eliminated. Group 2 performs well in the radio area (dominated by median filtering), but there is more dust residue. Group 3 has the lowest comprehensive variance (S = 1200), retains details in the edge area (pile foundation contour), and suppresses mixed noise at the same time.
[0154] Finally, select the parameters of Group 3 because it realizes the combined suppression of dust and radio interference and has a higher calculation efficiency (3×3 window).
[0155] As an embodiment under this implementation manner, the comprehensive cumulative variance between the noise-reduced image and the target image is specifically:
[0156] When processing one frame of image in the video, obtain the cumulative variance between the obtained noise-reduced image and the target image, and the comprehensive cumulative variance is the cumulative variance;
[0157] When processing multiple frames of images in a video, multiple cumulative variances between the denoised images and the target image are obtained, and the comprehensive cumulative variance is obtained by summing / averaging.
[0158] Among them, for a single-frame image, noise reduction is performed, and the cumulative variance S between it and the target image is calculated and directly used as the comprehensive cumulative variance.
[0159] For multiple frames of images (such as video segments), noise reduction is performed, the cumulative variance of each frame is calculated, and the comprehensive cumulative variance is obtained by summing or averaging. For example:
[0160]
[0161] Among them, N is the number of frames, and S n is the cumulative variance of the nth frame. To handle dynamic scenes (such as the movement of a pile driver), false judgments caused by sudden changes in single-frame noise are avoided.
[0162] Specifically, the video contains 10 frames of images. The first 5 frames are dust interference, and the last 5 frames are electrical wave surges.
[0163] After calculating the cumulative variance of each frame and taking the average, ensure that the parameters are suitable for both dust and electrical wave interference. If a certain set of parameters performs well in the dust frames but poorly in the electrical wave frames, its comprehensive cumulative variance may be relatively high and thus be excluded.
[0164] As a preferred embodiment of the present invention, through the numerical sorting of the weighted pixel value set, the corrected median pixel value and the corrected mean pixel value are obtained, specifically:
[0165] After the numerical sorting of the weighted pixel value set, the value corresponding to the median position is the corrected median pixel value;
[0166] The corrected mean pixel value is obtained according to the sum of the values in the weighted pixel value set.
[0167] The purpose of this step is to calculate the corrected median pixel value and the corrected mean pixel value respectively through the sorting and summation of the weighted pixel value set, providing key inputs for subsequent dynamic hybrid filtering.
[0168] In this embodiment, the weighted pixel value set W = {I(i + m, j + n) × w(i + m, j + n)} is numerically sorted. The value at the middle position after sorting is taken as the corrected median I median (i, j). For example, after sorting the 9 weighted pixel values in a 3×3 window, the 5th value is the corrected median.
[0169] In addition, directly sum all the values in the weighted pixel value set W to obtain the corrected mean I mean (i, j),
[0170]
[0171] It should be noted that in the present invention, there is no need to normalize the sum of weights, which simplifies the calculation process. Moreover, by directly summing instead of normalizing, the direct contribution of the weights to the pixel values is emphasized, avoiding the instability of the mean value caused by fluctuations in the sum of weights.
[0172] In a specific embodiment, in the construction site pile foundation construction video, the 3×3 window of a pixel point (200, 300) contains the following pixel values and weights:
[0173]
[0174]
[0175] The weighted pixel values after sorting are: 10, 11, 16, 18, 19.5, 20, 21, 22.5, 54.
[0176] The corrected median pixel value: The 5th value after sorting is 19.5, but it should be noted that the weighted value may need to be remapped to the original pixel value range here.
[0177] The corrected mean pixel value: The sum is 10 + 11 + 16 + 18 + 19.5 + 20 + 21 + 22.5 + 54 = 192.
[0178] In this embodiment, if there are mutations in the original pixel values (such as salt-and-pepper noise with a pixel value of 255), their weighted values will be weakened and move away from the median position after sorting. The weighted summation retains the dominance of the central pixel (180) and avoids the mean shift caused by Gaussian noise (such as dust interference).
[0179] This embodiment efficiently calculates the corrected median and mean pixel values through weighted sorting and summation, providing core data support for hybrid filtering. In the construction site video scenario, this step significantly improves the ability to suppress hybrid noise (such as dust and radio interference), while retaining key details (such as the pile foundation contour).
[0180] As a preferred embodiment of the present invention, the local variance is obtained according to the corrected median pixel value and the corrected mean pixel value, specifically:
[0181] The square of the difference is obtained according to the corrected median pixel value and the corrected mean pixel value;
[0182] According to the sum of the squares of the differences corresponding to multiple pixel values within the local window, the sum of the squares of the differences corresponding to the local window is obtained, and after normalization in combination with the size of the local window, the local variance is obtained.
[0183] The purpose of this embodiment is to calculate the local variance by correcting the median pixel value and the mean pixel value, so as to quantify the noise intensity and provide a basis for subsequent dynamic adjustment of the filtering weight.
[0184] It can be understood that the local variance can measure the mean square value of the difference between the corrected mean and the corrected median within the local window, reflecting the noise intensity. The larger the variance, the more intense the noise (such as dominated by impulse noise).
[0185] In this embodiment, for each pixel position (i, j), based on the corrected median pixel value I median (i, j) and the corrected mean pixel value I mean (i, j), calculate the squared difference between the two:
[0186] diff 2 (i + m, j + n) = (I mean (i + m, j + n) - I median (i + m, j + n)) 2
[0187] where m, n ∈ [-k / 2, k / 2] are the pixel positions within the local window. The squared difference reflects the noise intensity of the current pixel region, and the larger the difference, the more intense the noise (such as impulse noise).
[0188] Sum the squared differences of all pixel points within the local window to obtain the sum of squared differences:
[0189]
[0190] The sum of squares synthesizes the noise differences of all pixels within the window and provides the basic data for subsequent normalization.
[0191] Divide the sum of squared differences by the size k 2 of the local window to obtain the local variance σ 2 (i, j):
[0192]
[0193] The normalization operation ensures that the variance result is independent of the window size, facilitating comparison between different window sizes (such as 3×3 and 5×5 windows) without additional adjustment.
[0194] This embodiment realizes the accurate quantification of the noise intensity by calculating the sum of squared differences between the corrected mean and the median and normalizing it in combination with the window size.
[0195] As a preferred embodiment of the present invention, the local variance is combined with a preset threshold to obtain the local weight, specifically:
[0196]
[0197] Among them, (i, j) are the coordinates of the pixel point, and σ 2 (i, j) is the local variance of the local window corresponding to the pixel point, T is a preset threshold, and α(i, j) is the local weight corresponding to the pixel point.
[0198] The purpose of this embodiment is to dynamically calculate the local weight α(i, j) of each pixel point through the local variance σ 2 (i, j) and the preset threshold T, so as to realize the adaptive mixing of median filtering and mean filtering.
[0199] According to the local variance σ 2 (i, j) and the preset threshold T, calculate the local weight α(i, j) through the following formula:
[0200]
[0201] Among them, σ 2 (i, j) is the local variance, which is used to measure the noise intensity. T is a preset threshold, which is used to control the sensitivity of weight switching.
[0202] The value range of α(i, j) ∈ [0, 1], which represents the weight ratio of median filtering.
[0203] It can be understood that when σ 2 >> T (impulse noise dominates), α ≈ 1, and the weight biases towards median filtering (suppressing outliers).
[0204] When σ 2 << T (Gaussian noise dominates), α ≈ 0, and the weight biases towards mean filtering (smoothing noise).
[0205] For the setting of the threshold T, when Gaussian noise (such as dust interference) dominates, set T to be smaller (such as T = 10), so that the algorithm preferentially uses mean filtering. When impulse noise (such as electrical wave surges) dominates, set T to be larger (such as T = 20), so that the algorithm preferentially uses median filtering.
[0206] At the same time, T can be dynamically adjusted through dark area variance statistics or noise level analysis to adapt to complex scenarios.
[0207] Adopt a rational function form (instead of a hard threshold) to ensure smooth weight changes and avoid sudden changes in the filtering mode due to instantaneous fluctuations in noise. For example, when σ 2 changes near T, the weight changes slowly, reducing visual artifacts.
[0208] Moreover, the weight of each pixel point is calculated independently to ensure the adaptability of the algorithm to different regions of the image (such as edges and flat regions).
[0209] In a specific embodiment, assume that the local variance σ of a certain pixel point (200, 300) 2 = 25, and the preset threshold T = 10:
[0210] Then the calculated weight is
[0211]
[0212] The weight biases towards median filtering (71.4%), indicating that there is strong impulse noise (such as electrical wave surges) in the current area.
[0213] If there are mutant pixel values (such as salt-and-pepper noise of 255) near this pixel point, median filtering will suppress the outliers and retain the edge details (such as the pile foundation contour).
[0214] If σ 2 = 5 (dust interference), then α ≈ 0.33, and mean filtering will smooth the background noise and improve the image clarity.
[0215] This step calculates the weight through the ratio of the local variance to the preset threshold, realizing the adaptive mixing of median and mean filtering. In the construction site video scenario, this method significantly improves the ability to suppress mixed noise (such as dust and electrical wave interference), while retaining the key details (such as the clarity of the pile foundation contour).
[0216] As a preferred embodiment under this implementation manner, the local weight combines the corrected median pixel value and the corrected mean pixel value to obtain the denoised pixel value, specifically:
[0217] Through the local weight, determine the weighting coefficients of the corrected median pixel value and the corrected mean pixel value, and weight the corrected median pixel value and the corrected mean pixel value to obtain the denoised pixel value,
[0218] I out (i, j) = α(i, j) · I median (i, j) + (1 - α(i, j)) · I mean (i, j)
[0219] Where, I mean (i, j) is the corrected mean pixel value, I median (i, j) is the corrected median pixel value, I out (i, j) is the denoised pixel value.
[0220] The purpose of this embodiment is to weight the corrected median pixel value I median (i, j) and the corrected mean pixel value I mean (i, j) through the local weight α(i, j), and finally obtain the denoised pixel value I out(i, j) dynamically mixes the median and mean filtering results according to the noise type to avoid the limitations of single filtering.
[0221] According to the local weight α(i, j), directly determine the weighting coefficients of the corrected median and the corrected mean:
[0222] The weight of the corrected median is α(i, j) (value range [0, 1]); the weight of the corrected mean is 1 - α(i, j).
[0223] Linearly combine the corrected median and the corrected mean according to the weights to obtain the final noise-reduced pixel value:
[0224] I out (i, j) = α(i, j) · I median (i, j) + (1 - α(i, j)) · I mean (i, j)
[0225] Through dynamic weight allocation, the algorithm preferentially retains details in the edge region (high impulse noise) and preferentially eliminates noise residues in the flat region (Gaussian noise).
[0226] It can be understood that when α ≈ 1, it is the region dominated by impulse noise, and the output value is close to the corrected median, suppressing outliers (such as mutated highlight pixels).
[0227] When α ≈ 0, it is the region dominated by Gaussian noise, and the output value is close to the corrected mean, smoothing random noise.
[0228] In addition, this embodiment can ensure that I out is within the range of valid pixel values (such as 0 - 255) to avoid overflow or truncation.
[0229] Specifically, in the noise reduction of a pixel point (200, 300) in the construction video of the construction site pile foundation, the corrected median I median = 150 (edge pixel value); the corrected mean I mean = 140 (background pixel value affected by Gaussian noise); the local weight α = 0.7 (due to the local variance σ 2 = 25, the preset threshold T = 10).
[0230] Weighted calculation
[0231] I out = 0.7 × 150 + 0.3 × 140 = 105 + 42 = 147
[0232] In this embodiment, the corrected mean 140 is affected by Gaussian noise, but the weight of 0.3 restricts its contribution to avoid blurred edges. The corrected median 150 retains the sharpness of the pile foundation contour, and the weight of 0.7 ensures that edge details are not lost. The final output 147 is close to the median, effectively suppressing background noise (such as dust interference) while retaining edge sharpness.
[0233] In this embodiment, by locally weighting the corrected median and mean, adaptive suppression of mixed noise is achieved. In the construction site video scenario, this method significantly improves the noise reduction effect (such as the combined suppression of dust and radio wave interference), while retaining key details (such as the sharpness of the pile foundation contour).
[0234] As a preferred embodiment of the present invention, the video noise reduction method based on hybrid filtering further includes:
[0235] Denoise the pixel points of each frame image in the video to obtain the denoised pixel values;
[0236] After traversing and denoising each pixel point of each frame image in the video, a denoised video is obtained according to the combination of multiple said pixel values.
[0237] The purpose of this embodiment is to expand the single-frame denoising algorithm into a complete video denoising process by processing each pixel point in the video frame by frame, ensuring the coherence and real-time performance of the output video.
[0238] For each frame image in the video, traverse all pixel points (i, j) to obtain the denoised value I out (i, j).
[0239] For each frame image, calculate the local window parameters, corrected median / mean, local variance, and weight independently to ensure the independence of single-frame processing.
[0240] For example, in the construction site video, each frame of the pile foundation construction area is independently processed for dust and radio wave noise.
[0241] Combine the denoised values I out (i, j) of all pixel points according to the spatial position to form a complete denoised image frame. Arrange all processed frames in the original time order to form a continuous denoised video.
[0242] The denoising parameters (such as window size, weight) of each frame are calculated independently to avoid processing deviation of the current frame due to changes in the noise type of the previous frame. For example, if a certain frame has a sudden increase in local variance due to radio wave interference, its weight biases towards median filtering, and the weight automatically switches when the next frame is dominated by dust.
[0243] It should be noted that in order to avoid flickering or frame skipping caused by differences in single-frame processing (such as sudden changes in noise suppression intensity), an inter-frame consistency check is required. For moving areas (such as the movement of a pile driver), a small window size (such as 3×3) is used to reduce motion blur; for static areas, a large window (such as 5×5) is used to enhance the noise reduction effect.
[0244] This step realizes the extension from a single-frame algorithm to full-video processing through per-frame pixel-level noise reduction combined with the video stream. In the construction site monitoring scenario, this method not only improves the noise suppression effect (such as the combined processing of dust and radio interference), but also ensures the real-time performance and dynamic coherence of the video.
[0245] The present invention also provides an electronic device, including:
[0246] A memory for storing computer instructions;
[0247] A processor for implementing the video noise reduction method based on hybrid filtering when executing the computer instructions.
[0248] Therefore, this electronic device can achieve any effect of the video noise reduction method based on hybrid filtering, which will not be elaborated here.
[0249] What is not described in the present invention can be implemented by adopting or referring to existing technologies.
[0250] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the key point of each embodiment is to illustrate the differences from other embodiments.
[0251] The above are only the embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, various changes and modifications can be made to the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the scope of the claims of the present invention.
Claims
1. A video denoising method based on hybrid filtering, characterized in that: include: According to the frame-by-frame images in the video, a pixel value set of each pixel position in the local window is obtained through the selected local window; According to the pixel value set, weighted in combination with pixel weights, a weighted pixel value set is obtained, and by numerical sorting of the weighted pixel value set, a corrected median pixel value and a corrected mean pixel value are obtained; The local variance is obtained according to the corrected median pixel value and the corrected mean pixel value, and the local weight is obtained in combination with the preset threshold value. The pixel value after noise reduction is obtained in combination with the corrected median pixel value and the corrected mean pixel value.
2. The video denoising method based on hybrid filtering according to claim 1, characterized in that: The size of the local window, the pixel weight, and the preset threshold are specifically: According to the video position, the target image is obtained; Presetting multiple groups of the sizes of the local windows, the pixel weights, and the preset thresholds, processing at least one frame of the video, and obtaining a denoised image; The size of the local window, the pixel weight, and the preset threshold are obtained according to the comprehensive cumulative variance between the denoised image and the target image.
3. The video denoising method based on hybrid filtering according to claim 2, characterized in that: Presetting multiple groups of the sizes of the local windows, the pixel weights, and the preset thresholds is specifically: Presetting the size of the local window to 3×3 or 5×5; The preset threshold is preset according to the noise level of the processed video image; The pixel weight is preset according to the distance between the point position of the pixel value and the center point of the local window, wherein the smaller the distance is, the larger the pixel weight is, and the pixel weight corresponding to the center point of the local window is greater than or equal to 0.
2.
4. The video denoising method based on hybrid filtering according to claim 2, characterized in that: The comprehensive cumulative variance between the denoised image and the target image is specifically: When processing a frame of an image in a video, a cumulative variance between an image after noise reduction and the target image is obtained, and the comprehensive cumulative variance is the cumulative variance; When processing multiple frames of images in a video, multiple cumulative variances between the multiple denoised images and the target image are obtained, and the comprehensive cumulative variance is obtained by summing / averaging.
5. The video denoising method based on hybrid filtering according to claim 1, characterized in that: By sorting the values of the weighted pixel value set, the corrected median pixel value and the corrected mean pixel value are obtained, specifically: After the values of the weighted pixel value set are sorted, the value corresponding to the median position is the modified median pixel value; The modified mean pixel value is obtained by summing the values in the weighted pixel value set.
6. The video denoising method based on hybrid filtering according to claim 1, characterized in that: The local variance is obtained according to the corrected median pixel value and the corrected mean pixel value, specifically: Obtaining a square difference according to the corrected median pixel value and the corrected mean pixel value; According to the squares of the differences corresponding to the multiple pixel values in the local window, a sum of the squares of the differences corresponding to the local window is obtained, and normalized in combination with the size of the local window to obtain the local variance.
7. The video denoising method based on hybrid filtering according to claim 1, characterized in that: The local variance is combined with the preset threshold to obtain the local weight, which is: Among them, (i, j) is the coordinate of the pixel point, σ 2 (i, j) is the local variance of the local window corresponding to the pixel position, T is the preset threshold, and α(i, j) is the local weight corresponding to the pixel position.
8. The video denoising method based on hybrid filtering according to claim 7, characterized in that: The local weight is combined with the corrected median pixel value and the corrected mean pixel value to obtain the pixel value after noise reduction, which is specifically: Determine the weight coefficients of the corrected median pixel value and the corrected mean pixel value by using the local weight, and weight the corrected median pixel value and the corrected mean pixel value to obtain a pixel value after noise reduction. I out (i,j)=α(i,j)·I median (i,j)+(1-α(i,j))·I mean (i,j) Among them, I mean (i, j) is the corrected mean pixel value, I median (i, j) is the corrected median pixel value, I out (i, j) is the pixel value after noise reduction.
9. The video denoising method based on hybrid filtering according to claim 1, characterized in that: Also includes: Denoise the pixel points of each frame of the video to obtain the pixel values after denoising; After denoising each pixel point of each frame of the video, a denoised video is obtained according to a combination of multiple pixel values.
10. An electronic device, characterized in that: include: Memory, for storing computer instructions; A processor, configured to implement the video denoising method based on hybrid filtering as described in any one of claims 1 to 9 when executing the computer instructions.
Citation Information
Patent Citations
Mean filtering method and system
CN114399447B
Enhancement processing method and apparatus for traffic video image
CN105046677A
Image speckle noise suppression method based on central affine filtering
CN109615597A
Video image 3D noise reduction method, computer device and computer readable storage medium
CN109743473A
Self-adaptive non-local mean image denoising method
CN113643201A
Cited By
Video noise reduction method and device, storage medium and terminal
CN121213393A