At present, image restoration has become a research hotspot in computer vision. The purpose of digital image restoration is to restore the lost information of the image or remove redundant objects without destroying the integrity and visual effects of the image. The operation of user interactive color migration is troublesome, resulting in low efficiency. And, when there are many kinds of colors, it is prone to errors. In response to these problems, this paper proposes automatic selection of sample color migration. Considering that the respective gray-scale histograms of the visual source image and the target image are approximately normal distributions, this paper takes the peak point as the mean value of the normal distribution to construct the objective function. We find all the required partitions according to the user’s needs and use the center points in these partitions as the initial clustering centers of the fuzzy C-means (FCM) algorithm to complete the automatic clustering of the two images. This paper selects representative pixels as sample blocks to realize automatic matching of sample blocks in the two images and complete the color migration of the entire image. We introduced the curvature into the energy functional of the p-harmonic model. According to whether there is noise in the image, a new wavelet domain image restoration model is proposed. According to the established model, the Euler–Lagrange equation is derived by the variational method, the corresponding diffusion equation is established, and the model is analyzed and numerically solved in detail to obtain the restored image. The results show that the combination of image sample texture synthesis and segmentation matching method used in this paper can effectively solve the problem of color unevenness. This not only saves the time for mural restoration but also improves the quality of murals, thereby achieving more realistic visual effects and connectivity.

1. Introduction

Throughout the development of visual art history, from graffiti in prehistoric caves to exquisite murals in churches, from meticulous paintings to fully reproduced photography, every revolutionary change in the reproduction of reality has produced various studies in the field of humanities [1, 2]. The revolutionary changes brought by computer graphics technology in the audio-visual field also affected the field of cultural heritage protection and dissemination for the first time. In order to adapt to the changes in digital information technology, it is necessary to reexamine the thinking and methods of research [3, 4]. Computer science has a history as long as the use of computer programs to record cultural heritage. Technologies such as information modeling, graphics, three-dimensional visualization, and virtual reality have promoted the development of new theories and empirical methods in the field of cultural heritage protection [5]. Computer visualization technology has become an indispensable tool in the field of cultural heritage protection. It helps us describe and explain reality and the past. Cultural heritage information models and digital protection have become the most dynamic research topics in this field [6]. Early computer-related archaeological calculation methods used quantitative calculations to record archaeological data [7]. With the technological advancement of computer science, virtual archaeology has become a discipline that uses three-dimensional computer graphics technology to analyze the process of management, interpretation, and expression of archaeological evidence [8]. The application of emerging technologies in the field of cultural heritage has given birth to new concepts such as virtual heritage, digital heritage, digital archaeology, virtual museums, and network archaeology [9]. These studies have obvious interdisciplinary and comprehensive characteristics and have gradually formed the research direction of cultural heritage informatics [10]. The data recording, storage, archiving, and analysis of cultural heritage form a complete academic framework, which provides a guarantee for the development of this field in the information age.

Wavelet analysis is also called multiresolution analysis. It is a new time-frequency analysis method developed in recent years [11]. It is developed on the basis of traditional Fourier analysis. It combines functional analysis, harmonic analysis, Fourier analysis, numerical analysis, spline analysis, etc., to study the characteristics of functions on the time-frequency plane [12]. Because wavelet analysis makes up for the shortcomings of Fourier analysis, it has good localization properties in both the time domain and the frequency domain, and its reputation as “adaptability” and “mathematical microscope” has made it a hot spot for many disciplines [13]. The application areas are becoming more and more extensive. With the continuous development of computer science, image restoration has developed into a multifield, multidisciplinary comprehensive technology and has become a research hotspot in the field of computer vision [14]. Nowadays, digital images have become an indispensable way of information communication in people’s lives, and they are spread through various media [15]. Due to the unreliability of coding and communication, the data and information of the image are lost during the transmission and compression process. Therefore, the image restoration technology has important application value in the aspects of famous rendition, video processing, virtual reality, medical imaging, image transmission, and so on [16].

