Spatial filtering image denoising method and device based on subgradient, medium and product

Through the spatial filtering method based on sub-gradient, the pixels of the noisy image are divided into multiple categories and targeted filters are constructed. SSIM optimizes the filter coefficients, which solves the problem of step size setting of traditional filter design, and achieves efficient image denoising and image quality improvement.

CN120198320AActive Publication Date: 2025-06-24DIANGUANG EXPLOSION PROTECTION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510269973.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-24
Estimated Expiration
2045-03-07

AI Technical Summary

Technical Problem

Traditional spatial filtered image denoising technology is prone to oscillation when the step size is set too large and it is difficult to converge stably. However, too small step size leads to insufficient parameter update amplitude, which requires a large number of iterations to achieve the preset accuracy, resulting in the inability to further improve the denoising effect and image quality.

Method used

Using a spatial filtered image denoising method based on sub-gradient, the pixels of the noise image are divided into multiple types of pixels through the Prewitt edge detection algorithm, and a corresponding spatial filter is built for each type of pixel. The objective function is constructed using the Structural Similarity Index (SSIM), and the filter coefficients are efficiently iteratively updated through sub-gradient algorithms and dynamic step strategies.

Benefits of technology

Improve filter design efficiency, realize effective denoising of noisy images, improve image quality, and maintain adaptability and robustness to different image content and noise types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120198320A_ABST
    Figure CN120198320A_ABST
Patent Text Reader

Abstract

The invention discloses a subgradient-based spatial filtering image denoising method and device, a medium and a product, and relates to the field of image processing. The method comprises the following steps: dividing pixels of a noise image into a non-edge class and a plurality of edge classes based on a Prewitt edge detection algorithm; corresponding spatial filters are constructed for the multiple types of pixels respectively; constructing an optimization vector according to the initial coefficient of each spatial filter; constructing a target function based on the structural similarity index; in the optimization process of the target function, deriving the coefficient of the current SSIM about a spatial filter to obtain a subgradient; determining a dynamic step length according to the current SSIM, the estimated SSIM and the subgradient; iteratively updating the optimization vector according to the subgradient and the dynamic step length to obtain a target optimization vector, and further obtaining a target spatial filter; and de-noising processing is carried out through the target spatial filter to obtain a de-noised image. The filter design efficiency can be improved, effective denoising is realized, and the image quality is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a spatial filtering image denoising method, device, medium and product based on subgradient. Background Art

[0002] Image denoising is an important task in image processing, which aims to recover the original and clear image from the noisy image. The two-dimensional filter is a commonly used technology for image denoising, which reduces noise by operating on the image in the two-dimensional space.

[0003] Traditional spatial filtering image denoising techniques suppress noise by performing fixed-mode weighting or statistical operations on local pixel neighborhoods in the image spatial domain. For example, mean filtering uses neighborhood pixel averaging to smooth noise, Gaussian filtering retains low-frequency information through distance-weighted mean calculation, and median filtering uses the median of neighborhood pixels to eliminate impulse noise.

[0004] In current filter design methods, when the step size is set too large, the iterative process is prone to oscillate near the optimal solution and is difficult to converge stably; while too small step size results in insufficient parameter update amplitude, and a large number of iterations are required to reach the preset accuracy. Finally, the designed filter cannot further improve the denoising effect and image quality in image denoising processing. Summary of the Invention

[0005] Aiming at the above technical problems and defects, the purpose of the present invention is to provide a spatial filtering image denoising method, device, medium and product based on subgradient, which can improve the filter design efficiency, effectively denoise the noisy image, and ensure the image quality.

[0006] To achieve the above object, in a first aspect, the present invention provides a spatial filtering image denoising method based on subgradient, including: dividing the pixels of a noisy image into multiple types of pixels based on the Prewitt edge detection algorithm, where the multiple types of pixels include non-edge types and multiple edge types; constructing corresponding spatial filters for each of the multiple types of pixels; constructing an optimization vector according to the initial coefficients of each spatial filter; constructing an objective function based on the structural similarity index, where there is a mapping relationship between the objective function and the optimization vector, and the structural similarity index is determined according to the denoised image corresponding to the noisy image and the noise-free original image; in the optimization process of the objective function, obtaining the subgradient by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter; determining a dynamic step size according to the current structural similarity index, the estimated structural similarity index, and the subgradient; iteratively updating the optimization vector according to the subgradient and the dynamic step size to obtain a target optimization vector; reconstructing the spatial filters corresponding to the multiple types of pixels based on the target optimization vector to obtain corresponding target spatial filters; after classifying the pixels of the to-be-processed noisy image, performing denoising processing on the classified pixels through the target spatial filters respectively to obtain multiple filtering results; and determining the final denoised image according to the multiple filtering results.

[0007] The present invention divides the pixels of a noisy image into multiple types of pixels, including non-edge types and multiple edge types, based on the Prewitt edge detection algorithm, and constructs corresponding spatial filters for each type of pixel to achieve targeted denoising processing and effectively retain image details; through the optimization of the objective function based on the structural similarity index (SSIM), using the subgradient algorithm and the dynamic step size strategy, the filter coefficients are efficiently iteratively updated, accelerating the algorithm convergence speed and improving the filter design efficiency; finally, the classified pixels are denoised through the target spatial filters, and multiple filtering results are synthesized to obtain the final denoised image, realizing effective denoising of the noisy image, improving the image quality, and at the same time maintaining the adaptability and robustness to different image contents and noise types.

[0008] Optionally, in some embodiments, iteratively updating the optimization vector according to the exponential gradient and the dynamic step size to obtain an updated optimization vector includes: iteratively updating the optimization vector to obtain an updated optimization vector; when the change amount of the updated optimization vector is less than a set threshold, or the number of iterations reaches a set upper limit value, stop updating; and determining the updated optimization vector at the time of stopping updating as the target optimization vector.

[0009] Adopting the technical solution of the above embodiment, the iterative update method of the optimization vector is defined, including updating the optimization vector, setting the stopping condition, and determining the target optimization vector. By setting that the change amount of the updated optimization vector is less than the threshold value or the number of iterations reaches the upper limit value as the stopping condition, the convergence speed and stability of the algorithm can be effectively controlled. When the change amount of the optimization vector is less than the set threshold value, it indicates that the optimization process is close to convergence, and it is meaningless to continue the iteration; when the number of iterations reaches the set upper limit value, the iteration stops regardless of whether the optimization vector converges, so as to avoid excessive calculation. This iterative update mechanism can ensure that the algorithm converges within a reasonable time and avoid unnecessary waste of computing resources.

