An Edge-Directed Diffusion Equation-Based Image Restoration Approach for Font Generation

The intelligent algorithms-based font generation has been a prevalent online application. In existing researches, visual communication effect of font generation results is usually neglected. To deal with this issue, this paper combines sparse representation and convex set projection restoration algorithm, and proposes a font generation image restoration method based on edge Diffusion equation. Firstly, the image is modeled using sparse representation methods, and sparsity constraints are introduced to make the solution sparse and convenient for computation. Then, the Inverse problem is transformed into a Convex optimization problem, and the global optimal solution is obtained by using the properties of Convex optimization. Finally, image restoration and reconstruction are realized by edge Diffusion equation. In this paper, we propose an image restoration method for font generation based on edge Diffusion equation. By combining sparse representation and convex set projection restoration algorithms, fast image restoration and high-quality reconstruction have been achieved. And performance evaluation was conducted using the peak signal-to-noise ratio (PSNR) metric. The experimental results have well verified the correctness of this method. The experimental results show that this method can effectively solve the ill posed problem in the Inverse problem, and achieve fast image restoration and high-quality reconstruction. Compared with traditional image restoration methods, this method has higher restoration quality and faster computational speed.


I. INTRODUCTION
Text is the most important carrier and the most concentrated representation of human information, which records thousands of years of human civilization and history [1].And it plays an extremely critical role in the inheritance and development of Chinese civilization.Text has become a basic modeling element, aiming at getting rid of the imitation of objective images by traditional painting, and creating new objects on the screen through a series of elements unrelated to objects such as physical collage, text and symbols [2].Wonderful font design requires designers to have a full understanding of the font itself, and to adjust and combine these elements with the accumulation of concepts and images in life, so as to create novel and personalized font design The associate editor coordinating the review of this manuscript and approving it for publication was Chaitanya U. Kshirsagar.
works [3].The fusion of two visual elements, characters and graphics, effectively restores the visualization and graphic characteristics of Chinese characters, making them intuitive, easy to recognize, and convenient for international communication [4], [5].This is expected to achieve a better communication effect, thus better spreading Chinese culture and letting the whole world know about Chinese characters and China [6], [7].
Art design activities are always influenced by the cultural trend of thought at that time [8], [9].Local designers are also digging Chinese traditional art elements, and spare no effort in font design, especially the profound and inexhaustible design elements of Chinese culture [10], [11].At the same time, with the development of computer design technology, information dissemination is convenient and fast, and the exploration of new font design is increasing day by day [12], [13].Today, the wide application of digital media has opened up a new development field for Chinese character design, and at the same time provided an unprecedented development opportunity [14].Patra et al. mentioned that two interrelated tasks must be solved in the object of system research.The first is to clarify what components the studied system is made of, and the second is to determine how these components are related to each other [15].Drobyshev et al. created the graphic style of purely using characters for layout design, and established the teaching system of font shape design [16].Gong studied the morphology of building font design from the aspects of artistic materials, formal structure, compound components and composing methods [17].
In the past few decades, many excellent super-resolution algorithms have emerged, which can be roughly divided into the following three categories: HR algorithms based on interpolation, reconstruction and learning [18], [19].Interpolation-based HR reconstruction algorithm mainly considers the pixel information around the pixel to be reconstructed, and the reconstruction quality is poor [20].DeJongh et al. used Markov network to establish the relationship model between the local image area and the basic scene, and used confidence propagation algorithm to train Markov network for image HR reconstruction.The image reconstruction effect is good, but the algorithm relies on a large number of training data sets, and its generality is poor [21], [22].Abubakar et al. proposed a sparse representation HR algorithm based on overcomplete dictionary pairs [23].The basic idea is that high LR(Low resolution) image blocks have the same sparse representation coefficient in their corresponding overcomplete dictionaries.Chen et al. proposed that the point spread function and the influence of noise should be considered in the image acquisition model [24].Chen proposed an HR restoration algorithm based on local structure adaptive convolution [25], which has a good practical restoration effect.
The basic idea of image processing method based on edge directed diffusion equation is to make the image change according to a specified partial differential equation on the continuous mathematical model of the image [26].And the solution of the partial differential equation is the desired processing result [27].The first step of image processing method based on edge directed diffusion equation is to establish a partial differential equation that meets the processing requirements, that is, to establish a mathematical model [28].When the mathematical model is established, how to solve the obtained partial differential equation is a severe challenge [29].The inherent discreteness of the image, the nonlinearity of the partial differential equation obtained by the mathematical model, and the huge amount of image data all bring great difficulties to the numerical solution process [30].At present, more and more researchers have devoted themselves to the field of variational partial differential equation image processing, hoping that this method can better process more and more image information and directly apply it to life and production [31].In this paper, the application of HR(high-resolution) image restoration technology in font design is studied by using edge directed diffusion equation.
This article analyzes the application of image font restoration in design and has made certain progress in visual effects.The innovation contribution is as follows: • The sparse representation method makes the solution sparse by introducing the sparsity constraint in the Inverse problem, so as to facilitate the calculation.The convex set projection restoration algorithm converts the Inverse problem into a Convex optimization problem, and uses the properties of Convex optimization to obtain the global optimal solution.This paper proposes a method combining sparse representation and projection restoration algorithm of convex sets to solve this ill conditioned Inverse problem.
• Aiming at the nonlinear ill posed Inverse problem of the partial differential equation derived from the mathematical model, a restoration algorithm combining sparse representation and convex set projection is proposed.Solved the significant difficulties brought by the numerical solution process.
• This article uses the Peak Signal to Noise Ratio (PSNR) metric for performance evaluation.The experimental results have well verified the correctness of this method.In this paper, an image restoration method for font generation based on edge Diffusion equation is studied.Section I elaborates on a series of backgrounds for analyzing and restoring text graphic features.Section II elaborates on the research methods.This section explains that the HR restoration algorithm based on sparse representation affects the natural font shape of Chinese characters.In this paper, an image restoration method for font generation based on edge oriented Diffusion equation is proposed.Section III elaborates and discusses the research results.This method can also allow users to provide additional sample images for detailed reconstruction.In the reconstruction stage, non local similarity constraints are added to the image to enable the algorithm to converge to the optimal value faster and output the reconstructed HR image.

