CN117252788B - Image restoration method, device and storage medium - Google Patents

Image restoration method, device and storage medium Download PDF

Info

Publication number
CN117252788B
CN117252788B CN202311543549.0A CN202311543549A CN117252788B CN 117252788 B CN117252788 B CN 117252788B CN 202311543549 A CN202311543549 A CN 202311543549A CN 117252788 B CN117252788 B CN 117252788B
Authority
CN
China
Prior art keywords
image
grid
format
equation
operator
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311543549.0A
Other languages
Chinese (zh)
Other versions
CN117252788A (en
Inventor
郭靖
齐德昱
林伟伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
South China University of Technology SCUT
Original Assignee
South China University of Technology SCUT
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by South China University of Technology SCUT filed Critical South China University of Technology SCUT
Priority to CN202311543549.0A priority Critical patent/CN117252788B/en
Publication of CN117252788A publication Critical patent/CN117252788A/en
Application granted granted Critical
Publication of CN117252788B publication Critical patent/CN117252788B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10024Color image

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The invention discloses an image restoration method, an image restoration device and a storage medium, and belongs to the field of image processing. The method comprises the following steps: acquiring an image to be repaired and a mask image; transforming the pixel value of the image to be repaired into the value range of [ -1,1 ]; setting a result after the pixel value conversion as an initial value, and setting an indication coefficient by using the pixel value of the mask image; based on the set initial value and the indicating coefficient, establishing a Cahn-Hilliard equation second-order numerical format, and solving by using a geometric multi-grid solver; and according to the solving result, transforming the pixel value of the repaired image into a preset value range. The invention is based on the second-order numerical format of CH equation of the differential method, and use the geometric multiple grid solver to solve; compared with the first-order format, the second-order format has higher signal-to-noise ratio, obviously enhances the image boundary feeling in the process of repairing the image, and greatly improves the repairing effect compared with the first-order format.

Description

Image restoration method, device and storage medium
Technical Field
The present invention relates to the field of image processing, and in particular, to an image restoration method, apparatus, and storage medium.
Background
Image restoration is a method of restoring a damaged area using image surrounding information. Essentially, a type of interpolation method. Two categories can be distinguished, texture and non-texture repair: non-texture repair is primarily concerned with repairing structural information of damaged areas, such as boundaries, corners or curvatures. Texture repair based on a sample mainly focuses on global information of repairing damaged areas, and representative methods include: criminisi algorithm. In addition, some deep learning-based generative image restoration methods are also developed in recent years.
Gillette and Bertozzi originally applied the Cahn-Hilliard (CH) equation model to image restoration work. They add fidelity terms on the basis of CH equation, and have good repairing effect on binary images. The equation is:
wherein,one proposal of the authors is +.>. Wherein Neumann zero value boundary condition is used, < ->And D is an area to be repaired. The model can well fill the large-scale information deficiency. In solving the model, the authors use a numerical format of convex decomposition.
The energy functional limits of Burger on improved CH models of Gillette and Bertozzi are obtainedThe model removes free energy in CH model, and can be applied to gray image. />Has the same minimum point as the CH equation, but the model converges to steady state at a slow rate.
Kim indicates that when repairing a streak broken image, a stepped repair phenomenon at the boundary is caused due to a rough break and a smooth repair function at the boundary. For this purpose, the authors introduced a pretreatment method, first solving an anisotropic diffusion equation, and then solving the modified CH equation.
Zou aims at the problems, and a Perona-Malik equation and a CH equation are combined, a nonlinear diffusion coefficient is increased before a diffusion term, a CH equation of anisotropic diffusion is obtained, and finally a smooth restoration effect at the boundary is obtained.
Carrillo et al apply CH model to carry out image preprocessing in neural network image recognition task, and use MINIST dataset to verify CH model as preprocessor, can improve the recognition accuracy of broken data.
The above image restoration models based on the CH equation are all based on the convex decomposition method, and the numerical format with respect to time is first-order precision. Since the spatial step size is a fixed value of 1 for an image, the overall error is still affected by the time step size, although the spatial precision is second order in standard discrete format. If a small time step is to be used, a small amount of computation increases.
Disclosure of Invention
In order to solve at least one of the technical problems existing in the prior art to a certain extent, the invention aims to provide an image restoration method, an image restoration device and a storage medium.
The technical scheme adopted by the invention is as follows:
an image restoration method comprising the steps of:
acquiring an image to be repaired and a mask image;
transforming the pixel value of the image to be repaired into the value range of [ -1,1 ];
setting a result after the pixel value conversion as an initial value, and setting an indication coefficient by using the pixel value of the mask image;
based on the set initial value and the indicating coefficient, establishing a Cahn-Hilliard equation second-order numerical format, and solving by using a geometric multi-grid solver;
and according to the solving result, transforming the pixel value of the repaired image into a preset value range.
Further, the image to be repaired is a binary image, a gray level image or an RGB color image; the mask image is a binary image, and one value of the mask image is used for marking the damaged area of the image.
Further, the transforming the pixel value of the image to be repaired into the value range of [ -1,1] includes:
for gray images, dividing the gray images into N binary images according to the number N of channels of the images; the channel number is defined as the maximum pixel value of the image taking the logarithm based on 2, and then taking the integer upwards, for example, the range of the value is 0-255, and N=log (2,255) =8;
for RGB color images, converting into 3 gray images, and then converting into 3N binary images;
for a binary image, the conversion is directly performed on the basis of the original pixel value, for example, the maximum pixel value of the whole image is divided, then multiplied by 2, and then subtracted by 1; assuming that U is an image pixel value, for each pixel, it is transformed into:
further, setting the result after the pixel value conversion as an initial value, setting an instruction coefficient using the pixel value of the mask image, includes:
assigning transformed image matrix values to variables
For a mask image, the position of each pixel in the image is acquiredThe setting of the indication coefficient is as follows:
in the method, in the process of the invention,for the image area +.>For the area to be repaired, < > for>Is a preset value for ensuring that the value outside the repair area D is not affected by the calculation process.
Further, the establishing the Cahn-Hilliard equation second-order numerical format comprises the following steps:
for the Cahn-hillard equation, a second order numerical format is obtained by discretizing by using a difference method, and the format after time and space discretization is as follows:
in the method, in the process of the invention,is an interface width parameter, ">Is the unknown pixel value of the image at position (i, j), is +.>Is the known pixel value of the image at position (i, j), at the nth time step,/-, for>Is a discrete second order difference operator defined as
For not containing fidelity termsCahn-hillard equation:
this format has unconditional energy stability and unique solvability, and the dependence of the convergence constant on the interface coefficient isIs a polynomial of (2);
using auxiliary variablesuThe method comprises the following steps of:
(1)
further, the solving using the geometric multiple grid solver includes:
solving the numerical format of the formula (1) by using a nonlinear geometric multiple grid algorithm;
for the original Cahn-Hilliard equation, it isThe numerical format of the gradient flow in the space after convex decomposition processing corresponds to the minimization of one convex functional, so that the convergence of the multi-grid solver is obtained;
for geometric multiple grid algorithms, in addition to conventional interpolation and restriction operators, residual functions and fairing operators need to be defined in the code implementation.
Further, the Cahn-Hilliard equation is processed as follows:
after the known term and the unknown term in the formula (1) are arranged, the following form is obtained:
representing the residual function r as the difference between the Operator and Source operators;
setting:
the Operator is defined as a shapeNonlinear operator>The component forms are:
source operator definition as shapeSource of->The component forms are:
solving the residual equation is equivalent to solving
The light Operator smooths is a local linearization of the Operator, defined as:
zero flux Neumann boundary condition:
the initial value is input data
Further, the specific solving process includes:
using a multiple grid algorithm in a V-cycle full approximation format, solving a nonlinear disturbance equation on the coarse grid in the FAS format:
in the method, in the process of the invention,right-hand term for corresponding system of equations on coarse grid,/->For unknown variables on coarse grid, +.>To limit the operator, when h=2h, +.>The definition is as follows:
wherein x and y are coordinates of pixel points of the image;for right-hand term of the equation set to be solved +.>For the left-hand term of the equation to be solved +.>,/>The unknown image matrix variable to be solved has the same shape as the input image matrix;
in the FAS format, local linearization processing is performed only in the fairing operator;
wherein multiple grids operate on a grid having a hierarchy of gridsMarking different grid hierarchies; performing rough solution on the coarsest grid to obtain an approximate solution; then using standard mean operator and embedded operator to transfer information between two layers of grids; finally, a calculation flow of multiple grid loops at a time point is obtained;
wherein the normalized residual function norm is used to define:
wherein r is anyTensor, h is the grid width, the value in the image is a fixed value of 1,for the number of grid points in the horizontal direction +.>Is the number of grid points in the vertical direction +.>The number of pixels in the horizontal direction of the image is +.>For the number of pixels in the vertical direction of the image, +.>Is an element of the residual matrix.
The invention adopts another technical scheme that:
an image restoration apparatus comprising:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the method as described above.
The invention adopts another technical scheme that:
a computer readable storage medium, in which a processor executable program is stored, which when executed by a processor is adapted to carry out the method as described above.
The beneficial effects of the invention are as follows: the invention is based on the second-order numerical format of CH equation of the differential method, and use the geometric multiple grid solver to solve; compared with the first-order format, the second-order format has higher signal-to-noise ratio, higher image restoration prediction accuracy and stability under the same time step, obviously enhances the image boundary feeling in the image restoration process, and greatly improves the restoration effect compared with the first-order format. In addition, the invention redesigns a time high-precision format, and can more quickly complete the data preprocessing task by combining the multi-grid solver, and particularly under the condition of large data volume, the high-precision numerical format and the quick algorithm can save more time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description is made with reference to the accompanying drawings of the embodiments of the present invention or the related technical solutions in the prior art, and it should be understood that the drawings in the following description are only for convenience and clarity of describing some embodiments in the technical solutions of the present invention, and other drawings may be obtained according to these drawings without the need of inventive labor for those skilled in the art.
FIG. 1 is a flow chart of a recursive full approximation format V-loop multiple grid algorithm calculation in an embodiment of the present invention;
FIG. 2 is a flow chart of a FAS-V-loop iterative algorithm solution incorporating time steps in an embodiment of the present invention;
FIG. 3 is a flowchart of image processing computation using a neural network model in an embodiment of the present invention;
FIG. 4 is a schematic diagram of line damage mode time-sharing image restoration in an embodiment of the present invention;
FIG. 5 is a schematic diagram of pixel failure mode time-sharing image restoration in an embodiment of the present invention;
FIG. 6 is a schematic diagram comparing differences in image processing effects between the 1 st order and 2 nd order formats of CH equations in an embodiment of the present invention;
FIG. 7 is a diagram of comparing differences in image processing effects between CH equation 2 order format and other CH equation class formats in an embodiment of the present invention;
FIG. 8 is a flow chart of steps of a method for image restoration based on the Cahn-Hilliard equation in accordance with an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention. The step numbers in the following embodiments are set for convenience of illustration only, and the order between the steps is not limited in any way, and the execution order of the steps in the embodiments may be adaptively adjusted according to the understanding of those skilled in the art.
In the description of the present invention, it should be understood that references to orientation descriptions such as upper, lower, front, rear, left, right, etc. are based on the orientation or positional relationship shown in the drawings, are merely for convenience of description of the present invention and to simplify the description, and do not indicate or imply that the apparatus or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus should not be construed as limiting the present invention.
In the description of the present invention, a number means one or more, a number means two or more, and greater than, less than, exceeding, etc. are understood to not include the present number, and above, below, within, etc. are understood to include the present number. The description of the first and second is for the purpose of distinguishing between technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
Furthermore, in the description of the present invention, unless otherwise indicated, "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
In the description of the present invention, unless explicitly defined otherwise, terms such as arrangement, installation, connection, etc. should be construed broadly and the specific meaning of the terms in the present invention can be reasonably determined by a person skilled in the art in combination with the specific contents of the technical scheme.
Aiming at the problems in the prior art, the invention provides an image restoration method based on a Cahn-Hilliard equation, which solves the problems that in the existing image processing method applying the Cahn-Hilliard model, the first-order numerical format of a CH equation is applied to an image restoration work, and the restoration accuracy and the restoration effect are poor and the restoration time is long under the condition of large data quantity because the space step length is a fixed value of 1 for an image.
Term interpretation:
FAS format: referring to the manner in which equations on a coarse grid are built in a multiple grid algorithm, the nonlinear equation is approximated as a local linear equation, unlike the normal Newton method. The FAS format is calculated to yield the equation on the coarse grid:
compared to the Newton method, the FAS format does not require calculation of Jacobian matrix, and is more friendly to calculation process on memory-limited devices.
As shown in fig. 8, the present embodiment provides an image restoration method based on Cahn-hillard equation, which is based on the second-order numerical format of CH equation of the differential method, and uses a geometric multiple grid solver to solve. The method specifically comprises the following steps:
s1, acquiring an image to be repaired and a mask image.
In this embodiment, the image to be repaired may be a binary image, a gray-scale image, or an RGB color image. The mask image is a binary image, and one value of the mask image is used for marking the damaged area of the image.
S2, converting the pixel value of the image to be repaired into the value range of [ -1,1 ].
For gray images, dividing the gray images into N binary images according to the number N of channels of the images; the channel number is defined as the maximum pixel value of the image taking the logarithm based on 2, and then taking the integer upwards, for example, the range of the value is 0-255, and N=log (2,255) =8;
for RGB color images, converting into 3 gray images, and then converting into 3N binary images;
for a binary image, the conversion is directly performed on the basis of the original pixel value, for example, the maximum pixel value of the whole image is divided, then multiplied by 2, and then subtracted by 1; assuming that U is an image pixel value, for each pixel, it is transformed into:
s3, setting a result after the pixel value conversion as an initial value, and setting an indication coefficient by using the pixel value of the mask image.
Assigning transformed image matrix values to variables
For a mask image, the position of each pixel in the image is acquiredThe setting of the indication coefficient is as follows:
in the method, in the process of the invention,for the image area +.>For the area to be repaired, < > for>Is a preset value for ensuring that the value outside the repair area D is not affected by the calculation process.
And S4, based on the set initial value and the indication coefficient, establishing a Cahn-Hilliard equation second-order numerical format, and solving by using a geometric multiple grid solver.
S5, according to the solving result, the pixel value of the repaired image is transformed into a preset value range.
The calculation result is converted back to the original image. The method comprises the following steps: for gray scale images, the value can be transformed to a range of 0-255 by adding 1 to the result of the calculation, dividing by 2, and multiplying by 255. Equivalent to transforming each pixel value of a binary image. For gray-scale image, the pixel value of each channel is first +.>Shift to [0, 1]]Within the scope, the results are combined by using an exponential formula. Equivalent to->. The RGB images are processed by the above procedure for each single-color image, and then synthesized into a color image.
Step S4 is explained in detail below.
Based on the mask image, the value of the region to be repaired of the image to be repaired is masked, and in this embodiment, the value of the region to be repaired is set to zero, which corresponds to gray.
Let the definition domain of the image beThe position of each pixel point in the image is +.>
Considering energy first, the formula is as follows:
wherein the interface width parameterIs a small constant; />Is a function of (a) and (b),/>representing the position of the pixel, < >>Is a diffusion time parameter, +.>For the image to be repaired->For gradient operator->For measuring image boundaries as a function of gradient, +.>For a pixel value vector of an image expressed by a point value function, +>Is an image broken area->Is an intact image area>Indicating a positive constant for the region for keeping the value in the intact region of the image unchanged, anIn this embodiment +.>Set to 9000.
In the original CH equationThe gradient flow in the space is not in the form of the gradient flow after the fidelity term is added; the two terms of the energy functional are respectively +.>And->The equation of the continuous situation is obtained after the space is changed:
the boundary condition is zero flux Neumann boundary, let:obtaining:
initial value:
format after temporal and spatial discretization:
for a CH equation that does not contain a fidelity term, this format has unconditional energy stability and unique solvability, and the convergence constant pairDependence of +.>Is a polynomial of (2);
using auxiliary variablesuThe method comprises the following steps of:
solving the numerical format by using a nonlinear geometric multiple grid algorithm;
the known and unknown terms in the equation are sorted to the following form:
representing residual function r as the difference between Operator and Source Operator
For simplicity of representation, the following definitions:
the Operator is defined as a shapeNonlinear operator>The component forms are:
source operator definition as shapeSource of->The component form is
Solving the residual equation is equivalent to solving
The light Operator smooths is a local linearization of the Operator, defined as:
zero flux Neumann boundary condition:
the initial value is input data
A multiple grid algorithm in V-round full approximation format is used here; unlike multiple grid iterations using newton's method global linearization, solving on the coarse grid in FAS format is a nonlinear disturbance equation:
in the FAS format, local linearization processing is performed only in the fairing operator;
multiple grids operate on a grid having a hierarchy of gridsMarking different grid hierarchies; the equation is not accurately solved on the coarsest grid, and the light order step is still used to obtain an approximate solution; then using standard mean operator and embedded operator to transfer information between two layers of grids;
finally, a calculation flow of multiple grid loops at a time point is obtained;
establishing initial value estimation at different time points by using a second-order extrapolation formula, and adding a complete multiple grid loop of time step iteration;
wherein the normalized residual function norm is used to define:
wherein r is anyTensor (I)>Is an element thereof.
The above method is explained in detail below with reference to the drawings and specific examples.
According to the image restoration method based on the Cahn-Hilliard (CH) equation, which is provided by the embodiment of the invention, a CH equation second-order numerical format based on a difference method is used for solving by using a geometric multiple grid solver.
The second-order numerical format of the CH equation based on the difference method firstly considers energy, and the formula is as follows:
(1)
wherein the interface width parameterIs a small constant,/->The gradient conservation form is as follows:
(2)
wherein the method comprises the steps ofFor mobility->Is a chemical potential defined as:
(3)
wherein the method comprises the steps ofRepresentation about->Variable derivative of (2), phase field order parameter +.>And chemical potential->All meet the cycle boundary conditions;
it can be seen that formula (2) is mass-conserving; since the evolution equation is in the form of a gradient, the energy (1) does not increase over time on the trajectory of the solution (2).
Three methods for discrete time related problems exist, and the explicit format has strict time step limit; each step of the implicit format solves a nonlinear problem, a smaller time step is needed to ensure the existence of the solution, and the calculated amount is large; the semi-implicit format can relax time step constraint and reduce the calculated amount compared with the implicit format; a semi-implicit format is used herein; for simplicity, assume thatLet->,/>For time step, wherein->Is the end time; for->Make a differential approximation +.>Wherein->For->Implicit processing is carried out on the convex items, and explicit processing is carried out on the concave items, so that the obtained result is:
(4)
here taken for simplicity
In the original CH equationThe gradient flow in the space is not in the form of the gradient flow after the fidelity term is added; the two terms of the energy functional are respectively +.>And->The equation of the continuous situation is obtained after the space is changed:
the boundary condition is zero flux Neumann boundary, let:obtaining:
initial value:
format after temporal and spatial discretization:
for CH equations that do not contain fidelity terms, this format has unconditional energy stability and unique solvency, i.e., forGiven->Find +.>The cycle boundary condition is satisfied such that:
(5)
wherein:
(6)
this numerical format is mass-conservative:
(7)
and this format yields a convergence constant pairDependence of +.>Is a polynomial of (2); namely, the numerical formats (5) - (6) are first rewritten as follows: given->Solving a periodic function +.>、/>The equation is satisfied:
(8)
for convenience of subsequent demonstration, the signs of chemical potential are represented byBecome->The method comprises the steps of carrying out a first treatment on the surface of the Order the. Arbitrary->The superscript of (2) is individually assigned +.>And->The method comprises the steps of carrying out a first treatment on the surface of the Define the shape as +.>Nonlinear operatorThe component forms of (a) are:
define the shape asSource of->The component forms are as follows:
equation set (8) is equivalent to. Note operator +.>And Source->And will change at each time step.
The generation is given nextA fairing of the approximation solution. The operation of this operator is defined as:
(9)
for the approximate solution before fairing, +.>For approximate solution after fairing, +.>Is the number of times of fairing. The fairing traverses the nodes by using a nonlinear Gauss-Seidel method and a Red-Black sequence; details of the fairing using a simpler dictionary order are given below for ease of presentation; let->Ordinals for dictionary sequence Gauss-Seidel iterations. (light sequence number->And time step number m is not to be confused) to simplify the notation, let:
then there are:
wherein the method comprises the steps ofA grid function at the center of a cell is arbitrarily valued. />
Gauss-Seidel fairing is as follows: for each ofFrom ∈>Traversing to->Given the previous fairing step +.>And->Solving->And->The method meets the following conditions:
(10)
removing linearization of the cubic term, and realizing standard Gauss-Seidel block iteration by the fairing process; defined by (10)The system of linear equations is unconditionally solvable (where the determinant of the coefficient matrix is always positive); solving for +.>And->Note that the stationary point of the Gauss-Seidel iterative process is the only solution to this format.
Complete Gauss-Seidel block cycle endsAfter that, fromTo->Traversing all grid nodes in dictionary order; />After the end of the individual fairing cycles, the vector result is recorded as +.>The operation of the fairing operator ends at the same time.
The result is that after the auxiliary variable u is used for overwriting:
solving the numerical format by using a nonlinear geometric multiple grid algorithm; for the original CH equation, isThe numerical format of the gradient flow in the space after convex decomposition processing corresponds to the minimization of a convex functional, so that the convergence of the multi-grid solver can be obtained; for geometric multiple grid algorithms, in addition to conventional interpolation and restriction operators, the definition of residual functions and fairing operators is mainly required in code implementation.
The known and unknown terms in the equation are sorted to the following form:
the residual function r is expressed as the difference between the Operator and Source operators:
for simplicity of representation, the following definitions:
the Operator is defined as a shapeNonlinear operator>The component forms are:
source operator definition as shapeSource of->The component form is
Solving the residual equation is equivalent to solving
The light Operator smooths is a local linearization of the Operator, defined as:
zero flux Neumann boundary condition:
the initial value is input data。/>
A multiple grid algorithm in V-round full approximation format is used here; unlike multiple grid iterations using newton's method global linearization, solving on the coarse grid in FAS format is a nonlinear disturbance equation:
in the FAS format, local linearization processing is performed only in the fairing operator;
multiple grids operate on a grid having a hierarchy of gridsMarking different grid hierarchies; the equation is not accurately solved on the coarsest grid, and the light order step is still used to obtain an approximate solution; the information between the two layers of grids is then passed using standard mean and embedding operators.
Thus, all relevant symbols in the FAS-V-loop operator are defined, and a calculation flow of multiple grid loops at a time point (a calculation flow diagram of a recursive full-approximation format V-loop multiple grid algorithm) is obtained, wherein the calculation flow is shown in a figure 1;
finally, the following algorithm uses FAS-V-loop multiple grid format to iteratively solve the value at each time step, namely using a second-order extrapolation formula to establish initial value estimation at different time points, and adding a complete multiple grid loop of time step iteration, wherein the complete multiple grid loop is shown in figure 2.
Wherein the normalized residual function norm is used to define:
wherein r is anyTensor (I)>Is the element thereof。
Test experiment: the effect of repairing the second order CH format is verified using the predicted effect changes on the neural network model before and after preprocessing.
For this purpose, a neural network model is first trained on a handwritten digital data set MINIST; then, the damage of different modes is manufactured on the test data, and the neural network model is used for prediction, so that the prediction accuracy of the damage data is obtained; then adopting a CH model to carry out image restoration to obtain the prediction accuracy of restoration data; and finally, the prediction accuracy before and after the restoration is compared, and the amplitude is improved. The calculation flow chart is shown in fig. 3. The same calculation procedure as for carrello et al is used here.
Numerical calculation example: where MNIST data sets are used, the elements are handwritten numerical data, each element beingA gray scale map of size.
Here two modes of damage are employed, namely:
first kind: breaking the rows, randomly selecting a plurality of rows for shielding;
second kind: destroying pixels, and randomly selecting a plurality of pixel points for shielding.
In the numerical solution of the CH equation, a time step dt=0, 1 and a space step h=1 are adopted, and a definition domain is defined asIs a square area of (c). Adopts a two-stage method, namely->Change +.o at time point t=2>Is a value of (2). The expiration time t=6. Penalty term coefficient:
the neural network model prediction accuracy is used to evaluate the image restoration effect, and the evaluation index used here is the improvement rate:
wherein postAcc is the post-processing prediction accuracy, and preAcc is the pre-processing prediction accuracy.
The signal-to-noise ratio of an image is defined as:
where z is the original image and u is the restored image.
The relative L2 error of an image is defined as:
single images were compared before and after processing using CH filters. A larger one is used before the first time point t=2The value, the change course is mainly the diffusion phenomenon; a smaller +.>The value, the region edge is rapidly sharpened, forming a clear boundary.
As shown in fig. 4, fig. 4 (a) is an original image, fig. 4 (b) is a damaged image (masking random 12 lines of data), and fig. 4 (c) - (h) are restored images, corresponding to 1-6 time points, respectively. Marks are left on the thicker ribbon edges. It can be seen that the image gets a clearer border after 60 time steps of evolution.
As shown in fig. 5, the results in the pixel destruction mode are compared, where (a) in fig. 5 is an original image, (b) in fig. 5 is a damaged image (masking 30% of the pixels), and (c) - (h) in fig. 5 are repaired images, corresponding to 1-6 time points, respectively.
As can be seen from fig. 4 to 5, 1) is large at the first time pointBlurring the image, using a small +.>The value makes the image become clear gradually and the boundary sharper; 2) Continuous line damage can present difficulties in repair. Leaving marks at intermediate time points.
SNR analysis: SNR is the signal-to-noise ratio that is used to measure the ratio of signal to noise. The larger the signal-to-noise ratio, the better the image quality. SNR is used here to measure the approximation of the repaired image to the original image. The signal-to-noise ratio is used to compare the difference in image processing effects between the CH equation order 1 format and the order 2 format.
As shown in fig. 6, the number of damaged lines in fig. 6 (a) is 22, the number of damaged lines in fig. 6 (b) is 24, the number of damaged lines in fig. 6 (c) is 26, and the image is a mean point curve of 2000 test images.
The average of the SNR at different time points in the line corruption mode was calculated for 2000 samples. The abscissa is the number of time steps, and the number of damaged rows is 22, 24, 26, respectively. From the image it can be seen that: 1) The SNR of the second order format is higher than the signal-to-noise ratio of the first order format at the first three time points, and reaches a maximum at the second time point. 2) The overall SNR curve rises and then falls. 3) The greater the number of corrupted rows, the less the maximum SNR can be achieved.
From the above analysis, the neural network is used for prediction without using the repair value of the last time point, and the second time point is used for obtaining better prediction effect.
The star image streak damage repair is shown in fig. 7. The CH model belongs to a class of models with a faster calculation speed in the curvature class model. Selecting errors in a computing processThe values may cause the result to diverge, trapping in a local steady state. And is also provided withA step effect phenomenon occurs. Table 1 compares the image restoration models for the 4 CH types. Compared with the additional parameters introduced by the rest models, the original CH model is easier to search parameters. Time step 0,1, expiration time 110, image size +.>All models are solved using a time evolution based approach. />
As shown in table 1 above, the repair effect of the fractional CH equation is worst from the point of view of the repair effect, the presence of the fractional term increases the difficulty of solving, and a larger parameter search space is introduced. The same problem also exists in the PeronaMalik method and the preprocessing CH method, and the introduction of nonlinear terms increases the difficulty in solving the original equation and increases the parameter search space. In contrast, the difficulty of the CH model only exists in the selection of two-stage parameters. The CH equation solving speed using the geometric multiple grid algorithm is faster in calculation speed.
In summary, the embodiment of the invention provides a time high-precision numerical format for solving a CH equation and a multi-grid solver; compared with the first-order format, the second-order format has higher signal-to-noise ratio and higher accuracy and stability of image restoration prediction, obviously enhances the image boundary feeling in the process of restoring the image, and greatly improves the restoration effect compared with the first-order format; the invention redesigns a time high-precision format, combines a multi-grid solver to more rapidly complete the data preprocessing task, and particularly under the condition of large data volume, the high-precision numerical format and the rapid algorithm can save more time and have stable energy.
The present embodiment also provides an image restoration apparatus, including:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the method as shown in fig. 8.
The image restoration device of the embodiment can execute the image restoration method provided by the embodiment of the method, can execute the steps of the embodiment of the method in any combination, and has the corresponding functions and beneficial effects of the method.
The present application also discloses a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the method shown in fig. 8.
The embodiment also provides a storage medium which stores instructions or programs capable of executing the image restoration method provided by the embodiment of the method, and when the instructions or programs are run, any combination of the embodiments of the method can be executed to implement steps, so that the method has corresponding functions and beneficial effects.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the invention is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the described functions and/or features may be integrated in a single physical device and/or software module or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Accordingly, one of ordinary skill in the art can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the invention, which is to be defined in the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the foregoing description of the present specification, reference has been made to the terms "one embodiment/example", "another embodiment/example", "certain embodiments/examples", and the like, means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the above embodiments, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present invention, and these equivalent modifications and substitutions are intended to be included in the scope of the present invention as defined in the appended claims.