[0010] Optionally, in some embodiments, based on the Prewitt edge detection algorithm, the pixels of the noisy image are divided into multiple types of pixels, including: classifying according to a preset classification rule, and the classification rule includes: Among them, G(k1,k2) represents the gradient magnitude, G x and G y respectively represent the Prewitt gradient operators in the horizontal and vertical directions, k1 and k2 are the coordinate indices of the pixels respectively, and T is the gradient threshold.

[0011] Adopting the technical solution of the above embodiment, the method of dividing the pixels of the noisy image into multiple types of pixels based on the Prewitt edge detection algorithm is defined. Through the preset classification rule, the pixels can be divided into non-edge types and multiple edge types according to the gradient magnitude and gradient direction. This classification method can effectively distinguish different types of pixels in the image and provide a more accurate classification basis for subsequent denoising processing. By dividing the pixels into multiple types, different denoising strategies can be adopted for different types of pixels, thereby improving the denoising effect while retaining the important structural information of the image.

[0012] Optionally, in some embodiments, by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter, the subgradient is obtained, including: calculating the subgradient through a preset subgradient calculation formula, and the subgradient calculation formula includes: Among them, is the subgradient, Δh represents the perturbation amount, P represents the noisy image, O represents the noise-free image; SSIM represents the structural similarity index, and h represents the coefficients of the spatial filter.

[0013] Adopting the technical solution of the above embodiment, through the preset subgradient calculation formula, the subgradient can be accurately calculated, providing accurate gradient information for the optimization algorithm. The calculation of the subgradient is a key step in the optimization algorithm, which indicates the change direction and degree of the objective function at the current point. Through accurate subgradient calculation, it can be ensured that the optimization algorithm iteratively updates along the correct direction, thereby accelerating the convergence speed and improving the optimization effect.

[0014] Optionally, in some embodiments, determining the dynamic step size according to the current structural similarity index, the estimated structural similarity index, and the subgradient includes: calculating the dynamic step size through a preset dynamic step size adjustment formula, and the dynamic step size adjustment formula includes: where S k is the dynamic step size, k represents the number of iterations, represents the estimated structural similarity index, h k represents the optimization vector at the k-th iteration, represents the current structural similarity index, is the subgradient at the k-th iteration.

[0015] Adopting the technical solution of the above embodiment, through the preset dynamic step size adjustment formula, the dynamic step size can be reasonably calculated, thereby controlling the update amplitude of the optimization vector. The determination of the dynamic step size is an important part of the optimization algorithm, which can automatically adjust the step size according to the current optimization state, avoiding the problems of premature convergence or too slow convergence speed that may be caused by a fixed step size. Through the adjustment of the dynamic step size, the convergence speed and stability of the optimization algorithm can be significantly improved.

[0016] Optionally, in some embodiments, the is estimated from the optimal structural similarity index in the historical record, and the calculation formula of the estimated structural similarity index includes: where is the historical optimal structural similarity index, θ k is the adjustment parameter at the k-th iteration, used to increase the target expectation, h best represents the historical optimal spatial filter coefficient.

[0017] Adopting the technical solution of the above embodiment, estimating the estimated structural similarity index through the optimal structural similarity index in the historical record can more accurately guide the optimization process. The estimated structural similarity index, as the target value of the optimization algorithm, can guide the optimization vector to update in the direction of the optimal solution. Through reasonable estimation, the convergence speed of the optimization algorithm can be accelerated, the denoising effect can be improved, and at the same time, the waste of computing resources caused by blind search can be avoided.

[0018] Optionally, in some embodiments, θ k The calculation formula of includes: where θ k+1 is the adjustment parameter at the (k + 1)-th iteration, λ is an adjustment parameter greater than or equal to 1, β is an adjustment parameter less than 1, is a positive parameter, represents the structural similarity index at the (k + 1)-th iteration, and h k+1 represents the optimization vector at the (k + 1)-th iteration.

[0019] Adopting the technical solution of the above embodiment, through a reasonable adjustment parameter update rule, the growth rate of the estimated structural similarity index can be effectively controlled, thereby balancing the convergence speed and stability of the optimization algorithm. The update rule of the adjustment parameter can be automatically adjusted according to the current optimization state, avoiding optimization problems caused by too fast or too slow growth. Through this dynamic adjustment mechanism, the adaptability and robustness of the optimization algorithm can be significantly improved, ensuring that the algorithm can achieve better optimization effects in different situations.

[0020] In a second aspect, an embodiment of the present invention provides an electronic device, including: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the electronic device to execute the method described in the first aspect or the second aspect, and any possible implementation manner in the first aspect or the second aspect.

[0021] In a third aspect, the present invention provides a computer-readable storage medium, including instructions, when the above instructions run on the above electronic device, causing the above electronic device to execute the method described in the first aspect or the second aspect, and any possible implementation manner in the first aspect or the second aspect.

[0022] In a fourth aspect, the present invention provides a computer program product including instructions, when the above computer program product runs on the above electronic device, causing the above electronic device to execute the method described in the first aspect or the second aspect, and any possible implementation manner in the first aspect or the second aspect.

[0023] It can be understood that the electronic device provided in the second aspect, the storage medium provided in the third aspect, and the computer program product provided in the fourth aspect are all used to execute the method provided by the present invention. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be elaborated here.

[0024] One or more technical solutions provided by the present invention have at least the following technical effects or advantages: 1. The present invention divides the pixels of a noisy image into multiple types of pixels based on the Prewitt edge detection algorithm, including non-edge types and multiple edge types, and constructs corresponding spatial filters for each type of pixel respectively. This classification method can accurately identify different types of pixels in the image, thereby achieving targeted denoising processing. Non-edge pixels mainly focus on smoothing processing to effectively remove noise and maintain the smoothness of the image; edge pixels, while denoising, pay attention to retaining edge details to avoid edge blurring. This method of classification and targeted filtering processing can significantly improve the denoising effect, while retaining the important structural information of the image and enhancing the visual quality of the image.