II. METHODOLOGY
A computer image composed of dot matrix pixels is called a bitmap.The feature of bitmap image is that each pixel of the image has the change of position and color value, and the quality of the image is related to the resolution.The higher the resolution, the better the image quality, and of course, the larger the storage space.The image effect randomly formed by the computer brings a brand-new visual expression to the texture effect of words.Each word in a new set of fonts is accompanied by music, and when you need to read it or when the mouse passes by, you can make different kinds of sounds according to the connotations of different characters.I believe that in the near future, the new font of Chinese characters will take on a multi-dimensional shape.The audience's passive acceptance of information can be transformed into the process of participating in information construction.And this process reflects the good effect of the initiative transformation from unconsciousness to consciousness (Figure 1).

A. HR RESTORATION ALGORITHM BASED ON SPARSE REPRESENTATION
The form of Chinese characters is influenced by natural form, mainly by the characteristics of natural form.Among the features of natural form, the features that have obvious influence on Chinese characters or are commonly used are: natural features and moral features.When Chinese characters can be displayed on the computer screen, the strokes of Chinese characters are made up of countless pixels, and the pixels that make up these are made up of horizontally distributed dots and vertically distributed dots.A new visual effect appears in the stroke shape of Chinese characters, and the stroke shape is pixelated.This is what our design activities are pursuing.This is manifested in the unity of the font form and the connotation conveyed by Chinese characters, and the unity of the font form and the emotional thoughts that artists want to express.Designers can attach themselves to the network platform for font design, and display the dynamic font works of Chinese characters by activating the target through the viewer's click.
In the process of image formation, the quality of the obtained image is reduced due to hardware equipment and external objective environment.The influence of hardware includes aberration and distortion caused by optical imaging system and sensor process size.The external influences include the relative motion between the imaging system and the shot scene, poor focus and system noise.These factors all affect the quality of the image, making the image blurred, distorted and the resolution lower.Extracting the prior knowledge of the image from the input image, the whole restoration process can be regarded as the process of image information extraction and fusion.Typical algorithms include convex set projection, iterative back projection, maximum posterior estimation and maximum likelihood estimation.
MAP (Maximum A Posteriori) algorithm is a method based on probability statistics.The basic idea is to maximize the posterior probability of HR images when LR images are known [32].Assuming that y represents LR observation image and x represents the estimation of HR image, according to the MAP criterion, we can get: Based on Bayes theorem, the following formula can be deduced: where P(x), P(y) is the prior probability of HR image x and LR image y, respectively, P(y | x) is the conditional probability that the LR observation image is y when the HR image x of the actual scene is known, and P(y | x) is the joint probability of x, y.
The process of obtaining LR image X from ideal HR image through image degradation can be expressed as: where M represents the geometric transformation matrix from ideal HR image to LR image, and matrix B represents the image degradation process caused by factors such as point spread function.The matrix N represents the noise in the image acquisition process.According to this model, it is easy to obtain the initial HR image X −1 , re-sample it to obtain LR image Y −1 , and calculate the residual E between the original LR image Y and the LR image Y −1 generated by HR to obtain the iteratively updated HR image.The formula used is as follows: where i represents the number of iterative update operations, and j represents the number of times to calculate residuals.A long time ago, researchers discovered that the signal can be represented by a few main primitives in the signal representation based on transformation, and applied this method to the field of image compression.Moreover, the sparse representation of signals has shown good performance in these practical applications [33], [34].This means that it matches the sparse representation model of the signal.As a classic and effective statistical mathematical model, sparse coding technology has been successfully applied to image processing and computer vision, such as image compression, image denoising and image HR reconstruction, and has achieved superior results.Sparse coding technology is to represent a natural image or signal as a linear combination of a few atoms selected from an overcomplete dictionary, as shown in Figure 2. Its image signal y can be approximately represented by the linear combination of three atoms in the overcomplete dictionary D. This process of solving the optimization problem is called ''sparse coding''.
In practice, the following three constraints are usually used to solve the sparse representation problem: Among them, the constraint condition of the first case is sparsity L; In the second case, the constraint condition is to solve the residual of the signal; In the third case, sparsity L and signal residual are considered comprehensively.In the field of signal processing, the idea of orthogonal linear transformation is usually used for processing.However, there are many limitations and shortcomings in signal transformation and decomposition using fixed orthogonal basis functions [35].It has a good application effect in pattern recognition, image reconstruction and image compression, which improves the compression efficiency, reduces the cost of signal processing and improves the efficiency.In HR image reconstruction based on learning, sparse representation of images has become a very important part in HR reconstruction.
In some scales (resolutions), in many cases, the features in an image are not easy to see, but they are easy to be detected in another scale (resolutions).Multi-scale image technology is a special image analysis method, which is also called multi-resolution image technology.It can express images in multi-scale and process images based on different scales.Using multi-scale technology to express and analyze images is beneficial to extract image features more effectively [36].The spatial relationship feature of image mainly describes the spatial relative position or relative direction relationship among multiple objects in the image, and is mostly used to describe the content of the image.In practice, low-pass filtering and sub-sampling of images are often performed simultaneously to construct multi-scale representation of images.
The important basis of HR recovery is the prior knowledge obtained from a large number of training samples.The input image is the same as the training sample.Using the prior theory of the input image, the high-frequency information of LR image is reconstructed.In this paper, the recovery algorithm of sparse representation combined with convex set projection is proposed to solve this ill-posed inverse problem, and the method of sparse coding to obtain sparse vectors and dictionary learning is used to obtain an over-complete joint dictionary.According to the experimental results, this algorithm has achieved good visual effects.The algorithm flow of this paper is shown in Figure 3. Edge detection is an important part of image processing, and it is also a preparation for subsequent processing.However, although most edge detection algorithms have their own advantages, they will inevitably have negative effects on other places at the same time.The higher the SNR of the output signal, the smaller the probability of misjudging non-edge points as edge points and the probability of misjudging edge points as non-edge points [37].
SNR(Signal-to-noise ratio) is defined as: where f (x) is the impulse response of the filter in the [−w, w] region, G(x, y) is the edge detection function, and σ is the mean square root of Gaussian noise.The distance between the detected edge point and the actual edge point is the smallest, and the positioning accuracy is higher.Positioning accuracy ACC is defined as: 141438 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.where G ′ (−x) is the first derivative of G(−x), f ′ (x) is the first derivative of f (x).The higher the value of ACC, the higher the positioning accuracy is.