This paper proposes a combination of normal distribution partition search algorithm and fuzzy C-means (FCM) algorithm to achieve color migration. Normal distribution partition search is to divide the area based on the gray histogram of the source image and the target image, divide the pixel points in the area with a distance of 2б from the high peak point into one category, and then subtract them from the histogram. Since the FCM algorithm needs to provide an initial clustering center for it, the selection of the initial clustering center will affect the execution effect of the entire FCM algorithm, and the FCM algorithm has the best effect on data objects that conform to the normal distribution. The partition search method divides the two images into regions and uses the obtained center point as the clustering center of the FCM algorithm, so as to achieve the best execution effect of the entire algorithm. After the clustering is divided, the sample blocks are automatically selected according to the nature of the pixel point density, and the sample block selection and matching are automatically realized until the color migration is completed. By introducing the curvature term into the energy functional of the p-harmonic model, a new wavelet domain image restoration model is proposed, which makes the diffusion coefficient of the new model controlled by two variables, the gradient value and the curvature. The new model to repair the image not only protects the edge information, but also avoids the generation of step effects. The color restoration of the murals is actually a reverse process, in which ill-conditioned restoration results will inevitably occur during the restoration, and the evaluation of the restored murals is also multifaceted. The purpose of all restorations is to improve the quality of the image restoration. Through multiple sets of experiments, the improved algorithm given in this paper can achieve effective repair effects.

In order to solve the problem of repairing large-scale damage, people have explored texture-based image repair technology [17]. This technology has a good repair effect for images with large damaged areas, especially for complex texture damage. The texture-based image inpainting technology roughly includes the following two types: one is a sample-based texture synthesis model, which mainly includes a texture synthesis algorithm based on nonparametric sampling [18]; the other is a repair model based on image decomposition, including TV decomposition algorithm, wavelet decomposition algorithm, and so on [19]. The model first decomposes the damaged image preprocessing method into two parts: structure and texture, repairs them with different algorithms according to the characteristics of each part, and finally reconstructs the repaired two parts.

By introducing a nonlinear total variation image denoising model, related scholars have proposed an image restoration method based on the TV model [20]. This method constructs the image information as a constrained optimization problem. Through the effective geometric information near the area to be repaired, the discrete gradient direction is calculated and anisotropic diffusion and extension are carried out inward. This method can maintain the linear characteristics of the edge of the image. At the same time, image noise is effectively suppressed, but when the damage width is greater than the geometric width, the model cannot be structurally connected; that is, the connectivity of the image is destroyed [21, 22].

In order to meet the connectivity criterion, related scholars have proposed a CDD model using third-order partial differential equations [23]. By introducing curvature drive, compared to the TV model, it can better fill the structural damage information in a larger area, but the computational complexity is relatively increased [24]. In order to reduce the repair time, related scholars have proposed a fast PDE model algorithm, which spreads smooth estimation along the gradient direction of the damaged boundary and constructs the image information into a horizontal set [25]. The FMM algorithm is simple to implement, overcomes the time-consuming shortcomings of the traditional PDE model algorithm, and can better maintain the linear structure of the image, but this type of method starts from the local information of the image and cannot solve the blur problem caused by the large area defect [26, 27].

Related scholars have proposed a p-Harmonic-based variational repair model, which uses a half-point difference algorithm to discretize the Euler–Lagrange equation and establishes an image repair algorithm with faster convergence [28]. Compared with the TV algorithm, this algorithm has a better repair effect on the treatment of small-scale damage. Related scholars proposed a morphologically invariant coupled repair model, which uses the equivalence of the nonviscosity Helmholtz vorticity equation and transmission smoothness information to smoothly repair the damaged area of the image and maintain the damage better [2931]. Relevant scholars combined the variational model with the p-Laplace model and proposed a hybrid image restoration algorithm [32]. This algorithm effectively overcomes the step effect caused by the anisotropic diffusion equation in the smooth region of the image by introducing diffusion control parameters. The edge information of the image is kept better, and a better repair effect is achieved. Relevant scholars divided the eight neighborhoods of the points to be repaired into two groups and combined the variational algorithm to propose a double-cross TV algorithm [33, 34]. The reference information of each group was weighted and averaged to obtain the repair information, which effectively improved the accuracy of image repair. The researchers introduced the gradient direction histogram in the direction detection, making the direction information filtering around the area to be repaired more stringent, ensuring the smoothness of the structure, and achieving a better repair effect [35, 36].

