# Stroke Extraction Algorithm of Clerical Script in Han Dynasty Based on Contour: Take “Stele of Cao Quan” as an Example

Authors: Liu Guoqing; Hao Changning; Yan Jingbo; Dong Jing; Zhao Zuolong; Hao Lujia
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Under natural conditions, the inscription will be damaged by corrosion and oxidation, which is very unfavorable for the inheritance of this cultural heritage. Therefore, how to protect and study ancient calligraphy inscriptions by modern scientific and technological methods is a scientific and technological problem before us. In this paper, taking “Stele of Cao Quan” as an example, a stroke extraction algorithm of clerical script in Han Dynasty based on contour is proposed. Starting from the Chinese character skeleton, the basic skeleton is extracted by parallel thinning algorithm, and the redundant points in the skeleton are eliminated by matching with the construction template. In addition, the contour tracking thinning algorithm is analyzed. Aiming at the problems that the starting point is difficult to determine and the tracking process is complicated, the method of determining the tracking starting point is given, and some problems existing in the tracking process are solved. The experimental results show that the accuracy of regular script, running script, and clerical script is 88.35%, 86.71%, and 84.09%, respectively. Experiments show that the contour-based clean script stroke extraction algorithm can correctly extract clean script strokes.


---

## Body

## 1. Introduction

Inscription refers to the words engraved on the vertical stone. Stone inscriptions left over from history are the precious wealth of the Chinese nation, and they are an ancient and rich artistic form. “Stele of Cao Quan” is an important tablet in the Eastern Han Dynasty of China. This tablet is a vertical square with a height of 272 cm and a width of 95 cm. With the appearance of this monument, clerical script has developed to a certain extent, and there has also been a new turning point in aesthetics. Because of its early excavation, large quantity, exquisite calligraphy, and modeling, it has become the most important object for later generations to learn about calligraphy of Han Dynasty and study clerical script for a long period of history. Chinese character recognition is a branch of pattern recognition. Through the unremitting efforts of scientific researchers, online handwritten recognition and offline printed recognition in Chinese character recognition have become increasingly mature, and many products with practical value have appeared. Therefore, the study of image acquisition and digital visualization and three-dimensional modeling of ancient inscriptions and stone carvings is conducive to our deeper understanding of traditional culture and inheritance of ancient culture, which is also the significance of this topic.In Chinese character recognition, there are two main categories: statistical features and structural features, according to the different features on which the recognition is based. Among them, thinning method is easy to cause false pen segment and shape distortion, and even if various correction methods are adopted, it is not satisfactory [1, 2]. Because the handwriting process of Chinese characters will be recorded and saved, the coordinate data of each pixel in time sequence will be obtained. This unified data are very convenient for comparison and further research. However, for discrete Chinese characters, it is necessary to get all the strokes of Chinese characters, which requires a lot of work. As a part of our Chinese traditional culture, calligraphy is not only a font and symbol but also represents the historical heritage of China for five thousand years [3]. It is necessary to use technical methods to extract strokes of Chinese characters in traditional calligraphy works in terms of time uniqueness and two-dimensional space uniqueness and then to reproduce the three dimensions, which is a concrete process that learners can intuitively observe writing. Therefore, stroke extraction plays a very important role in guiding traditional calligraphy teaching.Chinese calligraphy art has a long history and is profound, which is a precious historical treasure of our country. It embodies the culture of the Chinese nation for 5,000 years and is one of the most worthy of inheritance. It has a profound cultural connotation and is a treasure of the world art forest. It takes Chinese characters as the carrier, involves language, literature, history, aesthetics, and other aspects, and is connected with music and art. The “Stele of Cao Quan” rules are generally sparse and clear, and the characters are arranged neatly, horizontally and vertically, and orderly. Its word spacing is larger than line spacing, which is closely related to its stretching posture. The loose line spacing makes the works more ethereal, free and easy, elegant, and beautiful. This paper focuses on stroke extraction of Chinese characters and proposes a new algorithm integrating all levels of contour information. The extracted stroke outline has complete parameters and feature points and is easy to identify. Experiments show that the stroke extraction algorithm designed in this paper has a high accuracy and good stability, and it can correctly process oblique fonts without correction.


## 2. Related Work

### 2.1. Research on Chinese Character Stroke Extraction Method

In a large number of related studies of computer calligraphy, the recognition of clerical script is generally not based on the stroke features of clerical script, but on the contour pixel level of the word, which makes the feature extraction and recognition of clerical script have great limitations. Compared with hard pen characters, brush clerical script has greater changes in the thickness of strokes, the degree of adhesion, and the strength of pen movement. Many clerical scripts used in the past are no longer used in modern Chinese character writing.Tan et al. extracted calligraphy strokes on the basis of pixel points of strokes in clerical script skeleton, but did not describe the acquisition of strokes skeleton in detail [4]. Yang et al. put forward stroke extraction algorithm and contour restoration algorithm based on stroke contour features by analyzing the contour features of Chinese characters [5]. Bag and Harit constructed a brush model. They abstract the brush tip as an inverted cone, and regard the cross section between the virtual brush and the paper as the actual contact surface. The geometric model of this method is simple, and it has a certain effect on the simulation of strokes, but it does not take into account the deformation when the real brush touches the paper [6]. Ye et al. established a stroke relation graph according to the direction of the strokes connected by each bifurcation point and applied bidirectional connection rules to extract strokes [7].In order to solve the problem that skeleton distortion and spur phenomenon will have unnecessary influence on the extraction results in the skeleton-based stroke extraction method, some researchers change directions and abandon the idea of extracting strokes from skeleton. Chang et al. proposed a method of extracting boundary points from the outline of Chinese characters, screening out control points and inflection points from the set of boundary points according to certain rules, dividing the Chinese character shape image 3 into linear areas and nonlinear areas by using the corresponding feature points on the selected outline, and modeling the stroke features of the corresponding areas [8]. Liu et al. put forward a method of dividing strokes into overlapping areas and independent areas according to the turning point information of Chinese characters’ shapes and contours and then recombining the obtained areas to evaluate the combination results and finally obtaining complete basic composition strokes [9]. Yang et al. proposed a parallel thinning algorithm with high efficiency. Different from iterative thinning algorithm, noniterative thinning algorithm, such as contour tracking thinning algorithm, does not need to process all pixels, but only the pixels on the contour calculate the center point and obtain the skeleton by interpolation [10].


