## 2 Calligraphy Dataset
### Character Box Algorithm
#### 2.1.1 Projection Algorithm  
The writing method of calligraphy differs from that of other works of art, as calligraphy works have a relatively monochromatic color and are mostly written vertically. By using these characteristics, the projection algorithm can effectively extract the character box from calligraphy works. Binary processing can effectively separate the foreground and background of the artwork. Then, individual calligraphy characters can be segmented from the artwork by accumulating the projection values of the foreground in the vertical and horizontal directions of the image. Using the feature of vertical writing in calligraphy, the foreground of the image is projected onto the horizontal X-axis of the picture, and the accumulated value function \(\sum X\) in the X-axis direction is obtained. Figure 1 shows that the projected accumulated value exhibits periodicity. This periodic feature of the function can be utilized for image segmentation. Assuming the image size is \(\mathrm{n}\times\mathrm{M}\), the image function \(f(x_{i},y_{i})\) is represented as Equation (1):  
\[f(x_{i},y_{i})=\left\{ \begin{array}{ll}1,\ frontground\\ 0,\ background\end{array} \right. \tag{1}\]  
The X-axis foreground projection cumulative value function \(\sum X\) is Equation (2):  
\[\sum X=\sum_{i=0}^{m}f(x,y_{i}), \tag{2}\]  
For function \(\sum X\), the coordinates of the zeros where the derivative is greater than 0 are recorded as \(U_{x_{i}}\), and the coordinates of the zeros where the derivative is less than 0 are recorded as \(W_{x_{i}}\). To prevent the radicals of the characters from being separated, a deviation value \(b_{x}\) is set. If \(U_{x_{i+1}}-W_{x_{i}}<b_{x}\), then \(U_{x_{i+1}}\) and \(W_{x_{i}}\) are not considered as segmentation coordinates. \(U_{x_{i}}\) and \(W_{x_{i}}\) are used as the starting and ending coordinates of the segmentation points in the image, as shown in Figure 1, resulting in Figure 1 after image segmentation. Figure 1: Projection algorithm. (**a**) Horizontal foreground projection, (**b**) vertical foreground projection, (**c**) minimum bounding box. Similarly, projecting the foreground values of the segmented image onto the Y-axis of the screen yields the cumulative foreground value function \(\sum Y\), as shown in Equation (3):  
\[\sum Y=\sum_{j=\hat{U}_{x_{j}}}^{W_{x_{j}}}f\left(x_{j},y\right), \tag{3}\]  
The coordinates of the zero points where all the derivatives of the function \(\sum Y\) are greater than 0 are recorded as \(U_{y_{j}}\), and the coordinates of the zero points where the derivatives are less than 0 are recorded as \(W_{y_{j}}\). Then, a deviation value is set. If \(U_{y_{j+1}}-W_{y_{j}}<b_{y}\), then \(U_{y_{j+1}}\) and \(W_{y_{j}}\) are not included as segmentation coordinates. \(U_{y_{j+1}}\) and \(W_{y_{j}}\) are used as the starting and ending coordinates of the segmentation points to segment the image, as depicted in Figure 1b. From Figure 1a,b, we obtain the minimum foreground value coordinate \(y_{min}=U_{y_{j}}\) in the Y-axis direction for each calligraphy character, as well as the maximum value \(y_{max}=W_{y_{j}}\) in the vertical direction. As depicted in Figure 1c, the minimum foreground value coordinate \(x_{min}\) and the maximum coordinate \(x_{max}\) in the X-axis direction of the graph are calculated to obtain the character box coordinates \((x_{min},y_{min})\) and \((x_{max},y_{max})\). Although the projection algorithm has a simple calculation principle, it efficiently divides the required calligraphy characters from the entire work, which is very suitable for splitting calligraphy works with vertical writing scenes. However, the projection algorithm also has limitations and cannot completely solve the problem of calligraphy character extraction. This is because many calligraphy works are not arranged neatly, and calligraphers often write casually, so it is common to have large character deformations and span variations.