Non-texture-based image restoration technology is mainly used to repair small-scale digital defect images. Most of this technology uses models based on variational partial differential equations. Models based on partial differential equation models include Curvature-Driven Diffusion (CDD) and Total Variation (TV). This type of model uses the known information of the image to establish a priori model, converts the image restoration into the problem of minimizing the energy functional, and uses the variational method to solve the extreme value of the energy functional, as well as a series of improved algorithms. This type of algorithm has a good repair effect for images with small damaged areas, such as scratches and creases, but it is not ideal for images with large damaged areas or rich texture defects.

3. Automatic Selection of Virtual Color Migration of Sample Cultural Heritage Buildings

3.1. Cluster Analysis for Virtual Color Migration

Unlike the traditional deductive method of classifying based on preset criteria, cluster analysis is inductive. Clustering according to the similarity between objects is one of the important functions of data mining. Among the multiple groups of objects divided by cluster analysis, the similarity of members within the group is maximized, and the similarity of members between groups is the smallest. These are also two characteristics that the clustering needs to follow: similarity within domains and dissimilarity between domains.

For a traditional set A, for any element x, there is a characteristic function corresponding to it:

If X belongs to set A, the value is −1; if x does not belong to set A, the value is 1. The fuzzy set depends on the value of the membership degree of the object in it. Among them, the value range of is the interval [0, 1]. On the basis of the concept of fuzzy set, each group of objects after clustering is regarded as a fuzzy set; then the membership degree of any object in each group belonging to the cluster is determined according to the value of .

We divide the vector xj into Ci (i ∈ {1, 2, …, c}) groups and find the cluster center of each group. When selecting the Euclidean distance between the vector object xk in group i and the cluster center ci, it is a dissimilarity index, and the function with this index as a variable reaches the minimum value; the objective function is defined as

Ji represents the objective function in the i group. Here, it can be seen that Ji depends on the spatial characteristics of the clusters and their centers.

3.2. Normal Distribution Partition Search

The normal distribution is Gaussian distribution, and its function curve is bell-shaped, x = μ is the symmetry axis of the function, where µ is the average value of the function, and s is the standard deviation; then the function expression is

Formula (3) represents the probability that a random variable is in a certain interval. When the object independent variable is within a range of б about the mean μ, the probability is 68.2689%, and the probability within a range of 2 бs about the mean µ is 95.4500%. The probability within the left and right 3 б ranges is 99.7300%, and the probability within the 4 бs around the mean µ has reached 99.9937%, which means almost all coverage. The automatic partitioning introduced in this section is based on the above foundation.

The gray values ud and us of the highest peak point are, respectively, regarded as the mean values of the initial normal distribution functions of the two graphs, and their respective standard deviations are σd and σs. Then the normal distribution function of the form shown in the following formula is obtained:

The deviation formula of the normal distribution and the actual gray distribution can be obtained:

Here, h represents the gray value with a value interval of [0, 255].

3.3. Fuzzy C-Means Clustering of Virtual Colors

Through the normal distribution partition search method, the initial cluster centers required by the FCM algorithm have been obtained, and the set of them is represented by Ci (i ∈ {1, 2, …, c}). The purpose of the FCM algorithm is to divide the known n data objects xj (j ∈ {1, 2, 3, …, n}) into the c clusters and make the following objective function value the smallest. The membership degree of each given data object to each cluster is a value between 0 and 1, but the normalization stipulates that the sum of the membership degrees of a data object must be equal to 1. Let the membership matrix be uij, where i represents the serial number of the cluster, j represents the j-th data object, and its expression is

Since FCM is a soft partition based on HCM, the objective function of FCM is actually a generalized form of the objective function of HCM, and the expression is

By deriving each parameter, we can obtain the conditions to be met by the cluster center that minimizes the objective function value and the conditions to be met by the degree of membership:

The parameters of the FCM algorithm include the number of clusters and the weighting index m. The number of clusters should be much smaller than the number of data objects, and the number of clusters should be greater than 1. As the algorithm flexibility parameter, m should be the most ideal. The algorithm will output the cluster center point, the cluster center also represents the average attribute of the cluster, and it will also output a membership matrix, through which each data object can be distinguished to which cluster each data object belongs. The algorithm is ideal for clustering data objects that meet the normal distribution.

4. Image Restoration Strategy in the Wavelet Domain

4.1. Wavelet Domain Image Restoration Model Based on p-Laplace Operator