[0025] 2. In the optimization process of the objective function of the present invention, by taking the derivative of the current structural similarity index (SSIM) with respect to the coefficients of the spatial filter, the subgradient is obtained, and the dynamic step size is determined based on the current SSIM, the estimated SSIM, and the subgradient. The determination of the dynamic step size can automatically adjust the step size according to the current optimization state, avoiding the problems of premature convergence or too slow convergence speed that may be caused by a fixed step size. The subgradient optimization algorithm can perform iterative updates along the direction where the objective function value increases the fastest, thereby accelerating the optimization speed of the filter coefficients and improving the convergence efficiency of the algorithm. The combination of this dynamic step size and subgradient optimization can significantly improve the efficiency and effect of optimizing the filter coefficients, accelerate the convergence speed of the algorithm, and thus achieve more efficient image denoising processing.

[0026] 3. The present invention estimates the estimated SSIM through the optimal SSIM in the historical record, and determines the dynamic step size based on the current SSIM, the estimated SSIM, and the subgradient. The estimated SSIM, as the objective value of the optimization algorithm, can guide the update of the optimization vector towards the direction of the optimal solution. Through reasonable estimation, the convergence speed of the optimization algorithm can be accelerated, the denoising effect can be improved, and at the same time, the waste of computing resources caused by blind search can be avoided. The introduction of the historical optimal SSIM can provide a more accurate reference for the estimated SSIM, thereby improving the adaptability and robustness of the optimization algorithm and ensuring that the algorithm can achieve better optimization effects in different situations. The combination of this historical optimal SSIM and the estimated SSIM can significantly improve the performance of the optimization algorithm, accelerate the convergence speed, and improve the denoising effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present invention, and are used together with the specification to explain the principles of the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings. In the drawings: Figure 1It is a schematic flowchart of a spatial filtering image denoising method based on subgradient according to an embodiment of the present invention; Figure 2 It is a diagram showing the denoising effect of a noisy image according to an embodiment of the present invention; Figure 3 It is a data graph of SSIM and the number of iterations according to an embodiment of the present invention; Figure 4 It is a distance h distance and a schematic diagram of the change with the number of iterations; Figure 5 It is a diagram showing the denoising effect of multiple noisy images according to an embodiment of the present invention; Figure 6 It is another diagram showing the denoising effect of a noisy image according to an embodiment of the present invention; Figure 7 It is a schematic diagram of the architecture of an electronic device according to an embodiment of the present invention. Detailed implementation manners

[0028] The terms used in the following embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. As used in the specification of the present invention, the singular forms "a", "an", "above-mentioned", "the" and "this" are also intended to include the plural forms, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present invention refers to any or all possible combinations including one or more of the listed items.

[0029] Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and cannot be understood as implying relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present invention, unless otherwise specified, the meaning of "a plurality" is two or more.

[0030] It should also be noted that, unless otherwise clearly specified and limited, in the embodiments of the present invention, terms such as "set" and "connect" should be understood in a broad sense. For example, "connect" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the communication inside two elements; it can be a wired communication connection or a wireless communication connection. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations. The embodiments of the present invention will be specifically described below.

[0031] The embodiments of the present invention provide a spatial filtering image denoising method based on subgradient, asFigure 1 As shown in the figure, it includes the following steps: Step 201: Based on the Prewitt edge detection algorithm, divide the pixels of the noisy image into multiple types of pixels, which include non-edge types and multiple edge types.

[0032] Among them, Prewitt is an edge detection algorithm based on a directional difference convolution kernel. By calculating the gradient magnitude and direction in the horizontal and vertical directions of the image, it identifies regions of sudden brightness change in the image to locate the edge structure.

[0033] First, use the Prewitt edge detection algorithm to process the noisy image. The Prewitt edge detection algorithm detects edges in the image by calculating the gradients in the horizontal and vertical directions. Specifically, for each pixel point in the image, calculate its gradient values in the horizontal and vertical directions, and then according to the magnitude and direction of the gradient values, divide the pixel points into non-edge types and multiple edge types. The gradient values of non-edge type pixels are smaller, indicating that these pixel points are located in the smooth area of the image; the gradient values of edge type pixels are larger, indicating that these pixel points are located in the edge area of the image. The edge type is further divided into multiple sub-types according to the direction of the gradient, such as horizontal edges, vertical edges, diagonal edges, etc.

[0034] By dividing the pixels into multiple types, different denoising strategies can be adopted for different types of pixels. Non-edge type pixels mainly focus on smoothing processing to remove noise and maintain the smoothness of the image; edge type pixels pay attention to retaining edge details while denoising to avoid edge blurring. This classification method can effectively improve the denoising effect, while retaining the important structural information of the image and enhancing the visual quality of the image.

[0035] In some embodiments, in order to reduce the computational cost of classification, comparison operations can be used to replace the originally complex arctangent operations, thereby simplifying the calculation process of edge detection and improving the classification efficiency.

[0036] Specifically, when classifying the pixels of the noisy image based on the Prewitt edge detection algorithm, by comparing the gradient value of the pixel with a preset threshold, directly divide the pixel into non-edge types and multiple edge types, without the need to perform complex arctangent operations to determine the edge direction. This method significantly reduces the computational complexity while ensuring the classification effect, making the algorithm more efficient and suitable for image denoising scenarios with high real-time requirements.

[0037] Step 202: Construct corresponding spatial filters for each type of pixel.

[0038] Among them, the spatial filter may include a two-dimensional FIR (Finite Impulse Response) filter, which is also a symmetric filter.

[0039] The design of the spatial filter is usually based on the frequency response characteristics of the filter to meet the denoising requirements of different pixel categories. For non-edge pixels, the designed filter mainly focuses on smoothing to effectively remove noise; for edge pixels, the designed filter, on the basis of smoothing, pays attention to retaining edge details and avoiding edge blurring. The design of the filter can be achieved through optimization algorithms such as the least squares method, genetic algorithm, etc., to ensure that the filter reaches the best balance between denoising and detail retention.

[0040] By designing dedicated spatial filters for different categories of pixels, targeted denoising processing can be achieved. The filter for non-edge pixels can effectively remove noise and improve the smoothness of the image; the filter for edge pixels retains edge details while removing noise and avoids edge blurring. This targeted filter design method can significantly improve the denoising effect, while maintaining the important structural information of the image and enhancing the visual quality of the image.

