The present disclosure relates to the field of image processing technologies, and in particular to a method for denoising an image, an apparatus, and a computer-readable storage medium.
In daily life, image processing technology has been applied to all aspects of human life, such as mobile phone terminal shooting, image display on the display, image denoising analysis in medical aviation and other fields. Among them, image denoising techniques are also applied in many important fields, and how to achieve denoising with fidelity is called the focus of research.
Current image denoising techniques require complex iterative algorithms for implementation, with complicated computational processes, more computational resources required, and longer computational times.
The present disclosure provides a method for denoising an image, an apparatus, and a computer-readable storage medium.
To solve the above technical problem, the present disclosure provides a method for denoising an image, comprising: dividing a to-be-processed image into a plurality of image areas; for each image area, expanding an edge of the image area to obtain an expanded area; wherein the expanded area comprises the image area and an edge area, and the edge area comprises pixels in another image area adjacent to the image area; for each expanded area, performing denoising processing on the expanded area through a preset algorithm to obtain a denoised expanded area; wherein the denoised expanded area comprises a denoised image area and a denoised edge area; and abandoning the denoised edge area in each denoised expanded area, and retaining and combining all the denoised image areas to form a denoised image.
In some embodiments, for each image area, the expanding an edge of the image area to obtain an expanded area comprises: expanding the image area along an edge shape of the image area to obtain the expanded area with the same shape as the image area.
In some embodiments, the expanding the image area along an edge shape of the image area comprises: expanding the edge of the image area with a preset number of pixels along the edge shape of the image area; wherein the preset number is greater than or equal to 1.
In some embodiments, the dividing a to-be-processed image into a plurality of image areas comprises: equally dividing the to-be-processed image into the plurality of image areas each in a rectangular shape.
In some embodiments, in condition of the to-be-processed image being a three-dimensional image, the dividing a to-be-processed image into a plurality of image areas comprises: dividing the to-be-processed image into the plurality of image areas according to three-dimensional coordinates of the to-be-processed image; wherein each image area is three-dimensional.
In some embodiments, for each expanded area, the performing denoising processing on the expanded area through a preset algorithm comprises: establishing an image denoising Rudin-Osher-Fatemi (ROF) model for the expanded area, and solving a Euler-Lagrange equation for the image denoising ROF model to denoise the expanded area; wherein the Euler-Lagrange equation of the image denoising ROF model is as followed:
where uk is a pixel value of a k-th denoised image area, zk is a pixel value of a k-th image area, Ωδk is a k-th expanded area, and n is an outer normal vector of a corresponding image area; k is greater than or equal to 1 and less than or equal to n; α and β are preset parameters.
In some embodiments, values of α and β depend on a desired denoising degree; the greater the desired denoising degree, the less the values of α and β.
In some embodiments, for each expanded area, the performing denoising processing on the expanded area through a preset algorithm comprises: applying a Newton-Krylov-Schwarz (NKS) algorithm to denoise the expanded area.
To solve the above technical problem, the present disclosure further provides an apparatus for denoising an image, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor; wherein the processor is capable of executing the computer program to implement operations of the method as described above.
To solve the above technical problem, the present disclosure further provides a computer-readable storage medium, storing a computer program; wherein the computer program is executable by a processor to implement operations of the method as described above.
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, an image denoising method, an image denoising apparatus, and a computer-readable storage medium provided by the present disclosure are described in further detail below in conjunction with the accompanying drawings and specific embodiments.
The image denoising method of the present disclosure is particularly suitable for large-scale images. In the method of the present disclosure, a to-be-processed image is first divided into a plurality of image areas to perform denoising processing on each image area, thereby reducing the calculation scale. In addition, it is found in the present disclosure that when directly denoising a divided image area, since there are no associated pixels around pixels at an edge of the image to refer to for denoising, the denoising effect is not good. In the present disclosure, the image is expanded and then denoised. In this case, the pixels at the edges are expanded pixels, and the pixels at the original edges are now located inside the expanded area, such that the denoising effect of the pixels at the original edges may be ensured. After completing the calculation, the denoising result at the expanded edges is discarded, i.e., the part with better denoising effect is retained and the image is reconstructed based thereon. The present disclosure ensures the denoising effect of the whole image by the above method.
Referring to
At block S101: dividing a to-be-processed image into a plurality of image areas.
In the present disclosure, the to-be-processed image is first divided into multiple image areas, and different processors may be applied to implement parallel calculation of the multiple image areas.
When the to-be-processed image is a two-dimensional image, the to-be-processed image may be equally divided into multiple rectangular image areas, which may facilitate calculation and equalize the calculation burden, improving the overall calculation efficiency. As shown in
When the to-be-processed image is a three-dimensional image, during the dividing process of the three-dimensional image, the to-be-processed image is divided into multiple three-dimensional image areas according to three-dimensional coordinates of the to-be-processed image. As shown in
At block S102: expanding an edge of each image area to obtain a corresponding expanded area.
During the calculation of each image area, the edge of the image area is required to be expanded to ensure the denoising effect of the edge of the image area. The obtained expanded area includes the image area and an edge area, and the edge area includes pixels in other image areas adjacent to the image area.
Further referring to
Specifically, in order to ensure that each pixel at the edge of the image area has a better denoising effect, each pixel at the edge is expanded. Therefore, the expansion in the embodiment is an expansion of the image area along the edge shape of the image area, to obtain the expanded area having the same shape as the image area. Specifically, the edge of the image area is expanded by a preset number of pixels, the preset number is greater than or equal to 1, and is further set to be less than or equal to 5. For example, in
The reason why the pixel at the edges has poor denoising effect is because the surrounding pixels are not considered in the calculation, while the contents of adjacent pixels in the image are generally related to each other. Therefore, in the embodiment, the image area is expanded and then calculated, and the number of associated pixels is not too large. In the embodiment, the number of expanded pixels may be set to 1-5. Of course, the more the number, the greater the computational burden. After an experimental verification, expansion with 2 pixels may be enough to achieve better calculation results and faster calculation speed.
At block S103: performing denoising processing on each expanded area through a preset algorithm to obtain a corresponding denoised expanded area.
After the image area is expanded, a preset algorithm is used to denoise the expanded area, that is, mathematical calculations are performed.
In a case where the image denoising is described in mathematical language, the details are as follows:
z(x)=u(x)+ε(x), xÅΩ⊂d (d=2,3)
where u(x) represents an ideal denoised image to be restored, z(x) represents the original observed to-be-processed image, ε(x) represents an image noise to be removed, and x∈Ω⊂d (d=2,3) represents whether the image is a two-dimensional image or a three-dimensional image. The performing denoising processing on the to-be-processed image is to find the ideal denoised image u(x).
In the embodiment, an image denoising Rudin-Osher-Fatemi (ROF) model is established to solve the above-mentioned image denoising problem, and the model is specifically as follows:
where zk=z|Ω
The above ROF model may be converted into Euler-Lagrange equation form to facilitate solving.
where α is a positive parameter, and β is also a positive parameter to avoid singularities when ↑∇uk| is 0. k represents a k-th area, and n represents an outer normal vector of the divided image area. In the embodiment, during specific calculations, uk is a pixel value of the k-th denoised image area, and zk is a pixel value of the k-th image area, that is, the original pixel value. The values of α and β depend on the degree of desired denoising. When the degree of desired denoising is greater, the values of α and β will be less, In the embodiment, the degree of denoising is expected to be greater, as shown in
For the above image denoising, a Newton-Krylov-Schwarz (NKS) algorithm may be used for calculation in the embodiment, and the specific process of the algorithm is as follows:
1. taking the image areas divided by the to-be-processed image as an initial image u0.
2.1 building a Jacobian matrix Jk.
2.2 using a Krylov subspace method to fuzzy calculate the following right preconditions for the Jacobian system.
J
k
M
k
−1
M
k
s
k
=−F(uk)
2.3 performing three times of line searching to determine a step size Tk.
2.4 uk+1=uk+Tksk.
iteratively performing the above 2.1-2.4, k=0,1, . . . until convergence.
Among them, F(u0)=0 represents a nonlinear system generated by the finite difference discretization of the following formula in the Euler-Lagrange equation above on a rectangular or hexahedral grid.
where Jk represents the full Jacobian matrix of F(uk), and Mk−1 represents an additional Schwarz preprocessing operator.
Fuzzy calculation means that the accuracy of Jacobian calculation depends on a parameter η, based on:
∥F(uk)+J(uk)sk∥≤η∥F(uk)∥
In the calculation of the NKS algorithm, the number of divided image areas is equal to the number of solvers. The solvers are for incomplete LU decomposition. The relative remaining stopping conditions for a linear solver and a nonlinear solver are 10−4 and 10−6, respectively, and the overlap in the Schwarz preprocessing operator is set to 1.
In this operation, each expanded area is calculated to obtain a corresponding denoised expanded area, and the denoised expanded area includes a denoised image area and a denoised edge area.
At block S104: abandoning a denoised edge area in each denoised expanded area, and retaining and combining the denoised image areas to form a denoised image.
After calculating the above expanded area Ωδk, the edge area part is removed, the image area part Ω0k is retained, and all the denoised image areas are combined to obtain the denoised image u. The mathematical calculation process is as follows:
u=Σk=1NE0kR0kuk
where R0k is a restriction operator from the expanded area Ωδk to the image area Ω0k. That is, the vector uk is defined in the expanded area Ωδk, and R0kuk belongs to only the image area Ω0k.
E0k is an expansion operator from the image area Ω0k to the entire image Ω. That is, m is defined as the number of pixels in the image Ω, mk is the number of pixels in the expanded area Ωδk, and E0k is a m×mk matrix. When the element (E0k)l
In the image denoising method in the embodiments, a to-be-processed image is first divided into multiple image areas, reducing the calculation scale. The edge is expanded, and after the denoising calculation, the expanded edge area with poor denoising result is removed, effectively improving the denoising effect. Specifically, ROF model or NKS algorithm may be used for calculation. For large-scale images, efficient and fast calculation may be achieved.
When the above image denoising method is implemented in detail, a computer program is usually used to express its logical process, that is, each operation of the denoising method. In addition, a corresponding software system is constructed to implement the above denoising method based on hardware equipment.
For hardware equipment, reference may be made to
The computer program may be stored in a computer-readable storage medium. When the above image denoising method is implemented in the form of software and sold or used as an independent product, it can be stored in a readable storage medium of an electronic device. That is, the present disclosure further provides a computer-readable storage medium. Referring to
The above is only an embodiment of the present disclosure, and does not therefore limit the scope of the present disclosure. The equivalent structure or equivalent process transformation made by using the contents of specification and drawings in the present disclosure, or directly or indirectly applied to other related technical fields, is the same as included in the scope of the present disclosure.
The present application is a continuation-application of International (PCT) Patent Application No. PCT/CN2019/114761, filed on Oct. 31, 2019, the entire contents of which are hereby incorporated by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2019/114761 | Oct 2019 | US |
Child | 17732577 | US |