### 2.2. Research on Chinese Character Recognition

The imitation of human functions of machines has been proved to be a very challenging research field, involving the knowledge of artificial intelligence, pattern recognition, human-computer interaction, natural language processing, signal processing, and other fields. Word recognition technology can be divided into printed Chinese character recognition and handwritten Chinese character recognition, while handwritten Chinese character recognition can be divided into online Chinese character recognition and off-line Chinese character recognition [11, 12]. According to different processing methods, it is usually divided into off-line Chinese character recognition methods based on structural patterns, off-line Chinese character recognition methods based on neural networks, and off-line Chinese character recognition methods based on statistical patterns.Liu et al. incorporated the invariant features based on the tangent and curvature of strokes, then combined preprocessing and invariant feature extraction, and used point-oriented and stroke-oriented methods to recognize characters on small, medium, and large character sets, respectively [13]. Wong et al. have shown through experiments that the hidden Markov method is effective in recognizing conjoined characters. Because the character samples are too large, there are still great problems in efficiency and accuracy of the hidden Markov model recognition method with large character sets [14]. Siddiqi et al. put forward Bayesian network. Compared with the traditional classifier, Bayesian network has higher recognition efficiency. However, because each node has to maintain a conditional probability table, it needs many samples, and its analysis and calculation are complicated [15]. Sadeghi et al. described the stroke width, stroke curvature, stroke continuity, and other information of Chinese characters by using the contour features and gray features of Chinese characters images and segmented and extracted Chinese characters strokes according to these information [16].In online handwriting recognition, users input the images of characters one by one through touch screen, tablet, and other input devices. The system can judge and recognize the input characters according to the type and sequence of each stroke and the speed change of the pen. Ou et al. proposed an off-line handwritten Chinese character recognition method based on variable precision rough sugar set. Taking Chinese character samples and their corresponding feature vectors as an information system, a decision information system for off-line handwritten Chinese character recognition was constructed [17]. Zhang et al. proposed a clear script retrieval method based on clear script contour similarity. Using this method, 20 clear scripts were tested, and the precision rate was close to 90% at 90% recall [18]. Yao and Cheng proposed an interactive high-dimensional vector indexing method based on local distance graph, which mainly establishes the relationship between the concept of Chinese character semantic hierarchy and the underlying shape features through user feedback and improves the retrieval speed of massive clerical script databases [19].


## 2.1. Research on Chinese Character Stroke Extraction Method

In a large number of related studies of computer calligraphy, the recognition of clerical script is generally not based on the stroke features of clerical script, but on the contour pixel level of the word, which makes the feature extraction and recognition of clerical script have great limitations. Compared with hard pen characters, brush clerical script has greater changes in the thickness of strokes, the degree of adhesion, and the strength of pen movement. Many clerical scripts used in the past are no longer used in modern Chinese character writing.Tan et al. extracted calligraphy strokes on the basis of pixel points of strokes in clerical script skeleton, but did not describe the acquisition of strokes skeleton in detail [4]. Yang et al. put forward stroke extraction algorithm and contour restoration algorithm based on stroke contour features by analyzing the contour features of Chinese characters [5]. Bag and Harit constructed a brush model. They abstract the brush tip as an inverted cone, and regard the cross section between the virtual brush and the paper as the actual contact surface. The geometric model of this method is simple, and it has a certain effect on the simulation of strokes, but it does not take into account the deformation when the real brush touches the paper [6]. Ye et al. established a stroke relation graph according to the direction of the strokes connected by each bifurcation point and applied bidirectional connection rules to extract strokes [7].In order to solve the problem that skeleton distortion and spur phenomenon will have unnecessary influence on the extraction results in the skeleton-based stroke extraction method, some researchers change directions and abandon the idea of extracting strokes from skeleton. Chang et al. proposed a method of extracting boundary points from the outline of Chinese characters, screening out control points and inflection points from the set of boundary points according to certain rules, dividing the Chinese character shape image 3 into linear areas and nonlinear areas by using the corresponding feature points on the selected outline, and modeling the stroke features of the corresponding areas [8]. Liu et al. put forward a method of dividing strokes into overlapping areas and independent areas according to the turning point information of Chinese characters’ shapes and contours and then recombining the obtained areas to evaluate the combination results and finally obtaining complete basic composition strokes [9]. Yang et al. proposed a parallel thinning algorithm with high efficiency. Different from iterative thinning algorithm, noniterative thinning algorithm, such as contour tracking thinning algorithm, does not need to process all pixels, but only the pixels on the contour calculate the center point and obtain the skeleton by interpolation [10].


## 2.2. Research on Chinese Character Recognition