[0041] Step 203, construct an optimization vector according to the initial coefficients of each of the spatial filters.

[0042] Specifically, integrate the initial coefficients of the above-mentioned multiple spatial filters into an optimization vector. The construction of the optimization vector is to be able to adjust and optimize the coefficients of all filters simultaneously in the subsequent optimization process. Specifically, arrange the initial coefficients of each filter in sequence to form a high-dimensional vector, and this vector is the optimization vector. The construction of the optimization vector needs to ensure that the positions of the coefficients of each filter in the vector are fixed so that each filter coefficient can be accurately adjusted during the optimization process.

[0043] By constructing the optimization vector, the coefficients of multiple filters can be integrated into a unified optimization framework, which is convenient for simultaneously adjusting the coefficients of all filters in the subsequent optimization process. This integration method can improve the optimization efficiency, ensure that the adjustment of filter coefficients is coordinated, and thus achieve the optimization of the entire filter bank. The construction of the optimization vector is a key step in realizing the optimization of filter coefficients and can significantly improve the denoising performance of the filter and the image quality.

[0044] Step 204, construct an objective function based on the structural similarity index, and there is a mapping relationship between this objective function and the optimization vector.

[0045] Among them, the structural similarity index is determined based on the denoised image corresponding to the noisy image and the original noise-free image. The Structural Similarity Index (SSIM) is a metric for measuring image quality. It evaluates the similarity between two images from three aspects: luminance, contrast, and structure. By calculating the SSIM value, the denoising effect of the filter can be quantitatively evaluated. The closer the SSIM value is to 1, the more similar the filtered image is to the original noise-free image, and the better the denoising effect.

[0046] The construction of the objective function is to maximize the SSIM value during the optimization process, so as to achieve the best denoising effect. Specifically, the objective function f(h) can be expressed as:

[0047] Among them, O represents the original noise-free image, P represents the noisy image, and h represents the optimization vector. represents the convolution operation or filtering process. represents the denoised image after filtering. There is a mapping relationship between the objective function f(h) and the optimization vector h, that is, by adjusting the optimization vector h, f(h) is maximized.

[0048] By constructing the objective function based on SSIM, the similarity between the denoised image and the original noise-free image can be effectively measured, thus guiding the optimization of the filter coefficients. As a comprehensive image quality evaluation metric, SSIM can better reflect the human eye's perception of image quality. Therefore, using SSIM as the objective function during the optimization process can significantly improve the denoising effect while retaining the important structural information of the image.

[0049] Step 205, during the optimization process of this objective function, the subgradient is obtained by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter.

[0050] During the optimization process, in order to determine the change direction and degree of the structural similarity index (SSIM) with respect to the spatial filter coefficients, it is necessary to take the derivative of the current SSIM value with respect to the filter coefficients, thereby obtaining the subgradient.

[0051] Specifically, since SSIM is a metric for measuring the similarity between the denoised image and the original noise-free image, its value is directly affected by the filter coefficients. By calculating the partial derivatives of SSIM with respect to the filter coefficients, the contribution of each coefficient to the change in SSIM can be obtained. The vector composed of these partial derivatives is the subgradient. The subgradient reflects the change trend of the SSIM value in each direction under the current filter coefficients, thus providing an optimization direction for the update of the filter coefficients, so that in the subsequent iterative process, the filter coefficients can be adjusted along the opposite direction of the subgradient for optimization to gradually increase the SSIM value and achieve a better denoising effect.

[0052] By calculating the subgradient, the changing direction of the objective function at the current point can be effectively determined, thereby guiding the update of the filter coefficients. The subgradient algorithm is a commonly used optimization algorithm, especially suitable for dealing with non-smooth optimization problems. Through the subgradient algorithm, the filter coefficients can be gradually adjusted to gradually increase the objective function, thereby realizing the optimization of the filter.

[0053] Step 206: Determine a dynamic step size according to the current structural similarity index, the estimated structural similarity index, and the subgradient.

[0054] The step size is a parameter that controls the moving distance when updating variables in each iteration in the optimization algorithm. It determines the speed and amplitude of the algorithm advancing in the search space. In this embodiment, a dynamic step size is adopted, which can adaptively and dynamically adjust the step size. The estimated structural similarity index can be estimated according to the optimal SSIM recorded in history.

[0055] Specifically, to determine the dynamic step size, first, it is necessary to calculate the difference between the current structural similarity index (SSIM) and the estimated optimal structural similarity index. This difference reflects the gap between the current filter coefficients and the optimal filter coefficients. Secondly, calculate the current subgradient, that is, the derivative of SSIM with respect to the filter coefficients. This subgradient indicates the direction in which the SSIM value changes fastest. The dynamic step size is usually determined by the following formula: step size = (estimated optimal SSIM - current SSIM) / the norm of the subgradient.

[0056] In this way, if the gap between the current SSIM and the estimated optimal SSIM is large, the dynamic step size will be large, thereby accelerating the update speed of the filter coefficients and enabling the algorithm to quickly approach the optimal solution. When the gap is small, the dynamic step size will be small, thereby finely adjusting the filter coefficients to avoid oscillations or divergences caused by over-adjustment and ensure the stability and convergence of the algorithm.

[0057] Step 207: Iteratively update the optimization vector according to the subgradient and the dynamic step size to obtain the target optimization vector.

[0058] Specifically, the optimization vector is iteratively updated according to the current subgradient and dynamic step size to gradually approach the target optimization vector. Specifically, the subgradient (i.e., the derivative of the objective function with respect to the optimization vector) is used to determine the optimization direction, which indicates the direction in which the objective function value increases fastest. At the same time, the dynamic step size is determined according to the current structural similarity index (SSIM), the estimated optimal SSIM, and the norm of the subgradient, and is used to control the update amplitude of each iteration. Multiply the subgradient by the dynamic step size to obtain the update amount, and then add it to the current optimization vector to obtain a new optimization vector.

[0059] By continuously iterating this process, the optimization vector is gradually adjusted, and finally converges to the target optimization vector that maximizes the objective function (SSIM), achieving the optimal configuration of the filter coefficients.

[0060] Step 208: Based on the target optimization vector, reconstruct the spatial filters corresponding to the multi-class pixels to obtain the corresponding target spatial filters.