Claims (5)

1. An image restoration method, comprising the steps of:
acquiring an image to be repaired and a mask image;
transforming the pixel value of the image to be repaired into the value range of [ -1,1 ];
setting a result after the pixel value conversion as an initial value, and setting an indication coefficient by using the pixel value of the mask image;
based on the set initial value and the indicating coefficient, establishing a Cahn-Hilliard equation second-order numerical format, and solving by using a geometric multi-grid solver;
according to the solving result, transforming the pixel value of the repaired image into a preset value range;
the step of setting the result of the pixel value transformation as an initial value, and setting the indication coefficient by using the pixel value of the mask image comprises the following steps:
assigning transformed image matrix values to variables
For a mask image, the position of each pixel in the image is acquiredThe setting of the indication coefficient is as follows:
in the method, in the process of the invention,for the image area +.>For the area to be repaired, < > for>Is a preset value;
the establishing the Cahn-Hilliard equation second-order numerical format comprises the following steps:
for the Cahn-hillard equation, a second order numerical format is obtained by discretizing by using a difference method, and the format after time and space discretization is as follows:
in the method, in the process of the invention,is an interface width parameter, ">Is the unknown pixel value of the image at position (i, j), is +.>Is the known pixel value of the image at position (i, j), at the nth time step,/-, for>Is a discrete second order difference operator;
for Cahn-Hilliard equations that do not contain fidelity terms, there is unconditional energy stability and unique solvability, and the dependence of the convergence constant on the interface coefficient isIs a polynomial of (2);
using auxiliary variablesuThe method comprises the following steps of:
(1);
the solving using the geometric multiple grid solver comprises:
solving the numerical format of the formula (1) by using a nonlinear geometric multiple grid algorithm;
for the original Cahn-Hilliard equation, it isThe numerical format of the gradient flow in the space after convex decomposition processing corresponds to the minimization of one convex functional, so that the convergence of the multi-grid solver is obtained;
for geometric multiple grid algorithms, in addition to conventional interpolation and restriction operators, residual functions and fairing operators need to be defined in the code implementation;
the following treatments were performed on the Cahn-Hilliard equation:
after the known term and the unknown term in the formula (1) are arranged, the following form is obtained:
representing the residual function r as the difference between the Operator and Source operators;
setting:
the Operator is defined as a shapeNonlinear operator>The component forms are:
source operator definition as shapeSource of->The component forms are:
solving the residual equation is equivalent to solving
The light Operator smooths is a local linearization of the Operator, defined as:
zero flux Neumann boundary condition:
the initial value is input data
The specific solving process comprises the following steps:
using a multiple grid algorithm in a V-cycle full approximation format, solving a nonlinear disturbance equation on the coarse grid in the FAS format:
in the method, in the process of the invention,right-hand term for corresponding system of equations on coarse grid,/->For unknown variables on coarse grid, +.>Limiting an operator;
in the FAS format, local linearization processing is performed only in the fairing operator;
wherein multiple grids operate on a grid having a hierarchy of gridsMarking different grid hierarchies; performing rough solution on the coarsest grid to obtain an approximate solution; then using the mean operator and the embedded operator to transfer information between two layers of grids; finally, a calculation flow of multiple grid loops at a time point is obtained;
wherein the normalized residual function norm is used to define:
wherein r is anyTensor, h is the grid width, and the value in the image is a fixed value of 1,/for>For the number of grid points in the horizontal direction +.>Is the number of grid points in the vertical direction +.>Length of the number of pixels in the horizontal direction of the image, < > is given>Length of number of pixels in vertical direction of image, < >>Is an element of the residual matrix.
2. An image restoration method according to claim 1, wherein the image to be restored is a binary image, a gray-scale image or an RGB color image; the mask image is a binary image, and one value of the mask image is used for marking the damaged area of the image.
3. An image restoration method according to claim 1, wherein said transforming the pixel values of the image to be restored to within the value range of [ -1,1] comprises:
for gray images, dividing the gray images into N binary images according to the number N of channels of the images;
for RGB color images, converting into 3 gray images, and then converting into 3N binary images;
for binary images, the transformation is directly based on the original pixel values.
4. An image restoration device, comprising:
at least one processor;
at least one memory for storing at least one program;
when executed by the at least one processor, causes the at least one processor to implement the method of any of claims 1-3.
5. A computer readable storage medium, in which a processor executable program is stored, characterized in that the processor executable program is for performing the method according to any of claims 1-3 when being executed by a processor.
CN202311543549.0A 2023-11-20 2023-11-20 Image restoration method, device and storage medium Active CN117252788B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311543549.0A CN117252788B (en) 2023-11-20 2023-11-20 Image restoration method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311543549.0A CN117252788B (en) 2023-11-20 2023-11-20 Image restoration method, device and storage medium