The imitation of human functions of machines has been proved to be a very challenging research field, involving the knowledge of artificial intelligence, pattern recognition, human-computer interaction, natural language processing, signal processing, and other fields. Word recognition technology can be divided into printed Chinese character recognition and handwritten Chinese character recognition, while handwritten Chinese character recognition can be divided into online Chinese character recognition and off-line Chinese character recognition [11, 12]. According to different processing methods, it is usually divided into off-line Chinese character recognition methods based on structural patterns, off-line Chinese character recognition methods based on neural networks, and off-line Chinese character recognition methods based on statistical patterns.Liu et al. incorporated the invariant features based on the tangent and curvature of strokes, then combined preprocessing and invariant feature extraction, and used point-oriented and stroke-oriented methods to recognize characters on small, medium, and large character sets, respectively [13]. Wong et al. have shown through experiments that the hidden Markov method is effective in recognizing conjoined characters. Because the character samples are too large, there are still great problems in efficiency and accuracy of the hidden Markov model recognition method with large character sets [14]. Siddiqi et al. put forward Bayesian network. Compared with the traditional classifier, Bayesian network has higher recognition efficiency. However, because each node has to maintain a conditional probability table, it needs many samples, and its analysis and calculation are complicated [15]. Sadeghi et al. described the stroke width, stroke curvature, stroke continuity, and other information of Chinese characters by using the contour features and gray features of Chinese characters images and segmented and extracted Chinese characters strokes according to these information [16].In online handwriting recognition, users input the images of characters one by one through touch screen, tablet, and other input devices. The system can judge and recognize the input characters according to the type and sequence of each stroke and the speed change of the pen. Ou et al. proposed an off-line handwritten Chinese character recognition method based on variable precision rough sugar set. Taking Chinese character samples and their corresponding feature vectors as an information system, a decision information system for off-line handwritten Chinese character recognition was constructed [17]. Zhang et al. proposed a clear script retrieval method based on clear script contour similarity. Using this method, 20 clear scripts were tested, and the precision rate was close to 90% at 90% recall [18]. Yao and Cheng proposed an interactive high-dimensional vector indexing method based on local distance graph, which mainly establishes the relationship between the concept of Chinese character semantic hierarchy and the underlying shape features through user feedback and improves the retrieval speed of massive clerical script databases [19].


## 3. Research Method

### 3.1. Inscription Image Preprocessing

When the original clerical script works are converted into digital images, the noises that will have unnecessary influence on the subsequent processing will be generated due to the influence of scanning equipment and the works themselves. Therefore, these noises need to be preprocessed at the beginning of the stroke extraction operation of the given clerical script images. According to the characteristics of clerical script, the preprocessing process needs to carry out image binarization, edge smoothing, hole filling, and other separate noise removal steps.The research sample of this paper is “Stele of Cao Quan” image obtained by high-definition shooting. According to the clarity of the inscription image, the inscription image can be briefly divided into two situations. In the first case, the imaging degree of the stone inscription image is relatively clear. For this type of inscription image, common methods such as image filtering and image segmentation can meet the requirements of inscription image processing [20]. In the second case, the image quality of stone inscriptions is poor, so it will be complicated and difficult to extract the character outline of the image.The “Stele of Cao Quan” images scanned from books or historical calligraphy works often contain many noises, including spots, scratches, and small holes in fonts caused by natural weathering or worn candle decay. The binarized single “Stele of Cao Quan” image is a binary color matrix with black characters on a white background. In this paper, first, “Stele of Cao Quan” image is converted into gray image, and then the obtained gray image of clerical script is binarized by iterative method. In this method, the best threshold is obtained by setting the new threshold to the midpoint of the average above and below the old threshold.The principle of iterative optimal threshold method is to assume a threshold before all the work starts and set the initial value of the threshold as the average of the maximum gray value and the minimum gray value in the image.(1)T0=gmax+gmin2,where T0 represents the initial threshold, gmax represents the maximum gray value of the image, and gmin represents the minimum gray value of the image.Then, according to the threshold value, the image is divided into two parts: foreground and background. The pixels whose gray value is greater than the threshold value are designated as foreground, and the pixels whose gray value is less than the threshold value are designated as background. The average values of foreground and background are calculated, respectively.(2)Ab=∑g=gmaxT0g×hg∑g=gminT0hg,where Ab represents the average gray value of the background and hg represents the number of each gray value g.Then, divide the number of pixels in each interval by the total number of pixels in the image, and the result is the proportion of pixels in each interval to the total number of pixels in the whole image. Calculated gray average of background and foreground. Iterate the thresholdT from 0 to 255 and calculate the interclass variance of the image background and foreground under each threshold. Figure 1 shows the “Stele of Cao Quan” image before and after binarization.Figure 1
“Stele of Cao Quan” image before and after binarization. (a) Before binarization. (b) After binarization.
(a)(b)If the noise in the image is not removed in time, it may be recognized by our algorithm as glyph area in the later calculation, which will affect the later matching work, so it is necessary to remove it in the preprocessing stage. The concrete principle is that after corrosion, the corresponding structure operator will remove the earlier part of the image, and the image at this time will be reduced by one circle compared with the previous image, so it is necessary to restore the image at this time by an expansion operation here.Mean filtering method and Gaussian filtering method. Block filtering refers to the convolution of pixels in a filter kernel with a value of 1 and a size ofw×h. If the convolved value is divided by w×h, it is consistent with the mean filtering. Gaussian filtering is the weighted average processing of the whole image by using the filtering kernel. Its core is that the weight of the filtering kernel conforms to the two-dimensional Gaussian filtering, namely:(3)G0x,y=12π⋅σ2⋅exp−x−x02−y−y022σ2.From the image observation and analysis, it can be concluded that the stroke width will affect the threshold-the wider the stroke, the larger the threshold; Therefore, a dynamic threshold method is used here, namely:(4)S=S0∗a+δ∗S1/S0100,S0 is the area of Chinese character circumscribed rectangular frame; a,δ is a constant related to the threshold, a=0.4,δ=0.1; and S1is the area of Chinese characters.The actual effect pairs are shown in Figure2 below:Figure 2
Contrast image before and after removing isolated noise. (a) Before denoising (b) After denoising.
(a)(b)Threshold segmentation of image is a common and mature image segmentation method. Its algorithm is simple in implementation, small in computation, and stable in performance, so threshold segmentation is a basic and widely used image segmentation technology. The obtained subset of each pixel’s gray value is a region corresponding to the image object, and the gray values of the pixels in this region are consistent, as are the neighboring regions. The division of the pixel gray value set can be carried out by using one or more image thresholds from the image gray level [15].When recognizing clerical script, it is necessary to compare the similarity between “Stele of Cao Quan” images. Different sizes of “Stele of Cao Quan” images cannot be directly compared, so it is necessary to normalize the “Stele of Cao Quan” images and scale them to the same size images. Nonlinear normalization is complicated in calculation and requires a lot of computation, but it can keep the density information of clerical script and will not change the stroke structure. Therefore, this paper adopts a nonlinear normalization method based on the number of strokes crossing, and all clerical script are normalized to 70 pixels.LetHx,Vy represent the density projection of the density function in both horizontal and vertical directions, and then there are(5)Hx=∑x=1M0dx,y,Vy=∑xy=1N0dx,y,M candidate recognition results are sorted according to the probability calculated by the above formula, and finally the label with the highest probability is output as the final recognition result.


### 3.2. Clerical Script Stroke Extraction

Clerical script has a long evolution process, and there are always obstacles in every process. When it captures the most remarkable features of life, it can vividly and profoundly reflect the phenomenon. Every time the evolution of clerical script permeates the integrity of life structure, the form of clerical script is richer than that of society, and its content is constantly derived. It is not easy to determine the logical relationship between the social conditions of the Eastern Han Dynasty and the form of clerical script, because the art of clerical script will inevitably change with the changes of society, and the inscriptions will also develop with the development of society.The characters in “Stele of Cao Quan” are not only an important carrier for people’s communication at that time but also an important form for recording historical documents. Clerical script is closely related to our life, which is not only the demand of daily life but also an artistic work. Each factor has a special meaning under specific conditions. Viewed from the overall background of the artistic experience of clerical script, these are just some abstract factors. No matter how important they are to the formation of Han Li’s aesthetic concept, they cannot produce artistic works alone. It can be said that the two peaks of clerical script appeared in the Han Dynasty (development) and the Qing Dynasty (revival). The excavation of “Stele of Cao Quan” played a transformational role in the evolution of clerical script and played a mainstay role in the transformation of calligraphy aesthetics in the Tang, Song, Yuan, and Ming Dynasties and the late Ming and early Qing Dynasties.“Stele of Cao Quan” became the main object of calligraphers in the late Ming Dynasty and early Qing Dynasty because of its beautiful style, fine print, and perfect readability. Its enlightenment and nourishment to the past calligraphy is obvious, which is the ancient value. For the enlightenment teaching of children’s calligraphy, it is also an important model of temporary learning. From it, it is helpful for calligraphy aesthetic education and enlightens students’ aesthetic thinking; taking it as the source, it is convenient for students to be familiar with the law of character development and enlighten the cognition of calligraphy history; taking it as a mirror, we know that the knowledge of writing and calligraphy skills should be combined, which is the value of today.This section is to extract the character outline of the preprocessed inscription image. The specific method is to propose a character backbone extraction method based on the stroke characteristics of Chinese characters according to the analysis of the character structure in the inscription image in the previous chapter, combined with the theory and method of mathematical morphology and wavelet transform, so as to obtain the character outline in the inscription image. Many contents in digital image processing, such as image segmentation, feature extraction, image filtering and other work, can be completed by these basic operators and their combinations [14].The feature point set in this study is obtained from the skeleton of Chinese character picture, and the skeleton extracted from Chinese character picture has connectivity. According to this feature, the feature point set in this study can be treated differently from the common point set mapping problem. On the basis of the above calculation method, according to the obtained point set mapping relationship, the corresponding relationship between the pixel set of clerical script single-character skeleton image and the template point set can be established. The process of stroke extraction method is shown in Figure3:Figure 3
Flow chart of adaptive cross-region extraction algorithm.The feature points in the extracted Chinese character skeleton are mapped and matched with the feature points in the template, and the corresponding mapping relationship is established. Traverse the point set in each stroke segment with established mapping relationship, calculate the stroke corresponding to the template point corresponding to each point in the stroke segment, and set it as the stroke corresponding to the extracted feature point in the skeleton. Wherein the stroke with the most feature points is set as the stroke to which the stroke segment belongs.The method proposed in this paper can determine the shape and size of the intersection area according to the shape and thickness of strokes, and the extraction effect is good. In order to adapt to different fonts of Chinese characters and different strokes of the same font, an adaptive algorithm for extracting the intersection area of Chinese characters strokes is proposed. This method does not need to manually set the segmentation radius and can find out the concave point and obtain the intersection area according to the distance from the intersection point to the outline, which can be suitable for Chinese characters of different fonts. At the same time, it shows that this method has a good performance in segmentation accuracy and efficiency.In order to conveniently determine the position of each region and its corresponding node in the undirected graph in the stroke combination process, a coordinate system is established for the whole character, and the point in the lower left corner of the image is taken as the coordinate origin. Take the center of gravity of each region to represent the region and its corresponding node in the undirected graph [20]. The formula of center of gravity Aixi,yi is as follows:(6)xi=∑j=1nxjn,yi=∑j=1nyjn,where n is the number of pixels in the area and xj,yj is the x,y-axis coordinate of each point in the area.For similar “Stele of Cao Quan” images retrieved, the firstN images are selected as candidate “Stele of Cao Quan” images in descending order. These “Stele of Cao Quan” images may have different semantic annotations. This paper gives weight according to its ranking and similarity.The input image of Stele of Cao Quan to be recognized isA,N candidate clerical script: B1,B2,…,BN, and the weight wii=1,2,…,N is defined as follows:(7)wi=λi2+SimilarityA,Bi,λ is an empirical parameter, which indicates the importance of the serial number in the search results in the weight.Image processing based on wavelet transform is to adjust the approximate component and detail component coefficients generated in the process of image decomposition, so that the reconstructed image can meet specific conditions, thus realizing image processing. Wavelet transform has two remarkable characteristics: the first one is “small,” which means that it has compact support set or approximate set in time domain; the second feature is characterized by “volatility” in the alternation of positive and negative.a,b is discretized so that a=2−j,b=2−jk;j,k∈Z. The form of discrete wavelet transform can be obtained:(8)DWψfj,k=ft,ψj,kt.According to the research sample in this paper, on the basis of the existing trunk extraction algorithm, combined with the analysis of the text structure in the inscription image in the previous article, the original algorithm is improved, and a contour extraction method based on the stroke features of Chinese characters is proposed. According to the wavelet transform of the inscription image and its edge detection method, the edge features of the characters in the inscription image correspond to the local extremum points of the transformed wavelet coefficients, which can accurately describe the edge contour and structural features of Chinese characters in the inscription image.For Chinese character writing, one structure is usually written before the next one is written. Therefore, the structures are preliminarily divided here, and the writing order between structures is determined according to the distanceli between OixOi,yOi and the origin of coordinate axis, namely:(9)li=xOi2+yOi2.Ifla<lb is used, the writing priority of structural component Sais higher than that of Sb.The writing sequence of structural components is determined by the distance between the center of the connected domain and the origin of coordinates, but there are different strokes in each structural component, that is, there may be multiple strokes in a structural component, so it is necessary to arrange the writing sequence of the strokes in each structural component in running script.Because of the complex structure of Chinese characters’ strokes, there is no certain rule to follow whether the horizontal and vertical strokes intersect, and the skeleton obtained by thinning algorithm has a certain degree of deformation, so there may be multiple intersections in the same intersection area, which will inevitably increase the workload, and the matching will fail because of the different number of intersections in the matching stage, which will inevitably affect the accuracy of stroke extraction.In this paper, the intersection numberNcP of each pixel is calculated for the skeleton map corresponding to each stroke structure:(10)NcP=16∑xi+1−xi.In whichxii=1,2,…,9 is the adjacent point of pixel p.For the stroke structure without intersection, we directly output strokes without stroke extraction. Ifp is not empty, it means that the stroke structure contains at least two strokes. Therefore, we need to perform stroke extraction operations such as intersection extraction, intersection area extraction, and stroke segment combination for the stroke structure with p not empty.