[0061] Specifically, the target optimization vector contains the optimal coefficients of all spatial filters, which are determined through an iterative optimization process aiming to maximize the structural similarity index (SSIM). According to the coefficient order and quantity of each spatial filter in the optimization vector, the corresponding parts in the optimization vector are extracted and reorganized into the matrix form of the filter, thus completing the reconstruction of each spatial filter.

[0062] In this way, each category of pixels has an optimal spatial filter that matches its characteristics. These filters can more effectively remove noise in subsequent denoising processing while retaining the important details and structural information of the image.

[0063] The specific reconstruction operation is based on the symmetry principle. Since spatial filters usually have symmetry, in the coefficient matrix of the filter, only the coefficients in one quadrant are independently to be optimized. This means that only by determining the coefficients in one quadrant of the filter, the entire coefficient matrix of the filter can be reconstructed through mirroring and flipping operations using symmetry.

[0064] Specifically, the reconstruction method is as follows: Assume the size of the filter is N×N (N is odd), then the center point of the filter is fixed, and the coefficients at other positions can be determined by symmetry. For example, if the coefficients in the first quadrant are h(i,j) (where i,j≥0), then the coefficients in other quadrants can be reconstructed using the double symmetry of h(i,j). Specifically, h(i,j) = h(-i,-j); And h(i,j) = h(j,i); In this way, the entire coefficient matrix of the filter can be efficiently reconstructed, thus obtaining the corresponding target spatial filter.

[0065] Step 209: After classifying the pixels of the noise image to be processed, use the target spatial filter to perform denoising processing on the classified pixels respectively to obtain multiple filtering results.

[0066] Specifically, for non-edge pixels, a specially designed non-edge filter is used for smoothing to effectively remove noise and maintain the smoothness of the image; for edge pixels, according to their specific edge directions (such as horizontal edges, vertical edges, etc.), corresponding edge filters are used for processing to retain edge details while removing noise.

[0067] In this way, denoising processing is performed on different categories of pixels respectively to obtain multiple filtering results, and each filtering result corresponds to the denoising effect of one category of pixels.

[0068] Step 210, determine the final denoised image according to the multiple filtering results.

[0069] After obtaining multiple filtering results, according to the category to which each pixel belongs, the corresponding filtering results are combined to determine the final denoised image. Specifically, for each pixel point, according to the category determined in the classification stage, the corresponding filtering result is selected as the final denoising value of the pixel point. In this way, by integrating the filtering results corresponding to different categories of pixels, a complete denoised image is formed.

[0070] This method can ensure that each pixel point undergoes the filtering process most suitable for its characteristics, thereby effectively denoising the noisy image as a whole while retaining the important structural information and details of the image.

[0071] The present invention divides the pixels of a noisy image into multiple categories of pixels, including non-edge categories and multiple edge categories, based on the Prewitt edge detection algorithm, and constructs corresponding spatial filters for each category of pixels to achieve targeted denoising processing and effectively retain image details; through the optimization of the objective function based on the structural similarity index, using the subgradient algorithm and the dynamic step size strategy, the filter coefficients are efficiently iteratively updated to accelerate the algorithm convergence speed and improve the filter design efficiency; finally, the classified pixels are denoised by the target spatial filter, and multiple filtering results are synthesized to obtain the final denoised image, realizing effective denoising of the noisy image, improving the image quality, and at the same time maintaining the adaptability and robustness to different image contents and noise types.

[0072] In some embodiments, the present embodiment further provides a specific spatial filtering image denoising method based on the subgradient, including the following steps: S301, divide the pixels of the noisy image into multiple categories of pixels based on the Prewitt edge detection algorithm, and the multiple categories of pixels include non-edge categories and multiple edge categories.

[0073] In this embodiment, the multiple edge categories can be four edge categories.

[0074] When classifying the pixels of the noisy image using the Prewitt edge detection operator, first divide them into the edge class Pe and non-edge class P ne ; Then the edge classes are divided into four categories

[0075] It can be classified according to the preset classification rules, and the classification rules include: Among them, G(k1,k2) represents the gradient magnitude, and G x and G y respectively represent the Prewitt gradient operators in the horizontal and vertical directions, k1 and k2 are the coordinate indices of the pixel respectively, and T is the gradient threshold.

[0076] Specifically, if the gradient magnitude G(k1,k2) is less than or equal to the threshold T, then the pixel is classified as a non-edge class; if the gradient magnitude is greater than the threshold T, then the pixel is classified as an edge class.

[0077] Edge class I: If G x > G y and G y ≥ -G x , then the pixel belongs to edge class I.

[0078] Edge class II: If G y ≥ G x and G y ≥ -G x , then the pixel belongs to edge class II.

[0079] Edge class III: If G y ≥ G x and G y < -G x , then the pixel belongs to edge class III.

[0080] Edge class IV: If G x > G y and G y < -G x , then the pixel belongs to edge class IV.

[0081] In this embodiment, five filters are used to perform filtering and noise reduction processing on the five types of pixels respectively. The two-dimensional FIR filter used is a symmetric filter with a size of N×N (N is an odd number), then the number of independent coefficients to be optimized for a single filter is LA = 2L 2 + 2L + 1 (L = (N - 1) / 2).

[0082] For the five filters, there are a total of 5·LA coefficients to be optimized, denoted as: Five two-dimensional filter coefficient matrices can be reconstructed from the optimized vector h, denoted as H 0 , H 1 , H 2 , H 3 , H 4 respectively. Thus, the structural similarity index SSIM can be calculated, denoted as

[0083] where O represents the original noise-free image, represents the convolution operation of the pixels of image P with h, * represents the convolution calculation of image spatial filtering.

[0084] S302, construct corresponding spatial filters for these multi-class pixels.

[0085] This step refers to the description of the foregoing embodiment and will not be elaborated here.

[0086] S303, construct an optimized vector according to the initial coefficients of each spatial filter.

[0087] This step refers to the description of the foregoing embodiment and will not be elaborated here.

[0088] S304, construct an objective function based on the structural similarity index, and there is a mapping relationship between the objective function and the optimized vector. Among them, the structural similarity index is determined according to the denoised image corresponding to the noisy image and the original noise-free image.

[0089] This step refers to the description of the foregoing embodiment and will not be elaborated here.

[0090] S305, in the optimization process of the objective function, obtain the subgradient by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter.

