Keywords

1 Introduction

The spatial topology distance method (STD) [9, 10] used the self-organizing algorithm (SOM) [4] to evolve the template toward its target, unknown handwritten character. This evolution can preserve the topological structure of the template and resolve serious distortions in the character. The computation cost of the evolution is high. To reduce the number of iterations in the evolution, geometrical constraints among features are manually constructed to reduce the searching operation in STD. These constraints can be converted into a set of rules [6, 7], Fig. 1, and saved in a Hopfield network [7, 11]. The number of such rules is countless. It is tedious to list the enormous number of rules manually. The compatibility of the connection rules for a whole template can be loaded in the Hopfield network [7, 11]. It can be obtained from the converged network [12, 13]. So far, there is no efficient procedure for the construction of such rules. This work devises an alternative way to skip those rules in the recognition. The same features used to represent the character and the template [11] will be used in this work. We briefly review the feature and related works in this section.

Fig. 1.
figure 1

Geometrical rules for the five features of character “A”.

The unknown character and all its templates are prepared in advance by their feature collections that resemble the receptive fields [1,2,3] of visual system. All collections are loaded with flexible and variable features along their skeletons. The global operations, shift, rotation, and scaling, are applied to deform the template according to certain highly matched, locked, features. After these operations, the locked features in the deformed template will align with their corresponding features in the unknown character perfectly. The improved whole similarity score can be obtained for all features of the deformed template. This kind deforming and locking process can be operated iteratively. The recognition is accomplished for the template which received the highest whole score.

The templates and unknown character are both represented by collections of bended-ellipse features [10, 11], Fig. 2. Each bended-ellipse feature is represented by a vector which includes its coordinates, direction, angle, and arm length size. To save space, we skip the length portion in this work. This kind feature representation is much stable than the rigid skeleton representation. Each template outline is used to normalize the unknown by properly shifting, rotating, and scaling the unknown. The outline can be accomplished by thickening the template strokes.

Fig. 2.
figure 2

The feature vector for the top portion of A.

Note the CNN [5] can extract local features in its front end layer as elements for constructions in its successive layers. High level correlations of such elements are picked in its deep layers. Recognition of unknown character can be accomplished from such correlations. Various distortions will increase its correlation complexity.

Representation by Bended-Ellipse Features

Suppose there are \( J \) templates \( \left\{ {{\mathbf{T}}^{1} ,{\mathbf{T}}^{2} , \ldots ,{\mathbf{T}}^{J} } \right\} \). Each template is represented by a collection of its all features. For each template \( {\mathbf{T}}^{j} \) we will generate \( L^{j} \) bended-ellipse features. Write \( {\mathbf{T}}^{j} = \left\{ {{\mathbf{t}}_{l}^{j} |1 \le l \le L^{j} } \right\} \) where \( {\mathbf{t}}_{l}^{j} \) is the \( l^{\text{th}} \) feature vector of the \( j^{\text{th}} \) template. Let \( {\mathbf{t}}_{l}^{j} = \left[ {x_{l}^{j} ,y_{l}^{j} ,\phi_{l}^{j} ,i_{l}^{j} ,j_{l}^{j} } \right] \) be a five-dimensional row vector. The elements \( x_{l}^{j} \) and \( y_{l}^{j} \) in \( {\mathbf{t}}_{l}^{j} \) are the x-y coordinates of the seed (corner) of the angle. Let \( \left( {i_{l}^{j} ,j_{l}^{j} } \right) \) be the unit vector that extends from the seed and equally divides the angle \( \phi_{l}^{j} \), Fig. 1.

The branch point and cross point will have three or more arms, Fig. 3. They will be represented by collections of bended-ellipse features with shared seed positions, Fig. 4. For example, a branch with 3 arms will be represented by 3 bended-ellipses and a cross with 4 arms will be represented by 6 bended-ellipses. A fork with more branches is important in recognition.

Fig. 3.
figure 3

Branch and cross.

Fig. 4.
figure 4

Cross and branch points are represented by multiple features with a shared seed position.

The feature collection that represents the target character, unknown handwritten character, is \( {\mathbf{U}} = \left\{ {{\mathbf{u}}_{m} |1 \le m \le M} \right\} \), where \( {\mathbf{u}}_{m} = \left[ {x_{m} ,y_{m} ,\phi_{m} ,i_{m} ,j_{m} } \right] \) is the \( m^{\text{th}} \) feature vector of the unknown character.