## 3.1. Inscription Image Preprocessing

When the original clerical script works are converted into digital images, the noises that will have unnecessary influence on the subsequent processing will be generated due to the influence of scanning equipment and the works themselves. Therefore, these noises need to be preprocessed at the beginning of the stroke extraction operation of the given clerical script images. According to the characteristics of clerical script, the preprocessing process needs to carry out image binarization, edge smoothing, hole filling, and other separate noise removal steps.The research sample of this paper is “Stele of Cao Quan” image obtained by high-definition shooting. According to the clarity of the inscription image, the inscription image can be briefly divided into two situations. In the first case, the imaging degree of the stone inscription image is relatively clear. For this type of inscription image, common methods such as image filtering and image segmentation can meet the requirements of inscription image processing [20]. In the second case, the image quality of stone inscriptions is poor, so it will be complicated and difficult to extract the character outline of the image.The “Stele of Cao Quan” images scanned from books or historical calligraphy works often contain many noises, including spots, scratches, and small holes in fonts caused by natural weathering or worn candle decay. The binarized single “Stele of Cao Quan” image is a binary color matrix with black characters on a white background. In this paper, first, “Stele of Cao Quan” image is converted into gray image, and then the obtained gray image of clerical script is binarized by iterative method. In this method, the best threshold is obtained by setting the new threshold to the midpoint of the average above and below the old threshold.The principle of iterative optimal threshold method is to assume a threshold before all the work starts and set the initial value of the threshold as the average of the maximum gray value and the minimum gray value in the image.(1)T0=gmax+gmin2,where T0 represents the initial threshold, gmax represents the maximum gray value of the image, and gmin represents the minimum gray value of the image.Then, according to the threshold value, the image is divided into two parts: foreground and background. The pixels whose gray value is greater than the threshold value are designated as foreground, and the pixels whose gray value is less than the threshold value are designated as background. The average values of foreground and background are calculated, respectively.(2)Ab=∑g=gmaxT0g×hg∑g=gminT0hg,where Ab represents the average gray value of the background and hg represents the number of each gray value g.Then, divide the number of pixels in each interval by the total number of pixels in the image, and the result is the proportion of pixels in each interval to the total number of pixels in the whole image. Calculated gray average of background and foreground. Iterate the thresholdT from 0 to 255 and calculate the interclass variance of the image background and foreground under each threshold. Figure 1 shows the “Stele of Cao Quan” image before and after binarization.Figure 1
“Stele of Cao Quan” image before and after binarization. (a) Before binarization. (b) After binarization.
(a)(b)If the noise in the image is not removed in time, it may be recognized by our algorithm as glyph area in the later calculation, which will affect the later matching work, so it is necessary to remove it in the preprocessing stage. The concrete principle is that after corrosion, the corresponding structure operator will remove the earlier part of the image, and the image at this time will be reduced by one circle compared with the previous image, so it is necessary to restore the image at this time by an expansion operation here.Mean filtering method and Gaussian filtering method. Block filtering refers to the convolution of pixels in a filter kernel with a value of 1 and a size ofw×h. If the convolved value is divided by w×h, it is consistent with the mean filtering. Gaussian filtering is the weighted average processing of the whole image by using the filtering kernel. Its core is that the weight of the filtering kernel conforms to the two-dimensional Gaussian filtering, namely:(3)G0x,y=12π⋅σ2⋅exp−x−x02−y−y022σ2.From the image observation and analysis, it can be concluded that the stroke width will affect the threshold-the wider the stroke, the larger the threshold; Therefore, a dynamic threshold method is used here, namely:(4)S=S0∗a+δ∗S1/S0100,S0 is the area of Chinese character circumscribed rectangular frame; a,δ is a constant related to the threshold, a=0.4,δ=0.1; and S1is the area of Chinese characters.The actual effect pairs are shown in Figure2 below:Figure 2
Contrast image before and after removing isolated noise. (a) Before denoising (b) After denoising.
(a)(b)Threshold segmentation of image is a common and mature image segmentation method. Its algorithm is simple in implementation, small in computation, and stable in performance, so threshold segmentation is a basic and widely used image segmentation technology. The obtained subset of each pixel’s gray value is a region corresponding to the image object, and the gray values of the pixels in this region are consistent, as are the neighboring regions. The division of the pixel gray value set can be carried out by using one or more image thresholds from the image gray level [15].When recognizing clerical script, it is necessary to compare the similarity between “Stele of Cao Quan” images. Different sizes of “Stele of Cao Quan” images cannot be directly compared, so it is necessary to normalize the “Stele of Cao Quan” images and scale them to the same size images. Nonlinear normalization is complicated in calculation and requires a lot of computation, but it can keep the density information of clerical script and will not change the stroke structure. Therefore, this paper adopts a nonlinear normalization method based on the number of strokes crossing, and all clerical script are normalized to 70 pixels.LetHx,Vy represent the density projection of the density function in both horizontal and vertical directions, and then there are(5)Hx=∑x=1M0dx,y,Vy=∑xy=1N0dx,y,M candidate recognition results are sorted according to the probability calculated by the above formula, and finally the label with the highest probability is output as the final recognition result.


