VIRTUAL RESTORATION OF STONE INSCRIPTIONS BASED ON IMAGE ENHANCEMENT AND EDGE DETECTION

: A method of virtual restoration of inscribed texts is proposed for blurred inscriptions. Firstly, the image enhancement method is used to enhance the image of the current topos, and the optimal method is selected to highlight the text information. Secondly, the extracted text outline is extracted from the enhanced image, and the extracted text outline is partially processed to obtain a smooth outline, and finally the fill function is used to fill the text outline to complete the virtual restoration of the inscribed text. The experimental results prove that the method can restore for blurred text and retain the original stele text writing style. The results of this experiment can provide a reference basis for the virtual restoration of other inscriptions on the central axis.


INTRODUCTION
Stone monument text is the main form of recording historical events, which is the first-hand information to prove history, make up history and correct literature, and carries a long history and culture (Jia, 2020).However, most of the stone monuments have various surface diseases due to their age and the influence of natural and human factors, resulting in blurred text on the surface of stone monuments, and some texts are also difficult to identify.Therefore, the digital preservation and virtual restoration of stone inscriptions have become a current research hotspot.The traditional restoration of inscriptions is done manually by professional craftsmen directly on the stone monuments, which is time-consuming and inefficient, and can cause secondary damage to the relics themselves if not done properly.Virtual restoration is the use of computer graphics, image processing and virtual information technology, combined with traditional methods of heritage conservation and restoration.It is based on a high-precision three-dimensional model in the computer to achieve the automated recovery of geometric forms and textures of cultural relics to achieve sustainable conservation of cultural relics, which can avoid secondary damage to cultural relics caused by improper restoration (Hou et al, 2018.), and the virtual restoration results can also provide a scientific basis and evaluation criteria for manual restoration (Ji, 2015).At present, virtual restoration of stone monuments is mainly divided into three types: Yin, Yang, and Ping.For the virtual restoration of flat texts, Suzhen Lin et al used a combination of HSV spatial image enhancement technology and color migration to effectively repair the blurred handwriting and restore the receding colors of the Houma alphabet.A virtual restoration method based on suprathreshold stochastic resonance of the Houma lexicon was proposed for the severely degraded handwriting, and the experimental results were more objective.The inscriptions on the "Zhengyang Bridge Drainage" stele belong to Yang script, and the virtual restoration using the above method cannot achieve satisfactory results.In addition, some * Corresponding author scholars have used deep learning algorithms to achieve virtual restoration of the text (Lin et al, 2016) (Lin et al, 2017).Su et al used convolutional neural networks to restore the shape of strokes and detail texture of ancient Chinese calligraphy and painting text, which truly restored the original appearance of the text and kept the original style of the text (Su et al, 2022) .Chen et al. designed a generative adversarial network with dual discrimination of its for damaged Yi ancient texts and achieved the recovery of missing strokes by two-stage training (Chen et al, 2022).assael et al. used a deep learning approach to recover the text of ancient Greek inscriptions for inscriptions damaged beyond recognition and inferred their geographical and chronological attribution.However, due to the current lack of data samples, it is not yet possible to experiment with deep learning methods (assael et al, 2022).KAVITHA et al. proposed a text segmentation method based on local binary patterns to achieve the task of extracting text and images from damaged historical stelae (KAVITHA et al, 2016).Zhao used a combination of image enhancement and edge detection for the text images of stone monuments to achieve the work of edge feature extraction for both Yin and Yang inscriptions (Zhao, 2010).Inspired by this idea.In this paper, we propose a virtual restoration method for stone inscriptions based on a combination of image enhancement and edge detection for the problem of blurred inscriptions, and conduct experiments with some texts in the topographic images of the current state of the "Zhengyang Bridge Drainage" stele.The image enhancement method is used to improve the image quality, and the edge detection is used to extract the text edge information and fill in to realize the virtual restoration of blurred text, which provides a reference for deciphering the text of stone monuments.

METHODS
The text virtual restoration method based on image enhancement and edge detection is mainly divided into three stages: image enhancement, edge operator detection, and contour filling, as shown in Figure 1.