[0091] In the embodiment, the subgradient algorithm can be implemented starting from a random h value according to the SSIM value, and the optimized vector h is iteratively updated.

[0092] Specifically, the subgradient is calculated through a preset subgradient calculation formula, and the subgradient calculation formula includes: where is the subgradient, Δh represents the perturbation amount, P represents the noisy image, O represents the noise-free image; SSIM represents the structural similarity index, and h represents the coefficient of the spatial filter.

[0093] Positive perturbation: Calculate that is, add a small perturbation Δh to the current optimized vector h, and then calculate the new SSIM value.

[0094] Reverse perturbation: Calculate That is, on the basis of the current optimization vector h, a small perturbation Δh is reduced, and then the new SSIM value is calculated.

[0095] Calculate the subgradient: Divide the difference between the above two SSIM values by 2Δx to obtain the subgradient.

[0096] In this way, the value of the subgradient can be obtained, and then this subgradient is used to update the coefficients of the filter to maximize the SSIM value and achieve the effect of image denoising.

[0097] S306. Determine the dynamic step size according to the current structural similarity index, the estimated structural similarity index, and the subgradient.

[0098] Specifically, the dynamic step size is calculated through a preset dynamic step size adjustment formula, and the dynamic step size adjustment formula includes: Where S k is the dynamic step size, k represents the number of iterations, represents the estimated structural similarity index, h k represents the optimization vector of the k-th iteration, represents the current structural similarity index, specifically h k The result of applying to the noise-disturbed image P and the SSIM value between the original noise-free image O, is the subgradient of the k-th iteration.

[0099] In this embodiment, S k is the dynamic step size of the k-th iteration. By dividing the numerator (performance gap) by the denominator (square of the L2 norm of the gradient), it can be ensured that the step size S k can not only reflect the gap between the current filter and the optimal filter, but also be dynamically adjusted according to the change rate of the objective function. When the gradient is large, the step size will be relatively small to avoid over-adjustment; when the gradient is small, the step size will be relatively large to accelerate the convergence speed.

[0100] is the gradient vector The square of the L2 norm of, representing the square of the magnitude of the gradient.

[0101] By calculating the difference between the currently estimated optimal SSIM value and the actual SSIM value, and combining the square of the magnitude of the gradient, the step size S k is dynamically adjusted to ensure that the subgradient algorithm can converge to the optimal solution quickly and stably.

[0102] In some embodiments, It is obtained by estimating the optimal structural similarity index in the historical record. The calculation formula of the estimated structural similarity index includes: Among them, is the historical optimal structural similarity index, and θ k is the adjustment parameter at the k-th iteration, which is used to increase the target expectation. h best represents the historical optimal spatial filter coefficient, which is the optimal h that can maximize the SSIM so far.

[0103] In some embodiments, the calculation formula of θ k includes: Among them, θ k+1 is the adjustment parameter at the (k + 1)-th iteration, which is used to increase the target expectation; λ is an adjustment parameter greater than or equal to 1, which is used to increase θ when the current SSIM value is better than the historical optimal SSIM value. k ; β is an adjustment parameter less than 1, which is used to decrease θ when the current SSIM value is not better than the historical optimal SSIM value. k ; is a positive parameter. represents the structural similarity index at the (k + 1)-th iteration, and h k+1 represents the optimization vector at the (k + 1)-th iteration. is a sufficiently small positive number to ensure that θ k will not decrease to too small a value; represents the structural similarity index at the (k + 1)-th iteration, indicating the SSIM value between the filtered result obtained by convolving h k+1 with the noise-disturbed image P and the noise-free original image O. represents the historical optimal structural similarity index, indicating the SSIM value between the filtered result obtained by convolving h best with the noise-disturbed image P and the noise-free original image O.

[0104] h k+1 is the optimization vector at the current (k + 1)-th iteration.

[0105] If is greater than the historical optimal SSIM value then θ k is multiplied by λ and increased.

[0106] If Less than or equal to the historical optimal SSIM value then θ k is multiplied by β and decreases, but will not be less than

[0107] By comparing the current SSIM value with the historical optimal SSIM value, dynamically adjust the adjustment parameter θ k to control the step size S k to ensure that the algorithm can converge stably when approaching the optimal solution.

[0108] In some embodiments, the dynamic step size can also be adjusted by a step size adjustment formula based on an adaptive learning rate, and the step size adjustment formula based on the adaptive learning rate includes: where s k is the step size of the k-th iteration.

[0109] a is the initial learning rate coefficient, used to control the initial size of the step size. is the subgradient of the i-th iteration. b is a small constant, used to prevent the denominator from being zero. f(h k ) is the objective function value of the k-th iteration. f(h k-1 ) is the objective function value of the (k - 1)-th iteration. c is the coefficient that controls the influence of the change rate of the objective function value. d is a constant, specifically a relatively small positive number, used to prevent the denominator from being zero. g is the coefficient that controls the influence of the change rate of the subgradient. j is a constant, specifically a relatively small positive number, used to prevent the denominator from being zero.

[0110] In the above formula: is the adaptive learning rate part, which adjusts the step size by accumulating the sum of the squares of the historical gradients, so that the step size decreases when the gradient is large and increases when the gradient is small.

[0111] is the change rate part of the objective function value, which adjusts the step size by the change rate of the objective function value. When the change of the objective function value is large, the step size will be appropriately increased to accelerate the convergence speed.

[0112] is the change rate part of the gradient, which adjusts the step size by the change rate of the gradient. When the change of the gradient is large, the step size will be appropriately decreased to avoid over-adjustment.

[0113] The step size adjustment formula based on the adaptive learning rate comprehensively considers various factors, can adjust the step size more flexibly, improve the convergence speed and stability of the algorithm, and better adapt to the changes of the objective function.

[0114] S307. Iteratively update the optimization vector to obtain an updated optimization vector.

[0115] Specifically, update through the iterative update formula, and the iterative update formula includes: where h k+1 represents the optimization vector at the (k + 1)-th iteration, that is, the updated optimization vector; By multiplying the subgradient by the dynamic step size S k to obtain an update amount, and adding it to the current optimization vector h k to obtain the updated optimization vector h k+1 .

[0116] S308. When the change amount of the updated optimization vector is less than the set threshold, or the number of iterations reaches the set upper limit value, stop the update.

[0117] During the iteration process, continuously monitor the change amount of the optimization vector h. If the change amount is less than the set threshold, or the number of iterations reaches the set upper limit value, it is considered that the optimization vector has converged to the optimal state. Specifically, the condition for stopping the iteration is γ is a sufficiently small value; or the number of iterative operations exceeds the upper limit value I max , then stop the subgradient calculation.

[0118] represents the L2 norm of the update amount, that is, the modulus length of the update amount.

[0119] If the L2 norm of the update amount is less than the preset threshold γ, it means that the change of the optimization vector h is very small, and further iteration will not improve the result, so stop the iteration.

[0120] If the number of iterations k reaches the preset upper limit value I max , also stop the iteration. This is to prevent the algorithm from falling into an infinite loop and ensure that the algorithm is completed within a reasonable time.

[0121] S309. Determine the updated optimization vector at the time of stopping the update as the target optimization vector.

[0122] When stopping the iteration, record the current structural similarity index (SSIM) value as the optimal structural similarity index. This step ensures that the algorithm reaches the optimal solution within a reasonable time and avoids waste of resources caused by excessive iteration.

[0123] h in the history record best It can be considered as the optimal result of SSIM, that is, the target optimization vector.

[0124] To ensure that the designed two-dimensional filter is effective for the same type of images, multiple rounds of optimization training under the same type of images (i.e., repeating the process of the above steps S201 to S309) will be carried out, and the filter with the relatively optimal comprehensive result of SSIM is selected as the final design result.

[0125] S310. Based on this target optimization vector, reconstruct the spatial filter corresponding to the multi-class pixels to obtain the corresponding target spatial filter.

[0126] Refer to the description of the foregoing embodiment for this step, which will not be elaborated here.

[0127] S311. After classifying the pixel categories of the noise image to be processed, perform denoising processing on the classified pixels through this target spatial filter respectively to obtain multiple filtering results.

[0128] Refer to the description of the foregoing embodiment for this step, which will not be elaborated here.

[0129] S312. Determine the final denoised image according to these multiple filtering results.

[0130] Refer to the description of the foregoing embodiment for this step, which will not be elaborated here.

[0131] The method of this embodiment iteratively solves the independent spatial coefficients of five two-dimensional filters with SSIM as the optimization target. When using the subgradient algorithm to solve, SSIM is used to calculate the gradient direction, and the estimated optimal SSIM is used to calculate the gradient step size, which can achieve fast algorithm convergence, balance the denoising cost and denoising effect, and ensure the effectiveness of image denoising.

[0132] In order to improve the image denoising ability of the two-dimensional filter in this embodiment, the image pixels are classified and filtered, and the two-dimensional filters used for each class are jointly designed. In the optimization design of the denoising two-dimensional filter, a subgradient method is constructed for maximizing the quality index SSIM, and a dynamically variable step size is realized based on the current SSIM and the optimal SSIM estimation during the implementation of the subgradient method, thereby improving the design efficiency.

[0133] The beneficial effects of this embodiment are mainly manifested in that it can dynamically adjust the step size according to the difference between the current SSIM value and the estimated optimal SSIM value, thereby realizing an optimization strategy with a variable step size. Since the difference decreases as the iterative design progresses, the step size also decreases accordingly. Compared with the traditional fixed-step method, this method of dynamically adjusting the step size can significantly improve the convergence speed of the algorithm, and thus improve the efficiency of filter design. It ensures the image denoising effect and image quality.

[0134] The following further illustrates the technical effects of the embodiments of the present invention in conjunction with the attached Figures 2 - 6 drawings.

[0135] In Figures 2 - 4 , the verification of the design method is carried out for the 256×256 8-bit grayscale image Lena.

[0136] The two-dimensional FIR filter used has a size of 5×5, and the threshold T for judging edge classes and non-edge classes is the pixel mean. The algorithm parameters are λ = 1.5, β = 0.99, and θ0 = 2·10 -2 , In the algorithm iteration stop condition, γ = 10 -5 and I max = 1000. Figure 2 As a direct display of the design result, it can be seen from it that Gaussian noise is effectively removed. Figure 2 In

[0137] Figure 3 shows the change of the optimal SSIM obtained during the spatial filter design process. It can be seen from it that as the algorithm iterates, the SSIM gradually increases, that is, the denoising effect gradually improves. Figure 4 shows the change of the distance h distance between the optimal two-dimensional filter coefficient h obtained during the iteration process and the final result, and the gradual decrease of h distance indicates that the solution result is gradually approaching the optimal solution. Therefore, Figure 3 and Figure 4 's changes illustrate the effectiveness of the method of this embodiment.

[0138] Figure 5 shows the results of denoising tests for different grayscale images. Figure 5 In

[0139] Test these image parts, and the test results are referred to Table 1; Table 1 shows the SSIM of the images before and after denoising. Image SSIM before denoising SSIM after denoising Lena 0.6720 0.8949 Cameraman 0.6848 0.8582 Truck 0.7128 0.8725 Girlface 0.6420 0.8876

[0140] Table 1 It can be seen that the spatial filter designed in the embodiment of the present invention can play an effective denoising function.

[0141] Furthermore, in Figure 6 , for the grayscale image Girlface, tests under other different types of noise are carried out, including salt and pepper noise and fogging noise. The upper row is the noisy image, and the lower row is the denoised image after filtering. And Table 2 below shows the SSIM of the images before and after denoising. Noise type SSIM before denoising SSIM after denoising Salt-and-pepper noise 0.7799 0.8725 Fogging noise 0.7489 0.7954

[0142] Table 2 It can be seen from the comparison that the spatial filter designed by the present invention can play an effective denoising function, can handle various types of noise, and maintain a good denoising effect on different image contents.

[0143] The method provided by the embodiment of the present invention has a dynamically adjustable gradient step, which ensures the high efficiency of the design implementation. This method is used to design five two-dimensional FIR low-pass filters for different classified pixels, because the pixels are divided into five categories according to edge details before filtering. After using the five designed filters to implement denoising filtering processing respectively, the final filtering result is synthesized to achieve the denoising effect.

[0144] The method provided in the above embodiment can be executed by an electronic device. The following describes this electronic device in the embodiment of the present invention from the perspective of hardware processing. Please refer to Figure 7 , which is a schematic structural diagram of an entity device of the electronic device in the embodiment of the present invention.