## 3.2. Clerical Script Stroke Extraction

Clerical script has a long evolution process, and there are always obstacles in every process. When it captures the most remarkable features of life, it can vividly and profoundly reflect the phenomenon. Every time the evolution of clerical script permeates the integrity of life structure, the form of clerical script is richer than that of society, and its content is constantly derived. It is not easy to determine the logical relationship between the social conditions of the Eastern Han Dynasty and the form of clerical script, because the art of clerical script will inevitably change with the changes of society, and the inscriptions will also develop with the development of society.The characters in “Stele of Cao Quan” are not only an important carrier for people’s communication at that time but also an important form for recording historical documents. Clerical script is closely related to our life, which is not only the demand of daily life but also an artistic work. Each factor has a special meaning under specific conditions. Viewed from the overall background of the artistic experience of clerical script, these are just some abstract factors. No matter how important they are to the formation of Han Li’s aesthetic concept, they cannot produce artistic works alone. It can be said that the two peaks of clerical script appeared in the Han Dynasty (development) and the Qing Dynasty (revival). The excavation of “Stele of Cao Quan” played a transformational role in the evolution of clerical script and played a mainstay role in the transformation of calligraphy aesthetics in the Tang, Song, Yuan, and Ming Dynasties and the late Ming and early Qing Dynasties.“Stele of Cao Quan” became the main object of calligraphers in the late Ming Dynasty and early Qing Dynasty because of its beautiful style, fine print, and perfect readability. Its enlightenment and nourishment to the past calligraphy is obvious, which is the ancient value. For the enlightenment teaching of children’s calligraphy, it is also an important model of temporary learning. From it, it is helpful for calligraphy aesthetic education and enlightens students’ aesthetic thinking; taking it as the source, it is convenient for students to be familiar with the law of character development and enlighten the cognition of calligraphy history; taking it as a mirror, we know that the knowledge of writing and calligraphy skills should be combined, which is the value of today.This section is to extract the character outline of the preprocessed inscription image. The specific method is to propose a character backbone extraction method based on the stroke characteristics of Chinese characters according to the analysis of the character structure in the inscription image in the previous chapter, combined with the theory and method of mathematical morphology and wavelet transform, so as to obtain the character outline in the inscription image. Many contents in digital image processing, such as image segmentation, feature extraction, image filtering and other work, can be completed by these basic operators and their combinations [14].The feature point set in this study is obtained from the skeleton of Chinese character picture, and the skeleton extracted from Chinese character picture has connectivity. According to this feature, the feature point set in this study can be treated differently from the common point set mapping problem. On the basis of the above calculation method, according to the obtained point set mapping relationship, the corresponding relationship between the pixel set of clerical script single-character skeleton image and the template point set can be established. The process of stroke extraction method is shown in Figure3:Figure 3
Flow chart of adaptive cross-region extraction algorithm.The feature points in the extracted Chinese character skeleton are mapped and matched with the feature points in the template, and the corresponding mapping relationship is established. Traverse the point set in each stroke segment with established mapping relationship, calculate the stroke corresponding to the template point corresponding to each point in the stroke segment, and set it as the stroke corresponding to the extracted feature point in the skeleton. Wherein the stroke with the most feature points is set as the stroke to which the stroke segment belongs.The method proposed in this paper can determine the shape and size of the intersection area according to the shape and thickness of strokes, and the extraction effect is good. In order to adapt to different fonts of Chinese characters and different strokes of the same font, an adaptive algorithm for extracting the intersection area of Chinese characters strokes is proposed. This method does not need to manually set the segmentation radius and can find out the concave point and obtain the intersection area according to the distance from the intersection point to the outline, which can be suitable for Chinese characters of different fonts. At the same time, it shows that this method has a good performance in segmentation accuracy and efficiency.In order to conveniently determine the position of each region and its corresponding node in the undirected graph in the stroke combination process, a coordinate system is established for the whole character, and the point in the lower left corner of the image is taken as the coordinate origin. Take the center of gravity of each region to represent the region and its corresponding node in the undirected graph [20]. The formula of center of gravity Aixi,yi is as follows:(6)xi=∑j=1nxjn,yi=∑j=1nyjn,where n is the number of pixels in the area and xj,yj is the x,y-axis coordinate of each point in the area.For similar “Stele of Cao Quan” images retrieved, the firstN images are selected as candidate “Stele of Cao Quan” images in descending order. These “Stele of Cao Quan” images may have different semantic annotations. This paper gives weight according to its ranking and similarity.The input image of Stele of Cao Quan to be recognized isA,N candidate clerical script: B1,B2,…,BN, and the weight wii=1,2,…,N is defined as follows:(7)wi=λi2+SimilarityA,Bi,λ is an empirical parameter, which indicates the importance of the serial number in the search results in the weight.Image processing based on wavelet transform is to adjust the approximate component and detail component coefficients generated in the process of image decomposition, so that the reconstructed image can meet specific conditions, thus realizing image processing. Wavelet transform has two remarkable characteristics: the first one is “small,” which means that it has compact support set or approximate set in time domain; the second feature is characterized by “volatility” in the alternation of positive and negative.a,b is discretized so that a=2−j,b=2−jk;j,k∈Z. The form of discrete wavelet transform can be obtained:(8)DWψfj,k=ft,ψj,kt.According to the research sample in this paper, on the basis of the existing trunk extraction algorithm, combined with the analysis of the text structure in the inscription image in the previous article, the original algorithm is improved, and a contour extraction method based on the stroke features of Chinese characters is proposed. According to the wavelet transform of the inscription image and its edge detection method, the edge features of the characters in the inscription image correspond to the local extremum points of the transformed wavelet coefficients, which can accurately describe the edge contour and structural features of Chinese characters in the inscription image.For Chinese character writing, one structure is usually written before the next one is written. Therefore, the structures are preliminarily divided here, and the writing order between structures is determined according to the distanceli between OixOi,yOi and the origin of coordinate axis, namely:(9)li=xOi2+yOi2.Ifla<lb is used, the writing priority of structural component Sais higher than that of Sb.The writing sequence of structural components is determined by the distance between the center of the connected domain and the origin of coordinates, but there are different strokes in each structural component, that is, there may be multiple strokes in a structural component, so it is necessary to arrange the writing sequence of the strokes in each structural component in running script.Because of the complex structure of Chinese characters’ strokes, there is no certain rule to follow whether the horizontal and vertical strokes intersect, and the skeleton obtained by thinning algorithm has a certain degree of deformation, so there may be multiple intersections in the same intersection area, which will inevitably increase the workload, and the matching will fail because of the different number of intersections in the matching stage, which will inevitably affect the accuracy of stroke extraction.In this paper, the intersection numberNcP of each pixel is calculated for the skeleton map corresponding to each stroke structure:(10)NcP=16∑xi+1−xi.In whichxii=1,2,…,9 is the adjacent point of pixel p.For the stroke structure without intersection, we directly output strokes without stroke extraction. Ifp is not empty, it means that the stroke structure contains at least two strokes. Therefore, we need to perform stroke extraction operations such as intersection extraction, intersection area extraction, and stroke segment combination for the stroke structure with p not empty.