Image Enhancement
Due to the age of the monument, the surface color has been completely lost.Without sufficient light source to fill in the light, the contrast of the monument text image captured under natural lighting is seriously insufficient, resulting in the overall dark color of the captured monument image, resulting in a large difference between the current monument image and the actual status quo, so the image contrast needs to be enhanced to highlight the text information in the monument image for the next step of research.In this study, we mainly use point-based image enhancement methods to enhance the contrast of images, among which grayscale transformation is one of the methods, mainly divided into four methods: linear transformation, segmented linear transformation, nonlinear transformation and image inversion.In order to better verify the optimal method for monolith images, experiments are conducted separately and synthesized for comparative analysis in this paper.Image enhancement is the most important step in image digitization processing, which aims to enhance the region of interest in the image, thus improving the contrast between the local and the overall image, suppressing the detail information of no interest, improving the quality of the image, and increasing the use value of the image (Gou et al, 2022) (Ji et al, 2021) (Zhu et al, 2017) (Wang et al, 2018).Its role is main ly as follows: (1) brightness adjustment by brightening the image or darkening it; (2) contrast enhancement or contrast reduction for local images; (3) contrast stretching by contrast enhancement and contrast reduction; (4) grayscale cutting.

Edge Detection
After the image enhancement of the stele image, the dark areas and the local details of the text are enhanced.According to the requirements of virtual restoration of the stele text, it is necessary to extract the text contour boundary using the edge detection operator to lay the foundation for text restoration.However, due to the influence of noise, image complexity and the defects of the algorithm itself, the extracted text edge contour information has the phenomenon of non-closure and non-connection, and the automatic restoration of interrupted points can be carried out by the edge connection method of local processing.The edge detection operator performs detection based on the characteristics of the grayscale mutation of the image edges (Zhang et al, 2018) (Zeng et al, 2020).The common edge detection operators can be divided into two categories, one based on first-order derivatives such as Roberts operator, Sobel operator and Prewitt operator, and one based on second-order derivatives such as Canny operator and Log operator.
(1) Roberts operator Roberts operator, also known as cross-differential algorithm, is the earliest operator used for edge detection and also the simplest one, which is a local difference operator to find the edge operator, using the approximate gradient magnitude of the difference between two adjacent pixels in the diagonal direction to monitor the edge, and its convolution operator is as follows: (2) Sobel operator The Sobel operator is a discrete differential operator for edge detection, which detects edges based on the gray weighted difference between the upper and lower, left and right neighbors of a pixel point, and reaches the extreme value at the edge.Its convolution operator is as follows: (3) Prewitt operator The Prewitt operator is a differential operator for image edge detection, which is a differential detection edge generated using the gray value of pixels in a specific region with the following convolution operator: (4) Canny operator The Canny operator is a standard algorithm for edge detection, which detects edges by finding the location in the image with the strongest grayscale variation, and its convolution operator is as follows: (5) Log operator Log operator (Laplace-Gaussian operator) is used to detect the edge by first using a Gaussian function for low-pass filtering, and then performing a Laplace operation, whose result is the location of the edge at zero.

Hole Fill
The edge detection method enables to obtain the edge contour of the text, in order to achieve the purpose of text restoration.Further fill within the text outline to restore the original appearance of the text.In this paper, the Imfill function is used to complete the contour filling.
Imfill is a binary image hole filling function that comes with the Matlab software for filling the image area.

Study Subjects
The "Zhengyang Bridge Drainage" monument is located in the northeast of the northeast of the intersection of Tianqiao, No. 78 Hongmiao Street, Chongwen District, Beijing, China.The four sides of the monument are inscribed with inscriptions, including a Manchu text on the east side of the monument corresponding to the Chinese text on its west side, and a Manchu text on the north side of the monument corresponding to the Chinese text on its south side.The inscription describes the project of managing the south river channel of Tianqiao (Longshugou) in the 56th year of the Qianlong era.It provides important cultural relics for the study of the development history from the perspectives of customs and people, political rituals, and river management techniques of the time, and has great historical value.However, due to the long-term exposure of the monument to the outdoors, there are obvious traces of weathering and erosion; localized serious splits and mutilations are missing, and its conservation and restoration are urgently needed.Therefore, a virtual restoration of the inscription was carried out to address the problem of text damage.The restoration area was selected as the specific study area for the southern part of the inscription.As shown in Figure 2.