Suppose the standard image model is

Here, is the original image and is the random noise. Set the size of the image to nm; the wavelet transform of is expressed as follows:

The p-harmonic model of image restoration in the wavelet domain is as follows:

Here, is the wavelet transform, expressed as

And, it meets the following restrictions:

Here, I is the damaged area.

The model first establishes an energy equation for the image to be repaired, implements image repair by minimizing the image energy equation, and uses the characteristics of simultaneous diffusion to the gradient direction and the gradient’s orthogonal direction to fill the damaged area. The diffusion direction is generally controlled by the p value, the diffusion coefficients of the two directions are different, and the diffusion coefficient is controlled by the gradient.

4.2. P-Harmonic Model Wavelet Domain Image Restoration Algorithm

In this paper, curvature is introduced into the energy functional of the p-harmonic model, so that its diffusion coefficient is controlled by two variables, gradient and curvature. This change makes the diffusion intensity stronger at large curvatures and gradually weaker at small curvatures. Therefore, according to whether there is noise in the image to be repaired, two new repair models in the wavelet domain are proposed:

Here, K represents curvature, namely, is an increasing function of K.

4.3. Experimental Results and Analysis
4.3.1. Simulation of the Best Wavelet

The support length, attenuation characteristics, attenuation speed, symmetry, and regularity of different wavelets are different, so the reconstructed signal corresponding to different wavelet transforms will also show different characteristics. This paper selects different wavelet functions to simulate the cycle slip detection of the double-difference detection sequence and analyzes and summarizes the simulation results to select the best wavelet.

In this simulation, the double-difference carrier phase observation value is used as the cycle slip detection sequence, 800 observation epochs are selected, the sampling rate is 1s, and the cycle slip of 1 week is added at the 300th epoch. We performed cycle slip detection on the detection sequences using bior3.1, db2, and sym6, respectively. In order to make the comparison clearer, this paper enlarges the detection results to get Figure 1.

This paper chooses the best wavelet from the aspects of the attenuation speed of the wavelet function and the sensitivity to cycle slips. It can be clearly seen from Figure 1 that when different wavelets are selected, the effect of detecting cycle slips is different. Wavelets bior3.1, db2, and sym6 can all detect a cycle slip of 1 cycle, but the decay speed of bior3.1 is faster than that of db2 and sym6, and sym6 is too sensitive to the cycle slip. From the detection effect and considering stability, this article will choose bior3.1 as the best wavelet for wavelet transform method to detect cycle slips.

4.3.2. Simulation Analysis of the Wavelet Transform Method under Different Adoption Rates

The wavelet transform method can only detect the location of the cycle slip and cannot directly repair the cycle slip. This part uses the selected best wavelet bio3.1 to perform three-layer multiresolution decomposition on the cycle slip detection sequence and then uses the decomposed high-frequency coefficients to reconstruct the signal. By judging the modulus of the first-layer high-frequency signal, the position of the value point knows the epoch of the cycle slip. Under different sampling rates, we add cycle slips of -5 weeks, 1 week, 5 weeks, 10 weeks, 15 weeks, and 100 weeks to the data without cycle slip at the 40th, 50th, 70th, 90th, 110th, and 130th epochs. We perform a simulation of detecting cycle slips. At a sampling rate of 1 second, the first layer of reconstructed high-frequency signals after wavelet decomposition for data with and without cycle slips is shown in Figure 2.

It can be seen from Figure 2(a) that, at a sampling rate of 1 second, the maximum modulus of the wavelet-free detection sequence after wavelet transformation fluctuates within ±1 week, and the error fluctuation is small, which is helpful for wavelet detection of cycle slips by transformation method. In Figure 2(b), the maximum modulus value of the cycle slip detection sequence after wavelet transformation is more obvious than other modulus values, and the location of cycle slip can be clearly detected; that is, when the wavelet transformation method is at a sampling rate of 1 second, a cycle slip of 1 week can be detected, and the detection effect is very good. However, the maximum modulus value after wavelet transform does not represent the size of cycle slip.

4.3.3. Influence of Different Basis Wavelets on Restoration