Publications (2)

Publication Number Publication Date
CN117252788A CN117252788A (en) 2023-12-19
CN117252788B true CN117252788B (en) 2024-03-05

Family

ID=89129890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311543549.0A Active CN117252788B (en) 2023-11-20 2023-11-20 Image restoration method, device and storage medium

Country Status (1)

Country Link
CN (1) CN117252788B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110517205A (en) * 2019-09-02 2019-11-29 长沙理工大学 A kind of image repair method, system and relevant apparatus
CN111951182A (en) * 2020-07-14 2020-11-17 浙江工业大学 Hyperspectral image restoration method based on manifold weighted non-local curvature regularization
CN112132758A (en) * 2020-08-05 2020-12-25 浙江工业大学 Image restoration method based on asymmetric optical system point spread function model
CN112967196A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 Image restoration method and device, electronic device and medium
CN113409214A (en) * 2021-06-22 2021-09-17 西安交通大学 Rapid repairing method for damaged fingerprint image
CN113469909A (en) * 2021-06-29 2021-10-01 广东职业技术学院 Motion-blurred image blocking Radon transformation restoration method, medium and device
KR102396516B1 (en) * 2021-04-23 2022-05-12 고려대학교 산학협력단 Damaged fingerprint restoration method, recording medium and apparatus for performing the same
CN116862787A (en) * 2023-06-19 2023-10-10 中国人民解放军战略支援部队航天工程大学 Image restoration method, system, equipment and storage medium based on tensor singular value decomposition

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101470488B1 (en) * 2013-03-04 2014-12-09 동국대학교 산학협력단 Method and Apparatus of multi-grid using V-cycle
US20230145498A1 (en) * 2021-11-05 2023-05-11 Adobe Inc. Image reprojection and multi-image inpainting based on geometric depth parameters
US11936992B2 (en) * 2022-01-18 2024-03-19 Apple Inc. Multi-mode demosaicing for raw image data

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110517205A (en) * 2019-09-02 2019-11-29 长沙理工大学 A kind of image repair method, system and relevant apparatus
CN111951182A (en) * 2020-07-14 2020-11-17 浙江工业大学 Hyperspectral image restoration method based on manifold weighted non-local curvature regularization
CN112132758A (en) * 2020-08-05 2020-12-25 浙江工业大学 Image restoration method based on asymmetric optical system point spread function model
CN112967196A (en) * 2021-03-05 2021-06-15 北京百度网讯科技有限公司 Image restoration method and device, electronic device and medium
KR102396516B1 (en) * 2021-04-23 2022-05-12 고려대학교 산학협력단 Damaged fingerprint restoration method, recording medium and apparatus for performing the same
CN113409214A (en) * 2021-06-22 2021-09-17 西安交通大学 Rapid repairing method for damaged fingerprint image
CN113469909A (en) * 2021-06-29 2021-10-01 广东职业技术学院 Motion-blurred image blocking Radon transformation restoration method, medium and device
CN116862787A (en) * 2023-06-19 2023-10-10 中国人民解放军战略支援部队航天工程大学 Image restoration method, system, equipment and storage medium based on tensor singular value decomposition

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Cahn-Hilliard方程多重网格求解器收敛性分析;郭靖 等;《计算机科学》;第1-16页 *
基于残差注意力和金字塔上采样的图像语义分割;高军礼 等;《信阳师范学院学报(自然科学版)》;第35卷(第1期);第134-140页 *
预光滑子正则化求解的图像修复策略;吴文亮 等;《科技通报》;第34卷(第9期);第211-214页 *