B. SPARSE CODING AND DICTIONARY LEARNING BASED ON EDGE DIRECTED DIFFUSION EQUATION
Actually, there are many types of outliers in natural images, and these outliers are likely to affect the final deblurring effect just like salt and pepper noise, which means that if a certain pixel receives more photons than the saturated state, the pixel intensity value has to be truncated.This nonlinear truncation violates the linear fuzzy model.In addition, the defect of the sensor may also cause unexpected situations, such as the pixel or bright or dark image due to the defect of the sensor.In compressed sensing, the input of LR image may also cause unexpected outliers.There may be an arbitrary value [38] in the dynamic range.Because it is difficult to accurately express outliers by model, it is assumed that outliers obey uniform distribution.Next, an objective function is formulated and deconvolution is performed from it using this fuzzy and noise model.
As an important branch of image enhancement, partial diffusion equation (PDE) is mainly used to filter out image noise.At the same time, there are two representative methods to properly enhance the edge of the image, one is the coherent enhancement method based on the texture features of the image, and the other is the forward-backward edge sharpening method based on the inverse diffusion equation.This paper proposes a new method based on the edge directional diffusion equation to enhance the texture and sharpen the edge at the same time.In order to effectively suppress the noise amplification of the image edge region during the restoration process, an edge oriented diffusion model is designed to suppress the noise along the edge direction of the edge region, so as to ensure that the noise existing in the edge can be effectively suppressed without blurring the edge.
Diffusion generation models are receiving increasing attention in image generation, especially in the field of medical imaging.These models, such as DCGAN, UNet, etc., can achieve good segmentation and reconstruction results in medical images through a series of convolution and deconvolution operations.Fractional derivatives can capture local and global features of an image, which is very useful for image recognition and classification.By combining wavelet transform and fractional derivative, this model can better handle the complexity and diversity of medical images.Firstly, wavelet transform can decompose an image into multiple frequency components, which is crucial for subsequent fractional derivative processing.In addition, this model also has good generalization ability.Due to their use of wavelet transform and fractional derivative methods based on mathematics, they have good adaptability to different types of images.This means that this model can achieve good segmentation and reconstruction results on different types of images.
J ρ f δ = K ρ * f δ , f δ is used to orient the edge of the image.The function of the edge orientation operator is to restrain the influence of noise on edge orientation, and correctly orient the edge in the case of noise.At this time, the anisotropic diffusion equation obtained is: The above eigenvector of diffusion tensor is the same as J ρ.
If b is taken as a constant, the edge directed diffusion equation degenerates into: When the diffusion time t → +∞, the solution f of the equation is always equal to b.When the initial position of the movable wheel kitchen is located in the target area and the background area at the same time, the geodesic movable contour model can't converge to the target edge accurately due to a single evolution mode.In this paper, the fitting force of edge directional diffusion information is used to replace the balloon force in the traditional formula, and a geodesic active contour model based on edge directional diffusion information fitting is proposed, which is defined as follows: Compared with geodesic active contour model, this model adopts the quasi-force of edge directional diffusion information as the main driving force for the evolution of active contour, and the quasi-force of edge directional diffusion information is a bidirectional global force field, which can make the active contour approach to the target edge from both sides of the edge at the same time until it converges.Median filtering is a kind of nonlinear signal processing technique based on ranking statistics theory, which can effectively suppress noise.The basic principle of median filtering is to replace the value of a point in a digital image or digital sequence with the median value of every point near the point, so that the surrounding pixel value is close to the real value, so as to eliminate isolated noise points.However, it is very effective in eliminating salt and pepper noise, and can play a special role in the phase analysis and processing method of optical measurement fringe image.Therefore, in image processing, median filtering is regarded as a classic method to smooth noise, and it is often used to protect edge information.In this paper, the fast approximation method is selected.The process of detail reconstruction is relatively simple, just put the selected high-resolution tiles in the corresponding positions, and then average the overlapping areas.Figure 4 shows a process of detail reconstruction.
The algorithm model in this paper has two outputs, sparse coefficient α y and mean value u i of LR input image, but only α y is used for HR image block reconstruction, that is, u i is a hidden variable in the process of optimization step.For the input LR image y, according to the definition of maximum posterior probability, the maximum posterior probability of α, θ is: According to Bayes theorem, the following formula can be deduced: where P(y | α, θ), P(α, θ) represents probability term and prior term respectively.{(HFD 1S 1Si , LFD For HR image reconstruction algorithm based on double dictionary learning, the dictionary construction method is very critical, and the ultimate requirement of the algorithm is to capture more high-frequency information.Obtaining rich high-frequency information can make the reconstructed image clearer in texture and edge, and achieve better image restoration effect.After training the selected dictionary category, is obtained.The specific process formula of the algorithm is as: In the formula, a * represents the sparse coefficient of y in dictionary LFD 1STi , y represents a small image block in LR image, and L represents the control parameter.
According to the image acquisition model established in this paper, the HR restoration process can be described as follows: where g k represents the LR image of the k th frame, and g k (y) represents the gray value of the LR image at the position y = [s, t] T ; f represents the ideal HR image, and f (x) represents the gray value of the ideal HR image at the position x = [u, v] T  ; f k represents the HR image obtained from g k solution; n k is the superimposed noise defined on g k ; h BP k can be considered as the approximation of the inverse process of the point spread function; m ′ k represents the pixel mapping relationship from HR image f to LR image g k .141440 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.After sparse coding, the dictionary of high LR image blocks is expressed as follows: where and A is sparse matrix.The edge reconstructed image I e and the detail reconstructed image I d can be fused by using the perceptual image W d , so as to obtain the final super-resolution image I h .The fusion process can be represented by the following formula: The context awareness map is established in the coordinate system of low-resolution image, so when the above fusion formula is actually used, it is necessary to first convert the context awareness weight map into the coordinate system of high-resolution image.

III. ANALYSIS AND DISCUSSION OF RESULTS
In order to highlight the performance difference between the improved algorithm and the original algorithm, this section takes a representative picture as an example to process the image, and compares the processing results of each link.The selected pictures not only have complex backgrounds, but also have different text sizes.Under such complex conditions, the difference of algorithm performance can be tested.Before edge detection and morphological connected domain generation, in order to get a better extraction effect, the original gray image is firstly enhanced, and the enhancement effect is shown in Figure 5.It can be seen that there is a peak in the range of [66,125] and a peak in the range of [210,260].The reason for these two peaks is that there are white and black characters in the picture.According to the contrast enhancement algorithm in this paper, the background gray value of white characters will become smaller and the background gray value of black characters will become larger.However, the background of white text occupies a large area of the picture, resulting in many pixels in this gray level, forming the highest peak.However, the background gray value of black text is very bright after enhancement, so a peak value is formed in the range of higher gray value.This article compares the training results with those with the same dataset and parameters, and selects the best results for the validation and testing sets in each training.The PSnr value is a measurement method used to compare the quality differences between different images.It is an indicator to measure the degree of image distortion, typically used to evaluate compression algorithms, the quality of transmission channels, and the effectiveness of image processing.Different algorithms generate different distortions when processing images, so the comparison results of PSNR values between them will also be different.Generally speaking, a higher PSNR value means that the distortion of the image is smaller and the quality is better.Table 1 and Figure 6 illustrate the comparison results of PSNR values for different algorithms, and it can be seen that the algorithm in this paper has good image results.Table 2 and Figure 7 analyze the comparison results of loss values under different algorithms.It can be seen that the algorithm used in this article has relatively small losses.Therefore, based on the above, the model in this paper achieved the best results in the training set.
PSNR (Peak signal-to-noise ratio) reaches 28.268dB at the highest, and loss value reaches 0.024 at the lowest.PSNR and loss values gradually get worse with the increase of level, but overall, the difference between levels gradually decreases with the increase of level.The PSNR and loss values of this algorithm are obviously superior to those of [25] and [33] in the training set, verification set and test set of the image data, which indicates that the algorithm in this paper combines the characteristics of text images, and achieves better restoration effect for defaced characters through deep feature extraction and image fusion.The PSNR and loss values of this algorithm are obviously superior to those of [25] and [33] in the training set, verification set and test set of the image data, which indicates that the algorithm in this paper combines the characteristics of text images, and achieves better restoration effect for defaced characters through deep feature extraction and image fusion.
In this experiment, the selection of relevant parameters, dictionary size of 1024, extracted high and LR image blocks   3 and Figure 8. Considering many factors, the RMSE value is low but the visual effect is good, which may be caused by edge oscillation.Therefore, the sparse representation combined with convex projection algorithm is slightly better than the sparse representation algorithm in terms of visual effect, the ability to effectively use prior knowledge and the complexity of the algorithm.Because the input image itself has a certain fractal structure, the input image itself can be directly used as an example picture in the reconstruction process.However, when the image itself can't provide more detailed reconstruction information, this method can also allow users to provide additional sample images for detailed reconstruction.Because the input image itself has a certain fractal structure, the input image itself can be directly used as an example picture in the reconstruction process.Fig. 9 shows SSIM (Structural Similarity) evaluation results of reconstruction results of several methods.It can be seen from the above restoration results that the reconstructed image algorithm of [25] is smooth and fuzzy.The reconstruction effect of this algorithm and the algorithm in [33] is much better than that of the [25] algorithm.The edge details of the restored image are clear and the restoration quality is good.In the dictionary training stage, the initial value of clustering is determined according to the distance distribution of samples, which makes dictionary training more stable and accurate.In the reconstruction stage, the non-local similarity constraint is added to the image, which makes the algorithm converge to the optimal value faster and outputs the reconstructed image of HR.
In sumamry, the model in this article achieved level 1 results on the training set, validation set, and test set, with the highest PSNR value of 28.268 dB and the lowest loss value of 0.024.The PSNR and loss values gradually deteriorate with increasing levels, indicating that the model performs better at lower levels than at higher levels.As the level increases, the difference between PSNR value and loss value gradually decreases.This indicates that the performance difference of the model gradually decreases between different levels, indicating that the model has good adaptability to data at different levels.The combination of sparse representation and convex projection algorithm is slightly better than sparse representation algorithm in terms of visual effects, ability to effectively utilize prior knowledge, and algorithm complexity.This indicates that the model can better utilize prior knowledge and handle complexity issues, resulting in excellent visual effects and performance.

IV. CONCLUSION
Wonderful font design requires designers to have a full understanding of the font itself, and to adjust and combine these elements with the accumulation of concepts and images in life, so as to create novel and personalized font design works.This paper studies the application of HR image restoration technology based on edge directed diffusion equation in font design.In this paper, sparse representation combined with convex set projection restoration algorithm is proposed to solve this ill-conditioned inverse problem.It can be seen from the research that the model in this paper achieves the best results of training set, verification set and test set at level 1, with the highest PSNR value of 28.268dB and the lowest loss value of 0.024.The PSNR value and loss value gradually get worse with the increase of level, but the difference between levels gradually decreases as a whole.Therefore, the sparse representation combined with convex projection algorithm is slightly better than the sparse representation algorithm in terms of visual effect, the ability to effectively use prior knowledge and the complexity of the algorithm.
Although the method proposed in this study has achieved good results in image restoration, there are still some issues that need further research and resolution.For example, how to better optimize the Convex optimization algorithm and improve the efficiency and accuracy of image restoration.In addition, we can further study the application of this method in other Inverse problem, such as image denoising, image enhancement, etc.

FIGURE 1 .
FIGURE 1.Comparison of information transmission effects between interactive media and non-interactive media.

FIGURE 3 .
FIGURE 3. The flow chart of the algorithm in this paper.

FIGURE 4 .
FIGURE 4. The process of detail reconstruction.

FIGURE 5 .
FIGURE 5. Gray scale distribution area map of enhanced gray scale map.

FIGURE 6 .
FIGURE 6. Set comparison chart of PSNR values of different algorithms.

FIGURE 7 .
FIGURE 7. Test the comparison chart of loss values of different algorithms.

FIGURE 9 .
FIGURE 9. SSIM value of detail reconstruction experiment results.

TABLE 1 .
Comparison of PSNR values of different algorithms.

TABLE 2 .
Comparison of loss values of different algorithms.

TABLE 3 .
RMSE comparison of three methods.
FIGURE 8. RMSE histograms of three methods.