Figure 3 shows the restoration effect of the damaged Lena image when the restoration algorithm uses Haar wavelet (support length is 1) and biorthogonal wavelet Bior4.4 (support length is 9), and the wavelet decomposition levels are 2 and 4, respectively. It can be seen from Figure 3 that the restoration effect of Haar wavelet is better than that of Bior4.4 wavelet, and the restoration effect of 2-level wavelet decomposition is better than that of 4-level decomposition. This is because when the data in the damaged area is set to zero during the repair process, an artificial boundary will be generated around the repair area. When the wavelet is decomposed, it will cause the artificial boundary to produce an extension effect, and the extension degree is related to the supporting length of the fundamental wavelet. The shorter the supporting length of the fundamental wavelet, the smaller the extension effect and the higher the accuracy of repairing the damaged area. Therefore, in order to minimize the artificial boundary extension effect, the shorter the supporting length of the fundamental wavelet, the better. In addition, when the image is decomposed by wavelet, the larger the wavelet decomposition level J, the more concentrated the energy of the low-frequency subimage. At this time, the low-frequency subimage repair error will have a greater impact on the quality of the reconstructed image and seriously affect the repair effect. Therefore, the decomposition level J is best to take 2-3 levels, which can provide subimages with a resolution of approximately 1/4 or 1/8 of the original image, which can basically meet the requirements of most restored images.

5. Evaluation of the Color Restoration Effect of Cultural Heritage Buildings

5.1. Color Restoration Corresponding to the Image Color Decay Curve

Most of the traditional restoration methods of mural color use analogy methods, but it is troublesome to restore a large number of murals with changeable styles, and the repair quality is low. For this situation, this paper gives a corresponding method of color restoration based on the decay curve of the color painting image to restore it. This paper uses the six colors of red, green, blue, black, white, and yellow detected in the Munsell color space of the HVC three components to simulate the color change of the mural over time and obtain a curve expression to restore the color of the mural value. The changes of the three color components with time in polar coordinates are shown in Figure 4.

The color of the color painting contains the functions of the three components (hue, saturation, and brightness) of the six colors of red, green, blue, black, white, and yellow over time. There is no big difference in the data functions obtained by other colors. Through analysis, it is found that the three components conform to the law of gradual decrease over a long period of time, which shows that some major factors have a relatively large impact on the degradation of color paintings during the first period of time. However, after a long period of time, its impact gradually diminished, and eventually the impact disappeared. Therefore, this article uses the function curve to predict the color change and then uses the reverse research method to restore the color faded mural.

5.2. Evaluation Method of Digital Image Restoration

The image quality evaluation method can evaluate the quality of the image restoration result, which can be defined by the degree of intelligibility and fidelity. If there is no original image that can be referenced, then a qualitative evaluation can also be made to distinguish the image quality with the naked eye. If there is an original image that can be referred to, then the evaluation of the image quality can be quantitatively evaluated by error analysis with the original image. The error of a good quality image is relatively small, its understanding and fidelity are higher, and the similarity is also higher.

The objective evaluation standard of the image is to evaluate the quality of the restored image by calculating the deviation of the restored image from the original image. Generally, the mean square error, peak signal-to-noise ratio, or structural similarity are used to evaluate the image quality. Suppose the image size is MN, I0 (i, j) is the original image, and I1 (i, j) is the restored image; then the objective evaluation of the quality of the restored image is as follows:

The higher the repair quality of the image, the smaller the value of the mean square error. The mean square error MSE is

The higher the peak signal-to-noise ratio PSNR, the better the image quality after restoration:

SSIM defines the structure of the digital mural image as

The correlation between two image block signals x and y is equivalent to the correlation between I (x) and I (y), and the structural contrast is defined as

We combine the above three similarity measures to get the SSIM value of image blocks x and y:

There are many evaluation criteria for the quality of image restoration. It is very unreasonable to judge by only the numerical error. When restoring the actual image, it is first necessary to ensure that the quality of the restoration can meet the visual requirements and requirements of the human eye. Ideal psychological recognition should also combine subjective evaluation and objective evaluation criteria to find the most suitable restoration effect image.

5.3. Analysis and Comparison of Experimental Results

This article uses Matlab as the platform to implement the relevant simulation experiments in this article. The feasibility of the algorithm is verified by the repair experiment on the same damaged image, and the effect diagram and experimental data of the improved algorithm and the related algorithm repair are compared to illustrate the efficiency of the algorithm in this paper. Because image restoration itself is a pathological problem, it is different from ordinary image restoration, and the information of the area to be repaired before the restoration is also unknown. It is basically impossible to restore the original image completely and truly, so there is no unique requirement for the result of the restoration.