Also Published As

Publication number Publication date
CN117252788A (en) 2023-12-19

Similar Documents

Publication Publication Date Title
Chang et al. Spatial-adaptive network for single image denoising
CN110298798B (en) Image restoration method based on low-rank tensor completion and discrete total variation
Pistilli et al. Learning graph-convolutional representations for point cloud denoising
Min et al. Fast global image smoothing based on weighted least squares
Gong et al. Weighted mean curvature
WO2020114329A1 (en) Fast magnetic resonance parametric imaging and device
Zhang et al. A fractional diffusion-wave equation with non-local regularization for image denoising
Zhong et al. Image reconstruction by minimizing curvatures on image surface
Chen et al. Lattice Boltzmann method for filtering and contour detection of the natural images
Ji et al. Image recovery via geometrically structured approximation
Pendu et al. Preconditioned plug-and-play admm with locally adjustable denoiser for image restoration
Kadu et al. A parametric level-set method for partially discrete tomography
Fermanian et al. PnP-ReG: Learned regularizing gradient for plug-and-play gradient descent
Hong et al. Adaptive regularization in convex composite optimization for variational imaging problems
CN117252788B (en) Image restoration method, device and storage medium
Graham et al. Unsupervised 3d out-of-distribution detection with latent diffusion models
Tai et al. A multigrid algorithm for maxflow and min-cut problems with applications to multiphase image segmentation
CN112241938A (en) Image restoration method based on smooth Tak decomposition and high-order tensor Hank transformation
Bai A new nonconvex approach for image restoration with Gamma noise
Zhou et al. Directional relative total variation for structure–texture decomposition
El Ouafdi et al. A smart stochastic approach for manifolds smoothing
Zhai et al. Two variational models for image denoising using Jacobian of normals
Liu et al. Investigating customization strategies and convergence behaviors of task-specific ADMM
Yeh Efficient knot optimization for accurate B-spline-based data approximation
Xu et al. Adaptive Bilateral Texture Filter for Image Smoothing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant