Keywords

1 Introduction

In recent years, deformation transformation methods have been widely applied to the recognition, object matching, feature extraction, and image shape correction of Chinese characters [19]. Deformation transformation algorithms have been shown to be effective for correcting various position deformations and boosting the recognition rate of Chinese characters.

Over the past few decades, there have been numerous developments in the field of Chinese character recognition. In 1985, Leung [10] proposed a distortion model for handwritten Chinese characters to represent more variations in handwriting than existed in the original samples. Gao [6] proposed a pattern transformation method that employed a cosine function to correct various deformations, such as left-, right-, top-, and bottom-slanting positions. In 2002, Jin [11] developed a one-dimensional (1-D) deformable transformation method that can transform Chinese characters into 24 different styles. In 2009, Leung [12] applied the distortion model proposed in [3] to artificially generate a large number of virtual training samples from existing images, and eventually achieved a high recognition rate of 99.46 % on the ETL-9B database.

In this paper, based on the approach described in [11], we propose a novel 1-D deformable transformation that modifies the style of printed Chinese characters (PCC). We believe that, although there are various styles in each category of PCC, they have the same topological structure, and can therefore be considered a type of deformable object. Hence, we can choose some suitable deformation parameters to change the PCC. Furthermore, we also study the effects of different transformation intervals and deformation parameters.

2 Style Transformation Implementation

2.1 Theory of Transformation

Assume that a binary image is obtained by thresholding the gray scale of the original. The resulting binary image can be represented as:

(1)

where \( p_{i} = \left( {x_{i} ,y_{i} } \right) \) denote the coordinates of the \( i^{th} \) black pixel and n is the total number of black pixels. After the deformation transformation, the Chinese character can be rewritten as:

(2)
$$ {\mathcal{D}}\left( {p_{i} } \right) = \left( {x,y} \right) + (f_{x} \left( {x,y} \right),f_{y} \left( {x,y} \right)) $$
(3)

where \( {\mathcal{D}} \) is the displacement vector, and \( f_{x} \left( {x,y} \right) \), \( f_{y} \left( {x,y} \right) \) are mapping functions. In fact, the deformation transformation method essentially redistributes image pixels according to the mapping function. We can also use different mapping functions to realize the deformation. However, the deformation approach must retain the original topological structure and satisfy the specific boundary conditions. In this study, we employ a 1-D deformable transformation method to realize the style transformation. As we can transform the image in both the x and y directions, the 1-D transformation is defined by:

$$ \left\{ {\begin{array}{*{20}c} {D(x_{i} ) = x_{i} + f(x_{i} )} \\ {D(y_{i} ) = y_{i} + f(y_{i} )} \\ \end{array} } \right. $$
(4)

where \( f(x_{i} ) \), \( f(y_{i} ) \) are mapping functions. Generally, \( x \) and \( y \) are normalized to the interval [0, 1].

In this section, we use a nonlinear trigonometric function to realize the style transformation. Following the displacement function described in [11], we first set

$$ f(x) = x + \eta \cdot x\left[ {\sin (\pi \beta x + \alpha )\cos (\pi \beta x + \alpha ) + \gamma } \right] $$
(5)

where \( \alpha \), \( \beta \) are constants, and \( \eta \) is a deformation parameter. To avoid deforming the image boundary and retain a smooth image curve, the following boundary conditions must be satisfied:

$$ \pi \beta x + \alpha |_{x = 0} = a $$
(6)
$$ \pi \beta x + \alpha |_{x = 1} = {\text{b}} $$
(7)
$$ f\left( 0 \right) = 0, f\left( 1 \right) = 1 $$
(8)

From (6)–(8), we get

$$ \alpha = a $$
(9)
$$ \beta = \frac{b - a}{\pi } $$
(10)
$$ \gamma = - \sin b\cos b $$
(11)

Based on these results, we can rewrite the mapping function as:

$$ \begin{aligned} {\mathcal{D}}\left( {x_{i} } \right) & = x_{i} + \eta_{1} x_{i} \{ [\sin \left( {b_{1} - a_{1} } \right)x_{i} + a_{1} ] \\ & \quad \quad \;[\cos \left( {b_{1} - a_{1} } \right)x_{i} + a_{1} ] - \sin b_{1} \cos b_{1} \} \\ \end{aligned} $$
(12)
$$ \begin{aligned} {\mathcal{D}}\left( {y_{i} } \right) & = y_{i} + \eta_{2} y_{i} \{ [\sin \left( {b_{2} - a_{2} } \right)y_{i} + a_{2} ] \\ & \quad \quad \;[\cos \left( {b_{2} - a_{2} } \right)y_{i} + a_{2} ] - \sin b_{2} \cos b_{2} \} \\ \end{aligned} $$
(13)

where \( 0 \le a_{1} \le b_{1} \le 1 \), \( 0 \le a_{2} \le b_{2} \le 1 \), and \( \eta_{1} \), \( \eta_{2} \) denote the deformation parameters in the x and y directions, respectively.

2.2 Transformation Interval

To obtain different transformation effects, we select different intervals to be transformed. When [\( a_{1} \), \( b_{1} \)] and [\( a_{2} \), \( b_{2} \)] are set in different intervals, the mapping function has different properties.

To visualize the effects, we apply the 1-D deformable transformation method on a uniform grid matrix. Intuitively, the Chinese characters will slant in the direction of denser grid areas. Hence, these nonlinear characteristics contribute to the style transformation. Figure 1 plots some transformations.

Fig. 1.
figure 1

Deformation grid matrices.

Table 1 lists the parameters used in Fig. 1. Because we are using a 1-D deformation transformation method, the Chinese characters can be independently transformed in the x and y directions.

Table 1. Parameter selection

2.3 Deformation Parameter

From (5), it is apparent that the parameter \( \eta \) controls the degree of deformation for each style. We now examine the effects of using different deformation parameters. First, we fix the transformation intervals to [0, 0.5] and [0, 1], and then apply five different deformation parameters.

In Fig. 2, we see that there is a different curve for each of the five different deformation effects. According to (5), when η = 0, no deformation occurs, as represented by the blue curve. When η > 0, the deformation curve lies above the blue curve, and the character tends to slant toward the top of the image. The other two curves, and those in Fig. 3, can be analyzed in a similar way.

Fig. 2.
figure 2

Interval [a, b] = [0,0.5].

Fig. 3.
figure 3

Interval [a, b] = [0,1].

3 Experiments and Results

3.1 Dataset

In the experiments, we used a PCC databaseFootnote 1 to evaluate the style transformation algorithm. This database contains 6,825 character classes, with 280 font styles per class, such as Hua Kang, Fang Zheng, Han Yi, Wen Ding. PCCs have a larger number of standard fonts than handwritten characters (Fig. 4).

Fig. 4.
figure 4

Examples from the PCC database.

3.2 Experiments and Results

The experiments consisted of two stages. First, we attempted to prove that the deformation parameter significantly affected the style transformation. Second, we generated some examples of the PCCs after they had been transformed using the algorithm.

We have seen that different deformation parameters will result in different effects (see Figs. 2 and 3). In our experiments, we applied this parameter to a real PCC and observed the transformation effect.

Figure 5 shows the effect of changing the deformation parameter for three PCCs. In the first example, the deformation parameter was set to negative values. Thus, according to Figs. 2 and 3, the character should gradually expand on both sides in the y-direction as the absolute value of parameter increases. In the second example, the parameter takes positive values, and hence we can observe the opposite effect in the x-direction. The deformation parameter varies from negative to positive in the third example. We can clearly see that the style of the PCC changes gradually. All three examples demonstrate that we can change the font style by setting different values of the deformation parameter.

Fig. 5.
figure 5

Style deformation with different parameter values.

Various fonts were selected at random to test our style transformation algorithm. To obtain the maximum change in style of the PCCs, we used different deformation parameter values and set different deformation intervals. Some results are shown in Fig. 6.

Fig. 6.
figure 6

Font style deformation effect.

After applying our transformation algorithm, the style of the Chinese characters has changed considerably, but the characters remain reasonable. This demonstrates the effectiveness of our proposed algorithm.

4 Conclusions and Future Work

This paper has introduced a novel deformation transformation method for the modification of PCC style. This style transformation method is important because it will not only enrich Chinese character fonts, but also enlarge a given PCC database so as to represent more variations than the original. However, the proposed method has some limitations, such as the difficulty of selecting a suitable deformation parameter to transform the font. At present, the parameter is adjusted manually based on experience. We intend to develop a more effective approach to automate the search for a suitable parameter value. Furthermore, we are trying to find other mapping functions that produce useful style transformations.