2 Locking and Deforming Process

All templates and their various histograms must be well prepared in advance for candidate template screening. The unknown character must have more number of features, two to three times, than that of the template. To save computation, each template is carefully selected from the character corpus by the screening procedure.

It is expected that each selected template is additive to the recognition rate [10]. The template outline is used in the screening. The distribution of the template features in the i-j-\( \phi \) diagram, Fig. 5, is also included as one related histogram.

Fig. 5.
figure 5

Angle and direction histogram, i-j-\( \phi \) diagram.

The similarity between two features, \( {\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right) \), is defined as the inner product between the two features, \( {\mathbf{t}}_{l}^{j} \) and \( {\mathbf{u}}_{m} \). Set parameters that will be used in the following context, \( {\mathbf{t}}_{l}^{j} = \left[ {x^{t} ,y^{t} ,\phi^{t} ,i^{t} ,j^{t} } \right];\,{\mathbf{u}}_{m} = \left[ {x^{u} ,y^{u} ,\phi^{u} ,i^{u} ,j^{u} } \right]; \)

$$ \begin{aligned} \theta = & \cos^{ - 1} \left( {\frac{{\left\| {\left( {i^{u} ,j^{u} } \right)} \right\|^{2} + \left\| {\left( {i^{t} ,j^{t} } \right)} \right\|^{2} - \left\| {\left( {i^{t} ,j^{t} } \right) - \left( {i^{u} ,j^{u} } \right)} \right\|^{2} }}{{2\left\| {\left( {i^{t} ,j^{t} } \right)} \right\|\left\| {\left( {i^{u} ,j^{u} } \right)} \right\|}}} \right) \\ & \quad \quad \quad \quad \quad = \cos^{ - 1} \left( {\frac{{2 - \left\| {\left( {i^{t} ,j^{t} } \right) - \left( {i^{u} ,j^{u} } \right)} \right\|^{2} }}{2}} \right); \\ \end{aligned} $$
(1)
$$ s_{1} = \hbox{max} \left\{ {0,\left( {1 - \frac{{\sqrt {\left( {x^{t} - x^{u} } \right)^{2} + \left( {y^{t} - y^{u} } \right)^{2} } }}{d}} \right)} \right\}; $$
(2)
$$ s_{2} = \hbox{max} \left\{ {0,\left( {1 - \frac{{\left| {\phi^{t} - \phi^{u} } \right|}}{{\frac{\pi }{2}}}} \right)} \right\};\,s_{3} = \hbox{max} \left\{ {0,\left( {1 - \frac{\left| \theta \right|}{{\frac{\uppi}{2}}}} \right)} \right\};\quad {\text{and}} $$
(3)
$$ s_{4} = \hbox{max} \left\{ {0,\left( {1 - \left| {i^{t} i^{u} + j^{t} j^{u} } \right|} \right)} \right\}. $$
(4)
$$ {\text{Then}}\,{\text{write s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right) = \left\{ {\begin{array}{*{20}c} {\frac{1}{2}\left( {s_{1} + s_{4} } \right),} & {\phi^{t} \ge \phi_{\text{line}} } \\ {\frac{1}{3}\left( {s_{1} + s_{2} + s_{3} } \right),} & {otherwise} \\ \end{array} } \right.. $$
$$ {\text{Note}}\,{\text{that}}\,0 \le {\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right) \le 1. $$
(5)

\( \phi_{\text{line}} \) is a threshold to discriminate a straight line feature from a bended feature.

We also use an alternate function in this work,

$$ {\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right) = { \hbox{min} }\left\{ {{\text{s}}_{\text{p}} \left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right),{\text{s}}_{\text{d}} \left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right)} \right\}, $$
(6)

where \( {\text{s}}_{\text{p}} \) is the similarity between positions, \( {\text{s}}_{\text{d}} \) is the similarity between both angles and directions. Let

$$ {\text{p}}\left( {\mathbf{v}} \right) = {\text{p}}\left( {\left[ {x,y,\phi ,i,j} \right]} \right) = \left[ {x,y} \right]. $$
(7)

Then the similarity of positions between two feature vectors is

$$ {\text{s}}_{\text{p}} \left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right) = {\text{f}}_{\text{p}} \left( {\frac{1}{w}\left\| {{\text{p}}\left( {{\mathbf{t}}_{l}^{j} } \right) - {\text{p}}\left( {{\mathbf{u}}_{m} } \right)} \right\|} \right), $$

where

$$ \begin{aligned} & {\text{f}}_{\text{p}} \left( x \right) = 2^{{ - 8x^{3} }} \,{\text{and}} \\ & w = d_{1} \,or\,d_{2} . \\ \end{aligned} $$
(8)

The similarity between both angles and directions is

$$ {\text{s}}_{\text{d}} \left( {{\mathbf{t}},{\mathbf{u}}} \right) = \frac{1}{2} + \frac{1}{4}{ \hbox{max} }\left\{ {a_{1} \left( {\mathbf{t}} \right) \cdot a_{1} \left( {\mathbf{u}} \right) + a_{2} \left( {\mathbf{t}} \right) \cdot a_{2} \left( {\mathbf{u}} \right),a_{1} \left( {\mathbf{t}} \right) \cdot a_{2} \left( {\mathbf{u}} \right) + a_{2} \left( {\mathbf{t}} \right) \cdot a_{1} \left( {\mathbf{u}} \right)} \right\}, $$

where

$$ \begin{aligned} & a_{1} \left( {\mathbf{v}} \right) = a_{1} \left( {\left[ {x,y,\phi ,i,j} \right]} \right) = \left[ {i,j} \right]\left[ {\begin{array}{*{20}c} {\cos \frac{\phi }{2}} & {\sin \frac{\phi }{2}} \\ { - \sin \frac{\phi }{2}} & {\cos \frac{\phi }{2}} \\ \end{array} } \right]\,{\text{and}} \\ & a_{2} \left( {\mathbf{v}} \right) = a_{2} \left( {\left[ {x,y,\phi ,i,j} \right]} \right) = \left[ {i,j} \right]\left[ {\begin{array}{*{20}c} {\cos \frac{ - \phi }{2}} & {\sin \frac{ - \phi }{2}} \\ { - \sin \frac{ - \phi }{2}} & {\cos \frac{ - \phi }{2}} \\ \end{array} } \right]. \\ \end{aligned} $$
(9)

\( a_{1} \) and \( a_{2} \) are functions to reconstruct the direction vector of one arm of the feature. The whole similarity score between a template and the unknown is the sum of all similarities between every corresponding pairs, \( {\text{S}}\left( {{\mathbf{T}}^{j} ,{\mathbf{U}}} \right) = \sum\nolimits_{l = 1}^{{L^{j} }} {{\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{l}^{j} } \right)} \). Note that we set

$$ {\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{l}^{j} } \right) = \left\{ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {s\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{l}^{j} } \right)} \\ 0 \\ \end{array} } & {\begin{array}{*{20}c} {{\text{when}}\,{\text{there}}\,{\text{exists}}\,{\text{a}}\,{\text{matched}}\,{\mathbf{u}}_{l}^{j} ;} \\ {\text{otherwise}} \\ \end{array} } \\ \end{array} } \right. $$
(10)

to include the case that \( {\mathbf{t}}_{l}^{j} \) does not have a matched feature.

The process between the \( j^{\text{th}} \) template, and the unknown character, \( {\mathbf{U}}{\mathbf{,}} \) is divided into three phases. In the first phase, each template feature, \( {\mathbf{t}}_{l}^{j} \in {\mathbf{T}}^{j} \), finds its corresponding similar feature \( {\mathbf{u}}_{l}^{j} \) in \( {\mathbf{U}} \) within a small radius, \( d_{1} \), where \( d_{1} \) is a designed parameter, Fig. 6. In other words,

$$ {\mathbf{u}}_{l}^{j} = \mathop {{ \arg }\,{ \hbox{max} }}\limits_{{{\mathbf{u}}_{m} }} \left\{ {{\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{m} } \right)} \right\}\,{\text{where}}\,\left\| {{\text{p}}\left( {{\mathbf{t}}_{l}^{j} } \right) - {\text{p}}\left( {{\mathbf{u}}_{m} } \right)} \right\| < d_{1} . $$
(11)
Fig. 6.
figure 6

Searching corresponding features in unknown character.

In the second phases, pick the pair of the locked features, \( \left( {{\mathbf{t}}_{{l_{a} }}^{j} ,{\mathbf{u}}_{{l_{a} }}^{j} } \right) \), which is defined as

$$ l_{a} = \mathop {{\text{arg }}\,{ \hbox{max} }}\limits_{{l = 1,..,L^{j} }} \left\{ {{\text{s}}\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{l}^{j} } \right)} \right\}. $$
(12)

This locked pair receives the highest similarity value, \( {\text{s}}\left( {{\mathbf{t}}_{{l_{a} }}^{j} ,{\mathbf{u}}_{{l_{a} }}^{j} } \right) \), among all pairs \( \left\{ {\left( {{\mathbf{t}}_{l}^{j} ,{\mathbf{u}}_{l}^{j} } \right),\,l = 1,..,L^{j} } \right\} \). Then shift the whole template to a new position and overlap the seeds of these two features, \( {\mathbf{t}}_{{l_{a} }}^{j} \) and \( {\mathbf{u}}_{{l_{a} }}^{j} \), Fig. 7. Let \( \left[ {x_{a} ,y_{a} } \right] = {\text{p}}\left( {{\mathbf{u}}_{{l_{a} }}^{j} } \right) \), which is the seed position of the locked feature, \( {\mathbf{u}}_{{l_{a} }}^{j} \). The shifted template, \( \left( {{\mathbf{T}}^{j} } \right)^{\text{s}} \), has new features \( \left\{ {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} = \left[ {(x_{l}^{j} )^{\text{s}} ,(y_{l}^{j} )^{\text{s}} ,\phi_{l}^{j} ,i_{l}^{j} ,j_{l}^{j} } \right],\,l = 1, \ldots ,L^{j} } \right\} \), where \( (x_{l}^{j} )^{\text{s}} = x_{l}^{j} + \left( {x_{a} - x_{{l_{a} }}^{j} } \right) \) and \( (y_{l}^{j} )^{\text{s}} = y_{l}^{j} + \left( {y_{a} - y_{{l_{a} }}^{j} } \right) \). Then we repeat the first phase and find the corresponding features \( \left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{s}} \) in \( {\mathbf{U}} \) for every feature in the shifted template, \( \left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} \in \left( {{\mathbf{T}}^{j} } \right)^{\text{s}} \). That is

$$ \left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{s}} = \mathop {{\text{arg }}\,{ \hbox{max} }}\limits_{{{\mathbf{u}}_{m} \in {\mathbf{U}}}} {\text{s}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} ,{\mathbf{u}}_{m} } \right)\,{\text{where}}\,\left\| {{\text{p}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} } \right) - {\text{p}}\left( {{\mathbf{u}}_{m} } \right)} \right\| < d_{2} . $$
(13)
Fig. 7.
figure 7

The two seeds of the two locked features will be aligned perfectly after shifting, rotation, and scaling procedures.

Let \( \left\{ {\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} ,\left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{s}} } \right),\,l = 1,..,L^{j} } \right\} \) be the corresponding pairs between the shifted template \( ({\mathbf{T}}^{j} )^{\text{s}} \) and unknown \( {\mathbf{U}} \). The new whole similarity score is \( {\text{S}}\left( {\left( {{\mathbf{T}}^{j} } \right)^{\text{s}} ,{\mathbf{U}}} \right) = \sum\nolimits_{l = 1}^{{L^{j} }} {{\text{s}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right) ^{\text{s}} , \left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{s}} } \right)} \). Note that the locked pairs, \( \left( {{\mathbf{t}}_{{l_{a} }}^{j} ,{\mathbf{u}}_{{l_{a} }}^{j} } \right) \), is in some sense similar to the resonance portion in ART [12].

In the third phase, pick the second locked feature pair that received the highest similarity value, \( \left( {\left( {{\mathbf{t}}_{{l_{b} }}^{j} } \right)^{\text{s}} ,\,\left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) \), where \( l_{b } \) is not equal to \( l_{a} \),

$$ l_{b} = \mathop {{ \arg }\,{ \hbox{max} }}\limits_{{l = 1,..,L^{j} }} \left\{ {{\text{s}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} ,\left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{s}} } \right)} \right\},\,{\text{and}}\,\left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} \ne {\mathbf{u}}_{{l_{a} }}^{j} $$
(14)

Let \( \left[ {x_{b} ,y_{b} } \right] = {\text{p}}\left( {\left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) \) be the seed position of the feature \( \left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} \). Using the position \( \left[ {x_{a} ,y_{a} } \right] \) as the rotation center and the scaling center, rotate and scale the whole template \( \left( {{\mathbf{T}}^{j} } \right)^{\text{s}} \) so that the two seeds \( {\text{p}}\left( {\left( {{\mathbf{t}}_{{l_{a} }}^{j} } \right)^{\text{s}} } \right) = \left[ {x_{a} ,y_{a} } \right] \) and \( {\text{p}}\left( {\left( {{\mathbf{t}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) = \left[ {x_{b} ,y_{b} } \right] \) will coincide with their corresponding seeds in the unknown character. After rotation and scaling, we obtain a refined template collection, \( \left( {{\mathbf{T}}^{j} } \right)^{\text{r}} \), where

$$ \left( {{\mathbf{T}}^{j} } \right)^{\text{r}} = \left\{ {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{r}} = \left[ {\left( {x_{l}^{j} } \right)^{\text{r}} ,\left( {y_{l}^{j} } \right)^{\text{r}} ,\phi_{l}^{j} ,\left( {i_{l}^{j} } \right)^{\text{r}} ,\left( {j_{l}^{j} } \right)^{\text{r}} } \right],\,l = 1, \ldots ,L^{j} } \right\} $$
(15)

In order to facilitate the operation of the rotation and scaling procedure for the whole template, set complex numbers,

$$ \begin{aligned} {\text{cpx}}\left( {\mathbf{v}} \right) = & {\text{cpx}}\left( {\left[ {x,y} \right]} \right) = \left[ {x,y} \right] \cdot \left[ {1,i} \right] = x + yi, \\ & {\text{vec}}\left( {x + yi} \right) = \left[ {x,y} \right] = {\mathbf{v}}. \\ \end{aligned} $$
(16)

Then, operate the rotation and scaling according to the seed positions of the two locked feature pairs. Set

$$ {\mathbf{p}}_{\text{t}} = {\text{p}}\left( {\left( {{\mathbf{t}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) - {\text{p}}\left( {{\mathbf{u}}_{{l_{a} }}^{j} } \right)\,{\text{and}}\,{\mathbf{p}}_{\text{u}} = {\text{p}}\left( {\left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) - {\text{p}}\left( {{\mathbf{u}}_{{l_{a} }}^{j} } \right). $$

Also set

$$ c_{{{\text{r}},{\text{s}}}} = \frac{{{\text{cpx}}\left( {{\mathbf{p}}_{\text{u}} } \right)}}{{{\text{cpx}}\left( {{\mathbf{p}}_{\text{t}} } \right)}} \quad {\text{and}}\quad c_{\text{r}} = \frac{{{\text{cpx}}\left( {\frac{{{\mathbf{p}}_{\text{u}} }}{{\left| {{\mathbf{p}}_{\text{u}} } \right|}}} \right)}}{{{\text{cpx}}\left( {\frac{{{\mathbf{p}}_{\text{t}} }}{{\left| {{\mathbf{p}}_{\text{t}} } \right|}}} \right)}}. $$

After we get these complex numbers, apply them to the position vector and the direction vector of every template features. Then, obtain a rotated and scaled template,

$$ \begin{aligned} & \left[ {\left( {x_{l}^{j} } \right)^{\text{r}} ,\left( {y_{l}^{j} } \right)^{\text{r}} } \right] = {\text{vec}}\left( {{\text{cpx}}\left( {{\text{p}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} } \right) - {\text{p}}\left( {{\mathbf{u}}_{{l_{a} }}^{j} } \right)} \right) \times c_{{{\text{r}},{\text{s}}}} } \right)\,{\text{and }} \\ & \left[ {\left( {i_{l}^{j} } \right)^{\text{r}} ,\left( {j_{l}^{j} } \right)^{\text{r}} } \right] = {\text{vec}}\left( {{\text{cpx}}\left( {\left[ {\left( {i_{l}^{j} } \right)^{\text{s}} ,\left( {j_{l}^{j} } \right)^{\text{s}} } \right]} \right) \times c_{\text{r}} } \right),\quad {\text{for }}\forall \left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{s}} \in \left( {{\mathbf{T}}^{j} } \right)^{\text{s}} , \\ \end{aligned} $$
(17)

where \( {\text{p}}\left( {\left( {{\mathbf{t}}_{{l_{a} }}^{j} } \right)^{\text{r}} } \right) = {\text{p}}\left( {{\mathbf{u}}_{{l_{a} }}^{j} } \right) \) and \( {\text{p}}\left( {\left( {{\mathbf{t}}_{{l_{b} }}^{j} } \right)^{\text{r}} } \right) = {\text{p}}\left( {\left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) \).

Repeating the procedure in the first phase for all features, \( \forall \left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{r}} \in \left( {{\mathbf{T}}^{j} } \right)^{\text{r}} \), get

$$ \left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{r}} = \mathop {{\text{arg }}\,{ \hbox{max} }}\limits_{{{\mathbf{u}}_{m} \in {\mathbf{U}}}} \,{\text{s}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{r}} ,{\mathbf{u}}_{m} } \right),\,{\text{where}}\,\left\| {{\text{p}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{r}} } \right) - {\text{p}}\left( {{\mathbf{u}}_{m} } \right)} \right\| < d_{3} , $$
(18)

The refined whole score for the refined template is \( {\text{S}}\left( {\left( {{\mathbf{T}}^{j} } \right)^{\text{r}} ,{\mathbf{U}}} \right) = \sum\nolimits_{l = 1}^{{L^{j} }} {{\text{s}}\left( {\left( {{\mathbf{t}}_{l}^{j} } \right)^{\text{r}} , \left( {{\mathbf{u}}_{l}^{j} } \right)^{\text{r}} } \right)} \).

The three scores, \( {\text{S}}\left( {{\mathbf{T}}^{j} ,{\mathbf{U}}} \right) \), \( {\text{S}}\left( {\left( {{\mathbf{T}}^{j} } \right)^{\text{s}} ,{\mathbf{U}}} \right) \), and \( {\text{S}}\left( {\left( {\mathbf{T}} \right)^{\text{r}} ,{\mathbf{U}}} \right) \), will be used as the compatibility scores for the \( j^{\text{th}} \) template. Pick the largest value of the three as the final compatibility for the template \( {\mathbf{T}}^{j} \),

$$ {\text{S}}^{ *} \left( {{\mathbf{T}}^{j} ,{\mathbf{U}}} \right) = { \hbox{max} }\left\{ {{\text{S}}\left( {{\mathbf{T}}^{j} ,{\mathbf{U}}} \right),{\text{S}}\left( {\left( {{\mathbf{T}}^{j} } \right)^{\text{s}} ,{\mathbf{U}}} \right),{\text{S}}\left( {\left( {{\mathbf{T}}^{j} } \right)^{\text{r}} ,{\mathbf{U}}} \right)} \right\}. $$
(19)

3 Simulation and Discussion

We tested the process to examine its capability. In our simulation, the size of the image of each character is 256-by-256 pixels for both templates and the unknown character, Fig. 8. The whole scores are also listed in the figure. All 26 templates are the 26 images of handwritten English uppercase alphabets, Fig. 9. The width of each stroke is roughly 5 to 15 pixels. Each image is properly normalized. The similarity scores, Eq. 7, of all 26 templates are listed in Fig. 10. The similarity scores, Eq. 6, are listed in Fig. 11.

Fig. 8.
figure 8

The unknown character ‘A’, 256 by 256 pixels.

Fig. 9.
figure 9

Images of the 26 templates.

Fig. 10.
figure 10

Similarity scores (Eq. 7).

Fig. 11.
figure 11

Similarity scores (Eq. 6).

The recognition rate of the proposed process is comparable to that of STD. The computation cost is much less than that of STD. Since each template is designed manually, several fixed key features can be specified manually in advance. These keys have priority in the process. The highest locked pair \( \left( {{\mathbf{t}}_{{l_{a} }}^{j} ,{\mathbf{u}}_{{l_{a} }}^{j} } \right) \) may be picked only from those keys. The second highest pair \( l_{b} \), \( \left( {\left( {{\mathbf{t}}_{{l_{b} }}^{j} } \right)^{\text{s}} , \left( {{\mathbf{u}}_{{l_{b} }}^{j} } \right)^{\text{s}} } \right) \), may also be picked from them. The whole scores S may be accumulated only for those key features.

The two locked pairs can be picked simultaneously in the first phase. When one picked three different locked pairs, one can apply the conformal mapping technique [8] to deform the whole template and accomplish the score.