Subgradient-based spatial filtering image denoising method, device, medium and product
By optimizing the objective function based on the Prewitt edge detection algorithm and structural similarity index, and utilizing the subgradient algorithm and dynamic step size strategy, image pixels are classified and filtered in a targeted manner. This solves the convergence problem of traditional filters in step size setting, and achieves efficient image denoising and quality improvement.
Patent Information
- Application Number
- CN202510269973.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2045-03-07
AI Technical Summary
Traditional spatial filtering image denoising techniques suffer from difficulties in achieving stable convergence or require a large number of iterations when setting the step size, which prevents further improvement in denoising effect and image quality.
The Prewitt edge detection algorithm is used to divide the pixels of noisy images into multiple classes, and a corresponding spatial filter is constructed for each class. The objective function of structural similarity index (SSIM) and subgradient algorithm are combined, and the filter coefficients are optimized through a dynamic step size strategy to achieve targeted denoising.
It significantly improves denoising performance, maintains image quality, enhances adaptability and robustness to different image content and noise types, and improves filter design efficiency and algorithm convergence speed.
Smart Images

Figure CN120198320B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and particularly relates to a spatial filtering image denoising method based on sub-gradient, a device, a medium and a product. BACKGROUND
[0002] Image denoising is an important task in image processing, which aims to recover the original and clear image from the image containing noise. Two-dimensional filter is a common technology to realize image denoising, which reduces noise by operating on the image in two-dimensional space.
[0003] The traditional spatial filtering image denoising technology suppresses noise by performing fixed mode weighting or statistical operation on the local pixel neighborhood in the image spatial domain, for example, mean filter uses neighborhood pixel average to smooth noise, Gaussian filter preserves low frequency information by distance weighted mean calculation, and median filter eliminates impulse noise by using neighborhood pixel median.
[0004] In the current filter design method, when the step size is set too large, the iteration process is easy to oscillate near the optimal solution, and it is difficult to stabilize convergence; and when the step size is too small, the parameter update amplitude is insufficient, and a large number of iteration times are required to reach the preset precision. Finally, the designed filter cannot further improve the denoising effect and image quality in the image denoising process. SUMMARY
[0005] In view of the above technical problems and defects, the purpose of the present application is to provide a spatial filtering image denoising method based on sub-gradient, a device, a medium and a product, which can improve the filter design efficiency, realize effective denoising of noise image, and guarantee the image quality.
[0006] To achieve the above object, in a first aspect, the application provides a spatial filter image denoising method based on sub-gradient, comprising: dividing pixels of a noise image into multiple classes of pixels based on a Prewitt edge detection algorithm, the multiple classes of pixels including a non-edge class and multiple edge classes; constructing corresponding spatial filters for the multiple classes of pixels respectively; constructing an optimization vector according to initial coefficients of the spatial filters; constructing an objective function based on a structural similarity index, the objective function having a mapping relationship with the optimization vector, the structural similarity index being determined according to a denoised image corresponding to the noise image and a noise-free original image; in an optimization process of the objective function, a sub-gradient is obtained by deriving a current structural similarity index with respect to coefficients of the spatial filter; a dynamic step size is determined according to the current structural similarity index, a predicted structural similarity index and the sub-gradient; the optimization vector is iteratively updated according to the sub-gradient and the dynamic step size to obtain a target optimization vector; the spatial filters corresponding to the multiple classes of pixels are reconstructed based on the target optimization vector to obtain corresponding target spatial filters; after classifying pixels of a noise image to be processed, the classified pixels are denoised by the target spatial filters respectively to obtain multiple filtering results; and a final denoised image is determined according to the multiple filtering results.
[0007] The application divides pixels of a noise image into multiple classes of pixels based on a Prewitt edge detection algorithm, including a non-edge class and multiple edge classes, and constructs corresponding spatial filters for each class of pixels to realize targeted denoising and effectively preserve image details; the filter coefficients are iteratively updated efficiently by using a sub-gradient algorithm and a dynamic step size strategy based on an objective function optimization of a structural similarity index (SSIM) to accelerate the convergence speed of the algorithm and improve the filter design efficiency; finally, the classified pixels are denoised by target spatial filters to synthesize multiple filtering results to obtain a final denoised image, effectively denoise the noise image, improve the image quality, and maintain adaptability and robustness to different image contents and noise types.
[0008] Optionally, in some embodiments, iteratively updating the optimization vector according to the index gradient and the dynamic step size to obtain an updated optimization vector comprises: iteratively updating the optimization vector to obtain an updated optimization vector; stopping updating when a change amount of the updated optimization vector is less than a set threshold value or an iteration number reaches a set upper limit value; and determining the updated optimization vector when the updating is stopped as the target optimization vector.
[0009] By adopting the technical solutions in the above-described embodiments, the iterative updating manner of the optimization vector is limited, including updating the optimization vector, setting a stop condition, and determining a target optimization vector. By setting the change amount of the updated optimization vector being less than a threshold value or the iteration number reaching an upper limit value as the stop 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 has approached convergence, and it is not meaningful to continue iteration; when the iteration number reaches the set upper limit value, iteration is stopped regardless of whether the optimization vector converges or not, so as to avoid excessive calculation.
[0010] Optionally, in some embodiments, the pixels of the noise image are divided into multiple categories of pixels based on the Prewitt edge detection algorithm, including: performing classification according to a preset classification rule, the classification rule including:
[0011]
[0012] wherein, G(k1, k2) represents the gradient amplitude, G x and G y respectively represent the Prewitt gradient operator in the horizontal direction and the vertical direction, k1 and k2 are respectively the coordinate index of the pixel, and T is the gradient threshold value.
[0013] By adopting the technical solutions in the above-described embodiments, the manner of dividing the pixels of the noise image into multiple categories of pixels based on the Prewitt edge detection algorithm is limited. According to the gradient amplitude and the gradient direction, the pixels can be divided into a non-edge category and multiple edge categories through the preset classification rule. This classification method can effectively distinguish different types of pixels in the image, and provide more accurate classification basis for subsequent denoising processing. By dividing the pixels into multiple categories, different denoising strategies can be adopted for different types of pixels, thereby improving the denoising effect while preserving important structural information of the image.
[0014] Optionally, in some embodiments, 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 through a preset sub-gradient calculation formula, the sub-gradient calculation formula including:
[0015]
[0016] wherein, is the sub-gradient, Δh represents a perturbation amount, P represents a noise image, and O represents a noise-free image; SSIM represents a structural similarity index, and h represents the coefficient of the spatial filter.
[0017] By using the technical solutions in the above embodiments, the sub-gradient can be accurately calculated by using the preset sub-gradient calculation formula, so as to provide accurate gradient information for the optimization algorithm. The calculation of the sub-gradient is a key step of the optimization algorithm, which indicates the change direction and degree of the target function at the current point. By accurately calculating the sub-gradient, it can be ensured that the optimization algorithm is iteratively updated along the correct direction, so as to accelerate the convergence speed and improve the optimization effect.
[0018] Optionally, in some embodiments, the dynamic step is determined according to the current structural similarity index, the estimated structural similarity index and the sub-gradient, including: the dynamic step is calculated by using a preset dynamic step adjustment formula, and the dynamic step adjustment formula includes:
[0019]
[0020] wherein S k is the dynamic step, k represents the iteration number, represents the estimated structural similarity index, h k represents the optimization vector of the kth iteration, represents the current structural similarity index, is the sub-gradient of the kth iteration.
[0021] By using the technical solutions in the above embodiments, the dynamic step can be reasonably calculated by using the preset dynamic step adjustment formula, so as to control the update amplitude of the optimization vector. The determination of the dynamic step is an important part of the optimization algorithm, which can automatically adjust the step according to the current optimization state, so as to avoid the problems of premature convergence or slow convergence speed caused by the fixed step. By adjusting the dynamic step, the convergence speed and stability of the optimization algorithm can be significantly improved.
[0022] Optionally, in some embodiments, the is estimated by the optimal structural similarity index in the history record, and the calculation formula of the estimated structural similarity index includes: wherein, is the history optimal structural similarity index, θ k is the adjustment parameter at the kth iteration, which is used to increase the target expectation, h best represents the history optimal spatial filter coefficient.
[0023] By using the technical solutions in the above embodiments, the estimated structural similarity index in the history record is used to estimate the estimated structural similarity index, which 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 the waste of computing resources caused by blind search can be avoided.
[0024] Optionally, in some embodiments, θ k The calculation formula includes:
[0025]
[0026] wherein θ k+1 is the adjustment parameter at the k+1th 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+1th iteration, h k+1 represents the optimization vector at the k+1th iteration.
[0027] By using the technical solutions in the above embodiments, the growth speed of the estimated structural similarity index can be effectively controlled through a reasonable adjustment parameter update rule, so as to balance 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 good optimization effect in different situations.
[0028] In a second aspect, the embodiments of the present application provide an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, the one or more processors invoke the computer instructions to make the electronic device execute the method described in the first aspect or the second aspect, and any possible implementation manner of the first aspect or the second aspect.
[0029] In a third aspect, the present application provides a computer-readable storage medium, comprising instructions, when the above instructions run on the above electronic device, make the above electronic device execute the method described in the first aspect or the second aspect, and any possible implementation manner of the first aspect or the second aspect.
[0030] In a fourth aspect, the present application provides a computer program product comprising instructions which, when the aforementioned computer program product is executed on the aforementioned electronic device, cause the aforementioned electronic device to perform the method described in the first aspect or the second aspect, and any possible implementation manner of the first aspect or the second aspect.
[0031] 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 application. Therefore, the beneficial effects achieved thereby can refer to the beneficial effects in the corresponding method, which will not be described here again.
[0032] The one or more technical solutions provided by the present application have at least the following technical effects or advantages:
[0033] 1. The present application divides the pixels of a noisy image into multiple categories of pixels, including a non-edge category and multiple edge categories, based on the Prewitt edge detection algorithm, and constructs a corresponding spatial filter for each category of pixels. This classification method can accurately identify different types of pixels in the image, thereby achieving targeted denoising processing. The non-edge category of pixels mainly focuses on smoothing processing to effectively remove noise and maintain the smoothness of the image; the edge category of pixels focuses on preserving edge details while denoising to avoid edge blurring. This classification and targeted filtering method can significantly improve the denoising effect while preserving important structural information of the image and improving the visual quality of the image.
[0034] 2. In the optimization process of the objective function, the present application obtains a sub-gradient by taking the derivative of the current structural similarity index (SSIM) with respect to the coefficients of the spatial filter, and determines a dynamic step size based on the current SSIM, the estimated SSIM, and the sub-gradient. The determination of the dynamic step size can automatically adjust the step size according to the current optimization state, avoiding the problem of premature convergence or slow convergence speed caused by a fixed step size. The sub-gradient optimization algorithm can perform iterative updates along the fastest direction in which the objective function value increases, thereby speeding up the optimization speed of the filter coefficients and improving the convergence efficiency of the algorithm. The combination of dynamic step size and sub-gradient optimization can significantly improve the efficiency and effectiveness of filter coefficient optimization, and speed up the convergence speed of the algorithm, thereby achieving more efficient image denoising processing.
[0035] 3. The application estimates the predicted SSIM by the optimal SSIM in the history record, and determines the dynamic step size according to the current SSIM, the predicted SSIM and the sub-gradient. The predicted SSIM serves as the target value of the optimization algorithm, which can guide the optimization vector to update in the direction of the optimal solution. Through reasonable prediction, the convergence speed of the optimization algorithm can be accelerated, and the denoising effect can be improved, while avoiding the waste of computing resources caused by blind search. The introduction of the historical optimal SSIM can provide a more accurate reference for the predicted SSIM, thereby improving the adaptability and robustness of the optimization algorithm, and ensuring that the algorithm can achieve good optimization effect under different conditions. The combination of the historical optimal SSIM and the predicted SSIM can significantly improve the performance of the optimization algorithm, accelerate the convergence speed and improve the denoising effect. BRIEF DESCRIPTION OF DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application. It is readily apparent to one of ordinary skill in the art that the accompanying drawings shown below in the description are only some embodiments of the application, and other drawings can be obtained from these drawings without creative labor. In the drawings:
[0037] Figure 1 is a flowchart of a sub-gradient-based spatial filtering image denoising method according to an embodiment of the application;
[0038] Figure 2 is a denoising effect display diagram of a noisy image according to an embodiment of the application;
[0039] Figure 3 is a data diagram of SSIM and iteration number according to an embodiment of the application;
[0040] Figure 4 is a change diagram of distance h distance and iteration number according to an embodiment of the application;
[0041] Figure 5 is a denoising effect display diagram of a multi-noise image according to an embodiment of the application;
[0042] Figure 6 is another denoising effect display diagram of a noisy image according to an embodiment of the application;
[0043] Figure 7 is an architecture diagram of an electronic device according to an embodiment of the application. DETAILED DESCRIPTION
[0044] The terminology used in the following embodiments of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the description of the application, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It also will be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0045] The terms "first", "second", and the like, as used herein, are intended to modify a respective subject which precedes these terms only and do not necessarily limit the scope of the application. Accordingly, a feature specified as "first" or "second" can include one or more such features, unless otherwise specified or limited in the description of embodiments of the application. The term "plurality" as used herein, unless otherwise specified or limited in the description of embodiments of the application, means two or more.
[0046] It should also be noted that, unless otherwise explicitly specified and limited, the terms "setting", "connecting" and the like in the embodiments of the application should be understood in a broad sense. For example, "connecting" can be fixedly connected, or detachably connected, or integrally connected; can be mechanically connected, or electrically connected; can be directly connected, or indirectly connected through an intermediate medium; can be internal communication of two elements; can be wired communication connection, or wireless communication connection. For those skilled in the art, the specific meaning of the above terms in the application can be understood according to the specific circumstances. The embodiments of the application will be specifically described below.
[0047] The embodiments of the application provide a spatial filtering image denoising method based on sub-gradient, as shown in Figure 1 The method comprises the following steps:
[0048] Step 201, based on the Prewitt edge detection algorithm, the pixels of the noise image are divided into multiple categories of pixels, including a non-edge category and multiple edge categories.
[0049] Wherein, Prewitt is an edge detection algorithm based on directional difference convolution kernel, which identifies the brightness mutation area in the image to locate the edge structure by calculating the gradient amplitude and direction of the horizontal and vertical directions of the image.
[0050] Firstly, the Prewitt edge detection algorithm is used to process the noisy image. The Prewitt edge detection algorithm detects the edges in the image by calculating the gradients of the image in the horizontal and vertical directions. Specifically, for each pixel in the image, the gradient values in the horizontal and vertical directions are calculated, and then the pixel is classified into a non-edge class and multiple edge classes according to the size and direction of the gradient values. The gradient values of the non-edge class pixels are small, indicating that these pixels are located in the smooth area of the image; the gradient values of the edge class pixels are large, indicating that these pixels are located in the edge area of the image. The edge class is further divided into multiple subclasses according to the direction of the gradient, such as horizontal edge, vertical edge, diagonal edge, etc.
[0051] By classifying the pixels into multiple classes, different denoising strategies can be used for different types of pixels. The non-edge class pixels mainly focus on smoothing to remove noise and maintain the smoothness of the image; the edge class pixels focus on preserving edge details while denoising to avoid edge blurring. This classification method can effectively improve the denoising effect while preserving important structural information of the image, improving the visual quality of the image.
[0052] In some embodiments, to reduce the computational cost of classification, a comparison operation can be used instead of the originally complex arctangent operation, thereby simplifying the calculation process of edge detection and improving the classification efficiency.
[0053] Specifically, when classifying the pixels of the noisy image based on the Prewitt edge detection algorithm, the pixels are directly classified into a non-edge class and multiple edge classes by comparing the gradient values of the pixels with a preset threshold, without the need for 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.
[0054] Step 202, respectively constructing corresponding spatial filters for the multiple classes of pixels.
[0055] The spatial filter can include a two-dimensional FIR (Finite Impulse Response) filter, which is also a symmetric filter.
[0056] The design of the spatial filter is usually based on the frequency response characteristics of the filter to meet the denoising needs of different pixel classes. For non-edge class pixels, the designed filter mainly focuses on smoothing to effectively remove noise; for edge class pixels, the designed filter focuses on preserving edge details on the basis of smoothing to avoid edge blurring. The design of the filter can be realized by optimization algorithms, such as least squares method, genetic algorithm, etc., to ensure that the filter achieves the best balance between denoising and detail preservation.
[0057] By designing special spatial filters for different categories of pixels, targeted denoising processing can be achieved. The filter for non-edge class pixels can effectively remove noise and improve image smoothness; the filter for edge class pixels can remove noise while preserving edge details and avoiding edge blurring. This targeted filter design method can significantly improve the denoising effect while maintaining important structural information of the image and improving the visual quality of the image.
[0058] Step 203, constructing an optimization vector according to the initial coefficients of each spatial filter.
[0059] Specifically, the initial coefficients of the above-mentioned multiple spatial filters are integrated into an optimization vector. The optimization vector is constructed to enable simultaneous adjustment and optimization of the coefficients of all filters in the subsequent optimization process. Specifically, the initial coefficients of each filter are arranged in order to form a high-dimensional vector, which 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 the coefficients of each filter can be accurately adjusted in the optimization process.
[0060] By constructing the optimization vector, the coefficients of multiple filters can be integrated into a unified optimization framework, facilitating simultaneous adjustment of the coefficients of all filters in the subsequent optimization process. This integration method can improve optimization efficiency and ensure consistent adjustment of filter coefficients, thereby optimizing the entire filter set. The construction of the optimization vector is a key step in optimizing filter coefficients, which can significantly improve the denoising performance of the filter and the image quality.
[0061] Step 204, constructing a target function based on the structural similarity index, the target function having a mapping relationship with the optimization vector.
[0062] The structural similarity index is determined according to the denoised image corresponding to the noisy image and the noise-free original image. The structural similarity index (SSIM) is an index for measuring image quality, which evaluates the similarity between two images from three aspects of brightness, 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 noise-free original image, and the better the denoising effect.
[0063] The construction of the target function is to maximize the SSIM value in the optimization process, thereby achieving the best denoising effect. Specifically, the target function f(h) can be represented as:
[0064] Wherein, O represents a noise-free original image, P represents a noisy image, h represents an optimization vector, represents a convolution operation or a filtering operation, represents a denoised image after filtering. The objective function f(h) has a mapping relationship with the optimization vector h, that is, f(h) is maximized by adjusting the optimization vector h.
[0065] By constructing the objective function based on SSIM, the similarity between the denoised image and the noise-free original image can be effectively measured, thereby guiding the optimization of the filter coefficients. As a comprehensive image quality evaluation index, SSIM can better reflect the perception of human eyes to image quality, so using SSIM as the objective function in the optimization process can significantly improve the denoising effect while preserving important structural information of the image.
[0066] Step 205, in the optimization process of the objective function, the sub-gradient is obtained by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter.
[0067] In 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, the derivative of the current SSIM value with respect to the filter coefficients is needed, so as to obtain the sub-gradient.
[0068] Specifically, since SSIM is an index for measuring the similarity between the denoised image and the noise-free original image, its value is directly affected by the filter coefficients. By calculating the partial derivative of SSIM with respect to the filter coefficients, the contribution of each coefficient to the change of SSIM can be obtained, and the vector composed of these partial derivatives is the sub-gradient. The sub-gradient reflects the change trend of the SSIM value in each direction under the current filter coefficients, thereby providing an optimization direction for the update of the filter coefficients, so that in the subsequent iteration process, the filter coefficients can be adjusted along the opposite direction of the sub-gradient to optimize, so as to gradually improve the SSIM value and achieve better denoising effect.
[0069] By calculating the sub-gradient, the change direction of the objective function at the current point can be effectively determined, thereby guiding the update of the filter coefficients. The sub-gradient algorithm is a commonly used optimization algorithm, which is particularly suitable for handling non-smooth optimization problems. Through the sub-gradient algorithm, the filter coefficients can be gradually adjusted so that the objective function gradually increases, thereby realizing the optimization of the filter.
[0070] Step 206, according to the current structural similarity index, the estimated structural similarity index and the sub-gradient, a dynamic step size is determined.
[0071] wherein the step size is a parameter in the optimization algorithm that controls the distance moved when updating the variable in each iteration, which determines the speed and amplitude of the algorithm in the search space. The embodiment adopts a dynamic step size, which can be adaptively and dynamically adjusted. The estimated structural similarity index can be estimated using the optimal SSIM according to historical records.
[0072] Specifically, to determine the dynamic step size, first, the difference between the current structural similarity index (SSIM) and the estimated optimal structural similarity index is calculated, which reflects the gap between the current filter coefficients and the optimal filter coefficients; second, the current sub-gradient, i.e., the derivative of SSIM with respect to the filter coefficients, is calculated, which indicates the direction in which the SSIM value changes fastest. The determination of the dynamic step size usually uses the following formula: step size = (estimated optimal SSIM - current SSIM) / modulus of sub-gradient.
[0073] 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 oscillation or divergence caused by excessive adjustment and ensure the stability and convergence of the algorithm.
[0074] Step 207, iteratively updating the optimization vector according to the sub-gradient and the dynamic step size to obtain a target optimization vector.
[0075] Specifically, the optimization vector is iteratively updated according to the current sub-gradient and the dynamic step size to gradually approach the target optimization vector. Specifically, the sub-gradient (i.e., the derivative of the objective function with respect to the optimization vector) is used to determine the optimization direction, which indicates the fastest direction in which the objective function value increases; at the same time, the dynamic step size is determined according to the current structural similarity index (SSIM), the estimated optimal SSIM, and the modulus of the sub-gradient, and is used to control the update amplitude of each iteration. The sub-gradient is multiplied by the dynamic step size to obtain the update amount, which is then added to the current optimization vector to obtain a new optimization vector.
[0076] Through continuous iteration of 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.
[0077] Step 208, reconstructing the spatial filter corresponding to the multi-class pixels based on the target optimization vector to obtain a corresponding target spatial filter.
[0078] Specifically, the target optimization vector contains the optimal coefficients of all spatial filters, which are determined through an iterative optimization process aimed at maximizing the Structural Similarity Index (SSIM). According to the order and number of coefficients of each spatial filter in the optimization vector, the corresponding part of the optimization vector is extracted and reorganized into a matrix form of the filter, thus completing the reconstruction of each spatial filter.
[0079] In this way, each category of pixels has the optimal spatial filter that matches its characteristics, which can more effectively remove noise while preserving important details and structural information of the image in subsequent denoising processing.
[0080] The specific reconstruction operation is based on the symmetry principle. Since spatial filters usually have symmetry, only the coefficients in one quadrant of the filter's coefficient matrix are independent and need to be optimized. This means that only the coefficients in one quadrant of the filter need to be determined, and the entire filter's coefficient matrix can be reconstructed using symmetry through mirroring and flipping operations.
[0081] Specifically, the reconstruction method is as follows:
[0082] Assuming the size of the filter is N x N (N is an odd number), the center point of the filter is fixed, and the coefficients at other positions can be determined through symmetry. For example, if the coefficients in the first quadrant are known as h(i,j) (where i,j ≥ 0), the coefficients in other quadrants can be reconstructed using the dihedral symmetry of h(i,j),
[0083] Specifically, h(i,j) = h(-i,-j);
[0084] And h(i,j) = h(j,i);
[0085] In this way, the entire filter's coefficient matrix can be efficiently reconstructed, thus obtaining the corresponding target spatial filter.
[0086] Step 209, after classifying the pixels of the noise image to be processed into different categories, the target spatial filter is used to denoise the classified pixels respectively, obtaining multiple filtering results.
[0087] Specifically, for non-edge class pixels, a specially designed non-edge class filter is used for smoothing to effectively remove noise and maintain the smoothness of the image; for edge class pixels, according to their specific edge direction (such as horizontal edge, vertical edge, etc.), the corresponding edge class filter is used for processing, which removes noise while preserving edge details.
[0088] In this way, different categories of pixels are respectively subjected to denoising processing, and multiple filtering results are obtained, each of which corresponds to the denoising effect of a category of pixels.
[0089] At step 210, a final denoised image is determined according to the multiple filtering results.
[0090] After obtaining the multiple filtering results, the corresponding filtering results are combined according to the category to which each pixel belongs to determine the final denoised image. Specifically, for each pixel point, the corresponding filtering result is selected as the final denoising value of the pixel point according to the category determined in the classification stage. In this way, by integrating the filtering results corresponding to pixels of different categories, a complete denoised image is formed.
[0091] This method can ensure that each pixel point is subjected to the filtering processing most suitable for its characteristics, thereby effectively denoising the noisy image as a whole while preserving important structural information and details of the image.
[0092] The present application divides the pixels of the noisy image into multiple categories of pixels including a non-edge category and multiple edge categories based on the Prewitt edge detection algorithm, and constructs a corresponding spatial filter for each category of pixels to achieve targeted denoising processing and effectively preserve image details. Through objective function optimization based on structural similarity index, the filter coefficients are efficiently iteratively updated using a sub-gradient algorithm and a dynamic step strategy to accelerate the convergence speed of the algorithm and improve the filter design efficiency. Finally, the classified pixels are subjected to denoising processing through the target spatial filter, and multiple filtering results are combined to obtain a final denoised image, thereby effectively denoising the noisy image, improving the image quality, and maintaining adaptability and robustness to different image contents and noise types.
[0093] In some embodiments, the present embodiment also provides a specific sub-gradient-based spatial filtering image denoising method, including the following steps:
[0094] S301, the pixels of the noisy image are divided into multiple categories of pixels based on the Prewitt edge detection algorithm, and the multiple categories of pixels include a non-edge category and multiple edge categories.
[0095] In the present embodiment, the multiple edge categories can be four edge categories.
[0096] When the Prewitt edge detection operator is used to classify the pixels of the noisy image, first, the pixels are divided into an edge category P e and a non-edge category P ne ; then the edge category is divided into four categories
[0097] The classification can be performed according to a preset classification rule, and the classification rule includes:
[0098]
[0099] in, G(k1,k2) represents the gradient magnitude, G x and G y These represent the Prewitt gradient operators in the horizontal and vertical directions, respectively, where k1 and k2 are the pixel coordinate indices, and T is the gradient threshold.
[0100] Specifically, if the gradient magnitude G(k1,k2) is less than or equal to the threshold T, the pixel is classified as a non-edge class; if the gradient magnitude is greater than the threshold T, the pixel is classified as an edge class.
[0101] Edge class I: If G x >G y And G y ≥-G x If so, then the pixel belongs to edge class I.
[0102] Edge Class II: If G y ≥G x And G y ≥-G x If so, then the pixel belongs to edge class II.
[0103] Edge Class III: If G y ≥G x And G y <-G x If so, then the pixel belongs to edge class III.
[0104] Edge class IV: If G x >G y And G y <-G x If the pixel is an edge class IV, then the pixel belongs to edge class IV.
[0105] In this embodiment, five filters are used to perform filtering and noise reduction for the five types of pixels. The two-dimensional FIR filters used are symmetrical filters with a size of N×N (N is an odd number), so the independent coefficients to be optimized for a single filter are LA = 2L. 2 +2L+1(L=(N-1) / 2) items.
[0106] The five filters have a total of 5·LA coefficients to be optimized, denoted as:
[0107]
[0108] Five two-dimensional filter coefficient matrices can be reconstructed from the optimized vector h, denoted as H. 0 H 1 H 2 H3 , H 4 . Thus, the structural similarity index SSIM can be calculated, denoted as
[0109] wherein O represents a noise-free original image, represents a convolution operation of pixels of the image P with h, * represents a convolution calculation of image space filtering.
[0110] S302, a corresponding spatial filter is constructed for each of the multi-class pixels.
[0111] This step refers to the description of the foregoing embodiments, which will not be repeated here.
[0112] S303, an optimization vector is constructed according to the initial coefficients of each spatial filter.
[0113] This step refers to the description of the foregoing embodiments, which will not be repeated here.
[0114] S304, a target function is constructed based on the structural similarity index, and the target function has a mapping relationship with the optimization vector. The structural similarity index is determined according to the denoised image corresponding to the noise image and the noise-free original image.
[0115] This step refers to the description of the foregoing embodiments, which will not be repeated here.
[0116] S305, in the optimization process of the target function, the sub-gradient is obtained by taking the derivative of the current structural similarity index with respect to the coefficients of the spatial filter.
[0117] In the embodiment, the sub-gradient algorithm can be implemented according to the SSIM value starting from a random h value, and the optimization vector h is iteratively updated.
[0118] Specifically, the sub-gradient is calculated by a preset sub-gradient calculation formula, and the sub-gradient calculation formula includes:
[0119]
[0120] wherein, is the sub-gradient, Δh represents the perturbation, P represents the noise image, O represents the noise-free original image; SSIM represents the structural similarity index, and h represents the coefficients of the spatial filter.
[0121] Forward perturbation: calculate That is, a small perturbation Δh is added to the current optimization vector h, and then the new SSIM value is calculated.
[0122] Reverse perturbation: calculate That is, a tiny perturbation Dh is reduced on the basis of the current optimization vector h, and then a new SSIM value is calculated.
[0123] The sub-gradient is calculated by dividing the difference between the two SSIM values by 2Dx.
[0124] In this way, a numerical value of the sub-gradient can be obtained, and the coefficient of the filter is updated using the sub-gradient to maximize the SSIM value, thereby achieving the effect of image denoising.
[0125] S306, determining a dynamic step length according to the current structural similarity index, the estimated structural similarity index, and the sub-gradient.
[0126] Specifically, the dynamic step length is calculated by a preset dynamic step length adjustment formula, and the dynamic step length adjustment formula includes:
[0127]
[0128] Wherein, S k is the dynamic step length, k represents the iteration number, represents the estimated structural similarity index, h k represents the optimization vector of the kth iteration, represents the current structural similarity index, specifically h k the SSIM value between the result after applying the noisy image P and the noise-free original image O, is the sub-gradient of the kth iteration.
[0129] In this embodiment, S k is the dynamic step length of the kth iteration, and by dividing the numerator (performance gap) by the denominator (square of the modulus of the gradient), it can be ensured that the step length S k can not only reflect the gap between the current filter and the optimal filter, but also dynamically adjust according to the change rate of the objective function. When the gradient is large, the step length will be relatively small, avoiding excessive adjustment; when the gradient is small, the step length will be relatively large, accelerating the convergence speed.
[0130] is the square of the L2 norm of the gradient vector , indicating the square of the modulus of the gradient.
[0131] By calculating the difference between the current estimated optimal SSIM value and the actual SSIM value, and combining the square of the modulus of the gradient, the step length S k is dynamically adjusted to ensure that the sub-gradient algorithm can quickly and stably converge to the optimal solution.
[0132] In some embodiments, is estimated from the historical optimal structural similarity index. The formula for calculating the estimated structural similarity index includes:
[0133]
[0134] wherein, is the historical optimal structural similarity index, θ k is the adjustment parameter at the kth iteration, used to increase the target expectation,
[0135] h best represents the historical optimal spatial filter coefficient, which is the optimal h that can make the SSIM the largest so far.
[0136] In some embodiments, θ k is calculated by the formula:
[0137]
[0138] wherein, θ k+1 is the adjustment parameter at the k+1th iteration, used to increase the target expectation;
[0139] λ is an adjustment parameter greater than or equal to 1, used to increase θ k when the current SSIM value is better than the historical optimal SSIM value;
[0140] β is an adjustment parameter less than 1, used to decrease θ k when the current SSIM value is not better than the historical optimal SSIM value;
[0141] is a positive parameter, represents the structural similarity index at the k+1th iteration, h k+1 represents the optimization vector at the k+1th iteration, is a sufficiently small positive number, ensuring that θ k will not be reduced to a too small value;
[0142] represents the structural similarity index at the k+1th iteration, indicating that the h k+1 at the current k+1th iteration is used to perform convolution operation on the noise- disturbed image P, and the SSIM value between the filtered result and the noise-free original image O is obtained;
[0143] represents the historical optimal structural similarity index, indicating that the h best at the k+1th iteration is used to perform convolution operation on the noise- disturbed image P, and the SSIM value between the filtered result and the noise-free original image O is obtained.
[0144] h k+1is the optimization vector for the current iteration k+1.
[0145] If is greater than the historical optimal SSIM value then k is multiplied by
[0146] If is less than or equal to the historical optimal SSIM value then k is multiplied by
[0147] By comparing the current SSIM value with the historical optimal SSIM value, the adjustment parameter k is dynamically adjusted to control the change of the step size k , ensuring that the algorithm can stably converge when approaching the optimal solution.
[0148] In some embodiments, the dynamic step size can also be adjusted by an adaptive learning rate based step size adjustment formula, which includes:
[0149]
[0150] where k is the step size of the kth iteration.
[0151] a is an initial learning rate coefficient for controlling the initial size of the step size. is the sub-gradient of the ith iteration.
[0152] b is a small constant for preventing the denominator from being zero.
[0153] f(h k ) is the objective function value of the kth iteration.
[0154] f(h k-1 ) is the objective function value of the k-1th iteration.
[0155] c is a coefficient for controlling the influence of the change rate of the objective function value.
[0156] d is a constant, specifically a small positive number, for preventing the denominator from being zero.
[0157] g is a coefficient for controlling the influence of the change rate of the sub-gradient.
[0158] j is a constant, specifically a small positive number, for preventing the denominator from being zero.
[0159] In the above formula:
[0160] For the adaptive learning rate part, the step size is adjusted 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.
[0161] For the target function value change rate part, the step size is adjusted by the change rate of the target function value, and when the change of the target function value is large, the step size will be appropriately increased to speed up the convergence speed.
[0162] For the gradient change rate part, the step size is adjusted by the change rate of the gradient, and when the gradient change is large, the step size will be appropriately reduced to avoid excessive adjustment.
[0163] The step size adjustment formula based on adaptive learning rate comprehensively considers multiple factors, can more flexibly adjust the step size, improve the convergence speed and stability of the algorithm, and better adapt to the change of the target function.
[0164] S307, iteratively update the optimization vector to obtain an updated optimization vector.
[0165] Specifically, the update is performed by an iterative update formula, and the iterative update formula includes:
[0166]
[0167] Wherein, h k+1 represents the optimization vector at the k+1 iteration, i.e. the updated optimization vector;
[0168] By multiplying the sub-gradient and the dynamic step size S k , the update amount is obtained, and it is added to the current optimization vector h k , thereby obtaining the updated optimization vector h k+1 .
[0169] S308, when the change amount of the updated optimization vector is less than a set threshold value, or the iteration number reaches a set upper limit value, stop updating.
[0170] During the iteration process, the change amount of the optimization vector h is continuously monitored. If the change amount is less than the set threshold value, or the iteration number reaches the set upper limit value, it is considered that the optimization vector has converged to the optimal state. Specifically, the stopping condition of iteration is γ is a sufficiently small value; or the iteration operation number exceeds the upper limit value I max , stop the sub-gradient calculation.
[0171] L2 norm of the update amount, i.e. the length of the update amount.
[0172] If the L2 norm of the update is less than a preset threshold γ, it means that the change of the optimization vector h is very small, and further iteration will not improve the result, so the iteration is stopped.
[0173] If the iteration number k reaches a preset upper limit I max , the iteration is also stopped. This is to prevent the algorithm from falling into an infinite loop and ensure that the algorithm is completed within a reasonable time.
[0174] S309, the update optimization vector at the time of stopping the update is determined as the target optimization vector.
[0175] At the time of stopping the iteration, the current structural similarity index (SSIM) value is recorded as the optimal structural similarity index. This step ensures that the algorithm reaches the optimal solution within a reasonable time and avoids resource waste caused by excessive iteration.
[0176] The h best in the history record can be considered as the optimal SSIM result, i.e., the target optimization vector.
[0177] To ensure that the designed two-dimensional filter is effective for the same type of image, multiple rounds of optimization training (i.e., repeating the above steps S201 to S309) are also performed for the same type of image, and the filter with the relatively optimal SSIM comprehensive result is selected as the final design result.
[0178] S310, reconstruct the spatial filter corresponding to the multiple types of pixels based on the target optimization vector to obtain the corresponding target spatial filter.
[0179] This step refers to the description of the foregoing embodiments and will not be repeated here.
[0180] S311, after classifying the pixel categories of the noise image to be processed, the classified pixels are respectively denoised by the target spatial filter to obtain multiple filtering results.
[0181] This step refers to the description of the foregoing embodiments and will not be repeated here.
[0182] S312, determine the final denoised image according to the multiple filtering results.
[0183] This step refers to the description of the foregoing embodiments and will not be repeated here.
[0184] The method of this embodiment iteratively solves the independent spatial coefficients of five two-dimensional filters with SSIM as the optimization target. When the sub-gradient algorithm is used 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, achieve a compromise between denoising cost and denoising effect, and ensure the effectiveness of image denoising.
[0185] To improve the image denoising capability of the two-dimensional filter, this embodiment performs classification filtering on image pixels and jointly designs various types of two-dimensional filters. In the optimization design of the denoising two-dimensional filter, a subgradient method is constructed to maximize the quality index SSIM. During the implementation of the subgradient method, a dynamically variable step size is achieved based on the current SSIM and the optimal SSIM estimate, thereby improving design efficiency.
[0186] The main advantages of this embodiment are: it can dynamically adjust the step size based on the difference between the current SSIM value and the estimated optimal SSIM value, thereby achieving a variable step size optimization strategy. Because the difference decreases as the iterative design progresses, the step size also decreases accordingly. Compared with the traditional fixed step size method, this dynamically adjusted step size method can significantly improve the convergence speed of the algorithm, thus improving the efficiency of filter design. This ensures both image denoising effectiveness and image quality.
[0187] The following is in conjunction with the appendix Figures 2-6 The technical effects of the embodiments of the present invention will be further explained.
[0188] exist Figures 2-4 In this paper, the design method is verified for the 256×256 8-bit grayscale image Lena.
[0189] The two-dimensional FIR filter used is 5×5 in size, and the threshold T for distinguishing edge and non-edge classes is the pixel mean. The algorithm parameters are λ = 1.5, β = 0.99, and θ0 = 2.10. -2 , In the algorithm's stopping condition, γ = 10 -5 and I max =1000. Figure 2 The design results are presented directly, demonstrating the effective removal of Gaussian noise. Figure 2 In the image, (a) shows the grayscale image Lena before denoising, which is the original noisy image; (b) shows the grayscale image Lena after denoising.
[0190] Figure 3 The changes in the optimal SSIM obtained during the spatial filter design process are shown. It can be seen that as the algorithm iterates, the SSIM gradually increases, which means that the denoising effect gradually improves. Figure 4 This demonstrates the distance h between the optimal two-dimensional filter coefficients h obtained during the iteration process and the final result. distance Changes in h distance The gradual decrease indicates that the solution is gradually approaching the optimal solution. Therefore, Figure 3 and Figure 4 The changes demonstrate the effectiveness of the method in this embodiment.
[0191] Figure 5 The results of the denoising test for different gray scale images are shown, Figure 5 The four image parts (Lena, Cameraman, Truck, Girlface) in the upper row are original noise images respectively, and the four image parts in the lower row are corresponding denoised images respectively.
[0192] The test is performed on these image parts, and the test results are referred to Table 1; Table 1 shows the SSIM of the images before and after denoising.
[0193] 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
[0194] Table 1
[0195] It can be seen that the spatial filter designed in the embodiment of the application can effectively achieve the denoising function.
[0196] Further, in Figure 6 , the gray scale image Girlface is tested under other different types of noise, including salt and pepper noise and fogging noise. The upper row is a noise image, and the lower row is a denoised image after filtering. Moreover, Table 2 below shows the SSIM of the images before and after denoising.
[0197] Noise type SSIM before denoising SSIM after denoising Salt and pepper noise 0.7799 0.8725 Spray noise 0.7489 0.7954
[0198] Table 2
[0199] It can be seen from the comparison that the spatial filter designed in the application can effectively achieve the denoising function, can process various types of noise, and can maintain good denoising effect on different image contents.
[0200] The gradient step of the method provided in the embodiment of the application can be dynamically adjusted, thereby ensuring high efficiency of design and implementation. The method is used to design five two-dimensional FIR low-pass filters for different classification pixels, because the pixels are classified into five categories according to edge details before filtering. After the five filters obtained by design are used to respectively realize denoising filtering processing, the final filtering result is synthesized, and the denoising effect is achieved.
[0201] The method provided in the above embodiment can be executed by an electronic device. The electronic device in the embodiment of the application is described from the perspective of hardware processing, and reference is made to Figure 7 , which is a schematic structural diagram of an entity device of the electronic device in the embodiment of the application.
[0202] It should be noted that Figure 7 The structure of the electronic device shown is only an example, and should not bring any limitation to the functions and use range of the embodiment of the application.
[0203] As Figure 7As shown, the electronic device includes a Central Processing Unit (CPU) 401 which can perform various appropriate actions and processes in accordance with 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, for example, to execute the methods 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 through a bus 404. An Input / Output (I / O) interface 405 is also connected to the bus 404.
[0204] Connected to the Input / Output (I / O) interface 405 are an input section 406 including an audio input device, a button switch, and the like; an output section 407 including a display and an audio output device, an indicator, and the like; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. 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 necessary. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 410 as necessary, so that a computer program read therefrom is installed in the storage section 408 as necessary.
[0205] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing a computer program for executing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication section 409 and / or from the removable medium 411. When the computer program is executed by the Central Processing Unit (CPU) 401, various functions defined in the present application are performed.
[0206] Note that specific examples of computer-readable storage media can include but are not limited to an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, computer-readable storage media can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
[0207] The flow diagrams and the block diagrams in the drawings are illustrations of architectures, functional processes, and operational processes, according to various embodiments of the present disclosure. Each block in the flow diagrams and the block diagrams can represent a module, a procedure, or a part of code that comprises one or more executable instructions for implementing the specific logical functions specified for the block. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures.
[0208] Specifically, the electronic device of the embodiment includes a processor and a memory, the memory is coupled with the one or more processors, and the memory is configured to store computer program code including computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the electronic device to perform the method provided by the above-described embodiment.
[0209] As another aspect, the present disclosure also provides a computer-readable storage medium, which can be included in the electronic device described in the above-described embodiments, or can exist separately without being assembled into the electronic device. The storage medium carries one or more computer programs, and when the one or more computer programs are executed by a processor of the electronic device, the electronic device implements the method provided in the above-described embodiments.
[0210] The above-described embodiments are merely intended to illustrate the technical solutions of the present disclosure, rather than limit the same; even though the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that modifications can be made to the technical solutions recorded in the foregoing embodiments, or equivalent replacements can be made to 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 embodiments of the present disclosure.
[0211] In the above embodiments, the term "when" can be interpreted to mean "if" or "after" or "in response to determining" or "in response to detecting" depending on the context. Similarly, the phrase "on determining" or "if detecting (a stated condition or event)" can be interpreted to mean "if determining" or "in response to determining" or "on detecting (a stated condition or event)" or "in response to detecting (a stated condition or event)" depending on the context.
[0212] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by a computer program instructing the relevant hardware to complete, and the program can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The aforementioned storage medium includes ROM or random storage memory RAM, magnetic disk or optical disk and various storage program codes.
Claims
1. A subgradient-based spatially filtered image denoising method characterized by, The method comprises: dividing pixels of a noise image into multiple categories of pixels based on a Prewitt edge detection algorithm, the multiple categories of pixels including a non-edge category and multiple edge categories; constructing corresponding spatial filters for the multiple categories of pixels respectively; constructing an optimization vector according to initial coefficients of the spatial filters; constructing an objective function based on a structural similarity index, the objective function being in a mapping relationship with the optimization vector, the structural similarity index being determined according to a denoised image corresponding to the noise image and a noise-free original image; in an optimization process of the objective function, a sub-gradient is obtained by deriving the current structural similarity index with respect to coefficients of the spatial filter; determining a dynamic step length according to the current structural similarity index, a predicted structural similarity index and the sub-gradient; iteratively updating the optimization vector according to the sub-gradient and the dynamic step length to obtain a target optimization vector; reconstructing the spatial filters corresponding to the multiple categories of pixels based on the target optimization vector to obtain corresponding target spatial filters; after classifying pixels of a noise image to be processed into categories, respectively performing denoising processing on the classified pixels by using the target spatial filters to obtain multiple filtering results; determining a final denoised image according to the multiple filtering results.
2. The method of claim 1, wherein, The iteratively updating the optimization vector according to the sub-gradient and the dynamic step length to obtain a target optimization vector comprises: iteratively updating the optimization vector to obtain an updated optimization vector; stopping updating when a change amount of the updated optimization vector is less than a set threshold value or an iteration number reaches a set upper limit value; determining the updated optimization vector at the time of stopping updating as the target optimization vector.
3. The method of claim 1, wherein, The dividing pixels of a noise image into multiple categories of pixels based on a Prewitt edge detection algorithm comprises: classifying according to a preset classification rule, the classification rule comprising: wherein, G(k1,k2) represents a gradient magnitude, G x and G y respectively represent Prewitt gradient operators in horizontal and vertical directions, k1, k2 are coordinate indices of pixels, and T is a gradient threshold value.
4. The method according to any one of claims 1 to 3, characterized in that, The obtaining a sub-gradient by deriving the current structural similarity index with respect to coefficients of the spatial filter comprises: calculating a sub-gradient by using a preset sub-gradient calculation formula, the sub-gradient calculation formula comprising: wherein, is the said secondary gradient, Dh represents the perturbation, P represents the noisy image, O represents the non-noisy image; SSIM represents the structural similarity index, h represents the coefficient of the spatial filter, represents a convolution operation.
5. The method of claim 4, wherein, The determining a dynamic step length according to the current structural similarity index, a predicted structural similarity index and the sub-gradient comprises: calculating the dynamic step length by using a preset dynamic step length adjustment formula, the dynamic step length adjustment formula comprising: where S k is the dynamic step size, k represents the iteration number, represents the estimated structural similarity index, h k represents the optimization vector of the kth iteration, represents the current structural similarity index, is the sub-gradient of the kth iteration.
6. The method of claim 5, wherein, The is estimated from the optimal structure similarity index in the history record, and the calculation formula of the estimated structure similarity index comprises: wherein, is the historical optimal structure similarity index, θ k is the adjustment parameter at the kth iteration, h best represents the historical optimal spatial filter coefficients.
7. The method of claim 6, wherein, θ k The calculation formulas include: where θ k+1 is the adjustment parameter at the k+1 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 iteration, h k+1 represents the optimization vector at the k+1 iteration.
8. An electronic device, comprising: The electronic device comprises one or more processors and a memory; The memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, and the one or more processors are configured to invoke the computer instructions to enable the electronic device to perform the method according to any one of claims 1-7.
9. A computer readable storage medium storing computer instructions, characterized in that, When the computer instructions are executed on the electronic device, the electronic device is enabled to perform the method according to any one of claims 1-7.
10. A computer program product, characterised in that, When the computer program product is executed on the electronic device, the electronic device is enabled to perform the method according to any one of claims 1-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