Data acquisition and pre-processing
Data acquisition is the basis for virtual restoration work.
Currently, the techniques applied to 3D data acquisition of cultural relics include 3D laser scanning, close-up photogrammetry, raster scanning and CT technology.In this study, we mainly used close-up photogrammetry to acquire data for the Zhengyang Bridge Drainage Monument.
(1) Data acquisition The texture data were acquired with a Nikon D810 and Sony A7R4 high-resolution camera with 62 million pixels and 150 dpi resolution, and each monument was photographed in a circular fashion with a horizontal overlap of 80% and a vertical overlap of not less than 50%.A total of 1041 photos were collected.
(2) Data pre-processing During the texture data acquisition, each image has a certain color difference due to different shooting angles, and there are also blurred and overexposed photos.In order to obtain a highprecision 3D model, the blurred and overexposed photos are firstly deleted and supplemented with photos of the corresponding positions, and the texture data are secondly processed by uniform color grading.After processing, the photos were imported into ContextCapture Center Master software for modeling, and 3D models and orthomosaics were generated.

Image Enhancement Comparison
Figure 3 shows an image of the inscription to be restored for this experiment, which contains the characters "水", "南", "而", and "北 "four characters.It can be clearly seen that the strokes of the characters in the image are interrupted or even missing.In order to better complete the restoration of the inscription, it is necessary to use image enhancement to highlight the contrast between the text and the image as a whole, as shown in Figure 4.

Edge detection comparison
In this paper, five edge detection operators are used for contour extraction experiments, and the extracted results are shown in Figure 7.

Virtual Repair Results
By comparing the four image enhancement methods with the five edge detection operators, it is obtained that after the original image is linearly transformed image enhancement method to highlight the text information, then the canny edge detection operator can be used for text contour extraction to achieve better experimental results.In order to achieve the final text restoration, it is also necessary to further perform the edge connection process on the image after text contour extraction, as shown in Figure 8.After the processing the text contour is filled using the hole filling function to achieve the virtual text restoration.

Results Analysis
For the accuracy of the virtual restoration method of this paper, the virtual restoration results of this paper's algorithm were compared and verified by using the preserved manual topographic images as the benchmark, as shown in Figure 9.The virtual restoration of the four characters "水", "南", "而" and "北 " was achieved by the algorithm of this paper, and from the visual From the visual point of view, it can be seen that the interrupted part of the text is repaired and the edge of the text is highlighted to achieve the purpose of virtual text repair.The original writing style has been preserved and is similar to that of the real monument.However, due to the long-term exposure of the tablet to the outdoors, the current state of the tablet is completely different from the state of the earlier tablets, so it is difficult to fully restore the same effect as the text in the topography.At present, the algorithm has only carried out virtual restoration for fuzzy characters, and further research is needed for stelae texts with serious stroke defects, which is the focus of future research work.

CONCLUSION
The research results of this paper are mainly applied to the virtual restoration of stone inscriptions, which is of great significance for the inheritance and protection of inscriptions, and can also be used to obtain digital topography, which can break through the shortcomings of the original traditional topography that can cause secondary damage to inscriptions and better protect cultural relics.
In this paper, we propose a new method for restoring inscriptions based on image enhancement and edge detection.Firstly, four image enhancement methods are compared, and it is concluded that the linear transformation image enhancement method has a better effect on highlighting the contrast between text information and the overall image.Then, five edge detection operators are compared, and the canny edge extraction operator is selected to be more capable of extracting smooth and complete text outlines of the inscriptions.Next, the edges of the text are refined, and finally, the hole filling function is used to fill the text outline and realize the virtual restoration of the text.In this study, the effectiveness of the method is verified by taking part of the inscription of "Zhengyang Bridge Drainage" as the research object, and a more satisfactory restoration effect is achieved, which provides a reference for the text interpretation.
Figure 7(a) shows the results of edge extraction using canny operator, Figure 7(b) shows the results of edge extraction using Sobel operator, Figure 7(c) shows the results of edge extraction using Prewitt operator, Figure 7(d) shows the results of edge extraction using Roberts, and Figure 7(e) shows the results of edge extraction using Log operator.The text contours extracted by the five different edge extraction operators show that the canny edge detection operator detects thick and thin contours more uniformly, clearly and smoothly than the other edge extraction operators, and the extracted text contours are more in line with the experimental requirements.

Figure 7 .
Comparation of edge detection methods.