## 4. Result Analysis

Fifty single-character images were randomly selected from Stele of Cao Quan, and then continuous single-character contours were manually marked in these single-character images. Finally, a total of 150 partial word contours were obtained. Each local word contour line is fitted by parabola, and the mean square distance between the parabola and the corresponding point on the marked word contour line is calculated to obtain the parabola fitting error of the local word contour line. The final fitting error is normalized by using the distance between words in the corresponding picture. Figure4 shows the parabola fitting error of a single word image.Figure 4
Parabolic fitting error of single word image.It can be observed that the parabola fitting error of more than 72% of the local word contours is below 0.024 word-to-word distance. About 91% of the parabola fitting errors of local word contours are within the range of 0.06 word-to-word distance. This shows that these local word contours can be well fitted by parabola and also shows that the local word contours have parabolic characteristics.In this paper, continuous high-quality clerical script contour lines are extracted from sparse key points. Therefore, in this section, the method in this paper will be compared with the existing stroke alignment methods. In addition, the outline of the stroke is found by other methods in this paper, and this section will also compare it with the existing edge contour extraction methods. This section runs the executable program on the test picture.In this section, DME (dense mean error) and SME (sparse mean error) are used to express errors. The results are shown in Figures5 and 6:Figure 5
DME error distribution.Figure 6
SME error distribution.The cumulative error distribution diagram in the above figure shows the advantages of this method. This figure shows the proportion of the contour lines or key points of clerical script extracted within a certain allowable DME or SME error range. It can be seen that this method outperforms the other three methods, which shows the good performance of this clerical script extraction method. This clerical script contour extraction method is more accurate than the other three methods.Table1 compares the accuracy of stroke extraction on three different font data sets with the method in this paper. In this paper, the stroke combination stage adopts two arbitrary stroke segments in two combination, and then the correct combination mode is selected and the strokes are extracted by the statistical data of distance from point to edge and distance from edge to edge.Table 1
Comparison of accuracy.
MethodRegular script (%)Running script (%)Clerical script (%)Ref [10]81.2575.1482.25Ref [12]86.0170.1277.14Ref [14]84.1166.3881.27Our88.3586.7184.09Comparatively speaking, the stroke extraction scheme of clerical script proposed in this paper achieves the accuracy rates of 88.35%, 86.71%, and 84.09%, respectively, on three different fonts: regular script, running script, and clerical script. In most cases, the angle-based combination of stroke segments can find the optimal combination, which proves that the correct intersection set in the standard reference data set and the correct combination of stroke structure can improve the accuracy of stroke extraction. The system proposed in this paper achieves the goal of stroke extraction, basically all strokes are completely extracted, most strokes are smooth, and only a few strokes have redundant strokes near the intersection area.The model of writing depth and pen width information is established by the method of experimental test and data analysis. To verify the explanatory degree of the model to each data, the variance of each group of data based on the model is calculated, as shown in Figure7.Figure 7
Fitting linear variance diagram.It is found that after the depthd=6, the variance increases significantly, which is related to the brush structure. The main writing part of the brush is at the tip, which is called an inverted triangle shape, while the middle part tends to be full gradually, which is the main ink storage area. This shows that the correct writing depth of this brush should be within 6 mm. In the later writing experiment, this threshold should not be exceeded.Because the stroke details and some stroke information of clerical script are abandoned, the final effect cannot keep the original state of clerical script, which leads to the abandonment of stroke information and the relatively low stroke extraction rate. This paper mainly compares the experimental results with the stroke extraction method. The results are shown in Table2.Table 2
Experimental result.
MethodNumber of strokesExtract the correct numberAccuracy (%)Ref [10]108073968.43Ref [12]108081475.37Ref [14]108088682.04Our108097690.37The results show that the recognition sum of ref [10] method is lower than 90.37% in this paper. It can be seen that the stroke extraction algorithm based on BP neural network is slightly superior in recognition rate.The refinement of Chinese characters is very important. Because in binary dot matrix images, the feature information of Chinese characters that is valuable for recognition is mainly concentrated on the skeleton of Chinese characters, and the refined skeleton of Chinese characters can retain most of the features of the original Chinese characters, which is conducive to feature extraction. These thinning algorithms have achieved good results when dealing with western characters. Because there is a big difference between the glyphs of Chinese characters and those of western characters, when these traditional thinning algorithms are applied to Chinese characters thinning, they often cause new distortion, increase the interference and difficulty of recognition, and the algorithm itself is time-consuming. This is because any local association cannot fully express the global association, so the thinning algorithm based on template cannot completely avoid burrs and whiskers in the thinning results.From the statistical data of the above experimental results, it can be found that the skeleton stroke extraction method of clerical script proposed in this paper has certain stability when extracting skeleton strokes of clerical script, and shows strong robustness when the program runs without crash or downtime. When the noise is large, it will have a serious impact on the denoising process in the initial stage of processing, so that all the noise cannot be perfectly removed, thus causing interference to the later processing, thus making the extraction work fail.Fuzzy region detection is used to determine the intersection of strokes. Through comparative analysis, the detection method based on dynamic window scaling is not as effective as that based on thinned intersection. After the corresponding area of the root node is found, each starting point and end point of the known stroke clerical script can find the unique corresponding area in the self-writing character. Traversing the tree topology diagram of the known stroke clerical script, using the end point number of each stroke path of the known stroke clerical script to represent the stroke, and corresponding the path to the self-writing character, the stroke in the self-writing character is extracted.


## 5. Conclusion

The computer simulation research of tablet inscription clerical script is one of the most challenging topics of computer application technology, and it is of immeasurable value to the protection, development, and application of Chinese calligraphy. “Stele of Cao Quan” became the main object of calligraphers in the late Ming Dynasty and early Qing Dynasty because of its beautiful style, fine print, and perfect readability. Its enlightenment and nourishment to the past calligraphy is obvious, which is the ancient value. Starting from the basic composition of clerical script, we classify and extract the stroke information of clerical script, which is a key step in the research field of computer calligraphy. In this paper, a contour extraction method based on stroke features of Chinese characters is proposed, which can determine the shape and size of the intersection area according to the shape and thickness of strokes, and the extraction effect is good and can be applied to Chinese characters with different fonts. At the same time, it shows that this method has a good performance in segmentation accuracy and efficiency. In this paper, the stroke extraction scheme of clerical script proposed in this paper achieves the accuracy rates of 88.35%, 86.71%, and 84.09%, respectively, on three different fonts: regular script, running script, and clerical script. It is proved that the correct intersection set in the standard reference data set and the correct combination of stroke structures can improve the accuracy of stroke extraction.



---

*Source: 5066994-2022-09-05.xml*