[0145] It should be noted that Figure 7 the structure of the electronic device shown is only an example, and should not bring any limitations to the functions and usage scopes of the embodiments of the present invention.

[0146] As Figure 7As shown, the electronic device includes a Central Processing Unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403, such as executing the method described in the above embodiments. In the Random Access Memory (RAM) 403, various programs and data required for system operation are also stored. The Central Processing Unit (CPU) 401, the Read-Only Memory (ROM) 402, and the Random Access Memory (RAM) 403 are connected to each other via a bus 404. An Input / Output (I / O) interface 405 is also connected to the bus 404.

[0147] The following components are connected to the Input / Output (I / O) interface 405: an input section 406 including an audio input device, a button switch, etc.; an output section 407 including a display, an audio output device, an indicator light, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the Input / Output (I / O) interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read from it can be installed into the storage section 408 as needed.

[0148] Specifically, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 409, and / or installed from the removable medium 411. When the computer program is executed by the Central Processing Unit (CPU) 401, various functions defined in the present invention are executed.

[0149] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fibers, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0150] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. Among them, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order from that marked in the accompanying drawings.

[0151] Specifically, the electronic device of this embodiment includes a processor and a memory. The memory is coupled to one or more processors, and the memory is used to store computer program code. The computer program code includes computer instructions, and one or more processors call the computer instructions to cause the electronic device to execute the method provided in the above embodiment.

[0152] On the other hand, the present invention also provides a computer-readable storage medium. This storage medium can be included in the electronic device described in the above embodiment; or it can exist separately without being assembled into the electronic device. The above storage medium carries one or more computer programs. When the one or more computer programs are executed by a processor of the electronic device, the electronic device is caused to implement the method provided in the above embodiment.

[0153] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the various embodiments of the present invention.

[0154] As used in the foregoing embodiments, depending on the context, the term "when" may be construed to mean "if", "after", "in response to determining", or "in response to detecting". Similarly, depending on the context, the phrase "when determining" or "if detecting (the stated condition or event)" may be construed to mean "if determining", "in response to determining", "when detecting (the stated condition or event)", or "in response to detecting (the stated condition or event)".

[0155] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the foregoing embodiments can be implemented by a computer program instructing relevant hardware. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the foregoing method embodiments. The foregoing storage medium includes various media that can store program codes, such as ROM, random access memory (RAM), magnetic disks, or optical discs.

Claims

1. A sub-gradient based spatial filtering image denoising method, characterized in that: include: Based on the Prewitt edge detection algorithm, the pixels of the noise image are divided into multiple categories of pixels, wherein the multiple categories of pixels include non-edge categories and multiple edge categories; Constructing corresponding spatial filters for the multiple types of pixels respectively; constructing an optimization vector according to the initial coefficients of each of the spatial filters; Constructing an objective function based on a structural similarity index, wherein the objective function has a mapping relationship with the optimization vector, and the structural similarity index is determined according to a denoised image and a noise-free original image corresponding to the noise image; In the optimization process of the objective function, a sub-gradient is obtained by deriving the current structural similarity index with respect to the coefficient of the spatial filter; Determining a dynamic step size according to the current structural similarity index, the estimated structural similarity index and the sub-gradient; Iteratively update the optimization vector according to the subgradient and the dynamic step size to obtain a target optimization vector; Reconstructing the spatial filters corresponding to the multiple types of pixels based on the target optimization vector to obtain corresponding target spatial filters; After classifying the pixel categories of the noise image to be processed, denoising is performed on the classified pixels respectively through the target spatial filter to obtain multiple filtering results; A final denoised image is determined according to the multiple filtering results.

2. The method according to claim 1, characterized in that The iterative updating of the optimization vector according to the exponential gradient and the dynamic step size to obtain an updated optimization vector includes: Iteratively updating the optimization vector to obtain an updated optimization vector; When the change of the update optimization vector is less than the set threshold value, or the number of iterations reaches the set upper limit value, the update is stopped; The update optimization vector when the updating is stopped is determined as the target optimization vector.

3. The method according to claim 1, characterized in that The pixels of the noise image are divided into multiple categories of pixels based on the Prewitt edge detection algorithm, including: Classification is performed according to preset classification rules, wherein the classification rules include: in, G(k1,k2) represents the gradient amplitude, G x and G y Respectively represent the Prewitt gradient operator in the horizontal and vertical directions, k1 and k2 are the coordinate indexes of the pixels, and T is the gradient threshold.

4. The method according to any one of claims 1 to 3, characterized in that: The sub-gradient is obtained by deriving the current structural similarity index with respect to the coefficient of the spatial filter, including: The sub-gradient is calculated by a preset sub-gradient calculation formula, and the sub-gradient calculation formula includes: in, is the sub-gradient, Δh represents the disturbance amount, P represents the noise image, and O represents the noise-free image; SSIM represents the structural similarity index, h represents the coefficient of the spatial filter, Represents the convolution operation.

5. The method according to claim 4, characterized in that Determining the dynamic step size according to the current structural similarity index, the estimated structural similarity index and the sub-gradient includes: The dynamic step length is calculated by a preset dynamic step length adjustment formula, and the dynamic step length adjustment formula includes: Among them, S k is the dynamic step size, k represents the number of iterations, represents the estimated structural similarity index, h k represents the optimization vector for the kth iteration, represents the current structural similarity index, is the subgradient of the kth iteration.

6. The method according to claim 5, characterized in that Said It is obtained by estimating the optimal structural similarity index in the historical records. The calculation formula of the estimated structural similarity index includes: in, is the historical optimal structural similarity index, θ k is the adjustment parameter at the kth iteration, used to increase the target expectation, h best Represents the historical optimal spatial filter coefficients.

7. The method according to claim 6, characterized in that θ k The calculation formula includes: Among them, θ k+1 is the adjustment parameter for the k+1th iteration, λ is an adjustment parameter greater than or equal to 1, and β is an adjustment parameter less than 1. is a positive parameter, represents the structural similarity index at iteration k+1, h k+1 Represents the optimization vector for the k+1th iteration.

8. An electronic device, characterized in that: including one or more processors and memory; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 7.

9. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Gradient-related TV factor image denoising and deblurring method based on noise level

    CN108648162A

  • Image denoising method based on regional adaptive guide filtering

    CN117455777A