If there is no very big difference between the image of the area to be repaired and the target image to be repaired, each index also meets the requirements, and the restored image distinguished by the human eye looks smooth and natural, then the repair result indicates that the requirements have been met. The task indicates that it has been completed. The evaluation method of damaged image restoration is still based on the comparison of visual observation and related data. The objective evaluation indicators that are more suitable for evaluating damaged image repair results are generally peak signal-to-noise ratio, structural similarity, and so on.

This paper selects images of cultural heritage buildings to carry out restoration experiments and compares the time spent in restoration of several algorithms in the three experiments, so as to judge and verify the feasibility of this algorithm. However, the original digital mural image is completely unknown, so the evaluation criteria are uncertain, and only the results of experiments can be used to analyze and compare. From the experimental results, it can be seen that the integrity of the image after the mural restoration processing by the method in this paper has been restored to a certain extent, and the color effect of the original mural has been achieved.

The virtual color restoration effects of different algorithms are shown in Figure 5. Among them, the picture (a) is the restoration effect of the Criminisi algorithm on the image of cultural heritage buildings, the picture (b) is the virtual color restoration effect of the deep learning algorithm, and the picture (c) is the effect of repairing the damaged area by the algorithm of this paper after preprocessing. It can be seen from the restoration effect diagram that the algorithm in this paper can restore the edge texture information more naturally and meets the required visual effect when observed with the human eye. The experiment execution time is shown in Figure 6. The comparison of the effect parameters is shown in Tables 1 and 2.

From the above experimental results, it can be seen that, compared with the Criminisi algorithm and the deep learning algorithm, the improved Criminisi algorithm proposed in this paper consumes relatively less time, and the visual effect of the repair also meets the evaluation requirements. This proves that when the improved algorithm in this paper is compared with other algorithms, the performance has been greatly improved, and the repair effect has been greatly improved.

6. Conclusion

The existing user interactive color migration algorithm requires the user to manually select sample blocks, which increases the experimental complexity of the algorithm. The user interactive color migration increases the accuracy of the color migration but greatly increases the execution time of the entire algorithm. User interaction to select sample blocks will undoubtedly have a significant impact on the accuracy of user operations, and subjective factors will also be the direct cause of the performance of the entire algorithm. The automatic color migration algorithm solves the interactive selection. The sample block is troublesome. However, if a clustering algorithm is used, it is still necessary to provide the clustering center point artificially, and the selection of the clustering center point will seriously affect the performance of the clustering algorithm, which will undoubtedly make the algorithm more complicated. The FCM algorithm is ideal for data objects that conform to the normal distribution, and this paper uses the normal distribution partition search method to provide the initial clustering center for the FCM algorithm, which makes the execution effect of the entire algorithm ideal. In addition, the automatic matching of sample blocks also effectively avoids the adverse effects caused by user interaction, making the corresponding effect of automatically matching sample blocks better and more natural and appropriate. The curvature induction term is introduced into the energy functional of the p-harmonic model, and a new model is proposed for image restoration; finally, the damaged image is repaired in the wavelet domain, aiming at the step of the wavelet domain total variation image restoration model. For the problem of effects, the curvature is also introduced into the energy functional of the p-harmonic model. According to whether there is noise in the image, two new wavelet domain image restoration models are proposed. According to the established model, we use relevant mathematical knowledge for numerical solution, give the discrete format of the repair model and specific algorithm steps, and get the repaired image. This article has repaired some murals that have been exposed to light, wind, and rain for a long time, and the color image information is difficult to distinguish. Because the existing image restoration algorithm based on sample texture synthesis uses a global search method to search for matching blocks, it will take a long time to repair, and it will lead to mismatches of matching blocks, which affects the restoration of the algorithm. Therefore, this article combines image segmentation and color decay curve methods on the basis of improvement. Through the combination of these algorithms, the effect of mural color restoration is more accurate, and the restoration process has also been greatly optimized. But for the gray part of the color image and the part where the color cannot be distinguished, the processing effect is not very good, which will require further research and improvement.

Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.