Abstract
Reconstructing the trajectory from the static image of handwritten ink traces is useful in many practical applications envisaging handwriting analysis and recognition from offline data, as it allows the use of methods, algorithms, and tools that deal with online data, achieving better results than those achieved on offline data. In this work, the trajectory recovery is addressed by combining a general graph traversal algorithm with knowledge about the processes involved in human learning of motor skills to perform voluntary and complex movements. The effectiveness of the proposed approach has been quantitatively and extensively evaluated on large and publicly available datasets, containing English and French multi-stroke words and isolated characters. The experimental results show that our approach outperforms the existing ones in terms of Root Mean Square Error and Dynamic Time Warping distance between the recovered trajectories and the actual ones. Furthermore, an “off-the-shelf” online recognition system provided with the trajectory recovered from offline samples showed an overall reduction of 6.8% with respect to the recognition rate achieved by the system when provided with online data; the reduction, however, drops to 2.4% once preprocessing errors are not taken into account.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.Data availibility
The data that support the findings of this study were collected and made available for research purposes by the IRESTE group of the University of Nantes, France.
Notes
In this section and accordingly to the literature here reported, the term stroke is adopted to denote a trace performed without lifting the pen from the paper. In the remainder of the paper, it will be used to denote the elementary writing movement, as mentioned in the Introduction.
References
Boccignone G, Chianese A, Cordella L et al (1993) Recovering dynamic information from static handwriting. Pattern Recogn 26(3):409–418. https://doi.org/10.1016/0031-3203(93)90168-V
Bunke H, Ammann R, Kaufmann G et al (1997) Recovery of temporal information of cursively handwritten words for on-line recognition. In: Proceedings fourth international conference on document analysis and recognition, pp 931–935. https://doi.org/10.1109/ICDAR.1997.620647
Cordella LP, De Stefano C, Marcelli A et al (2010) Writing order recovery from off-line handwriting by graph traversal. In: 2010 20th international conference on pattern recognition, pp 1896–1899
De Stefano C, Guadagno G, Marcelli A (2004) A saliency-based segmentation method for online cursive handwriting. Int J Pattern Recognit Artif Intell 18(07):1139–1156. https://doi.org/10.1142/S021800140400368X
Diaz M, Crispo G, Parziale A et al (2022) Writing order recovery in complex and long static handwriting. Int J Interact Multimed Artif Intell 7(4):171–184. https://doi.org/10.9781/ijimai.2021.04.003
Dinh M, Yang HJ, Lee GS et al (2016) Recovery of drawing order from multi-stroke English handwritten images based on graph models and ambiguous zone analysis. Expert Syst Appl 64:352–364. https://doi.org/10.1016/j.eswa.2016.08.017
Doermann DS, Rosenfeld A (1995) Recovery of temporal information from static images of handwriting. Int J Comput Vis 15:143–164. https://doi.org/10.1007/BF01450853
Elbaati A, Kherallah M, Ennaji A et al (2009) Temporal order recovery of the scanned handwriting. In: Proceedings international conference on document analysis and recognition, pp 1116–1120. https://doi.org/10.1109/ICDAR.2009.266
Elbaati A, Hamdi Y, Alimi AM (2019) Handwriting recognition based on temporal order restored by the end-to-end system. In: Proceedings of the international conference on document analysis and recognition, ICDAR. https://doi.org/10.1109/ICDAR.2019.00199
Grossberg S, Paine RW (2000) A neural model of cortico-cerebellar interactions during attentive imitation and predictive learning of sequential handwriting movements. Neural Netw 13(8–9):999–1046. https://doi.org/10.1016/S0893-6080(00)00065-4
Hassaïne A, Al Maadeed S, Bouridane A (2013) Icdar 2013 competition on handwriting stroke recovery from offline data. In: 2013 12th international conference on document analysis and recognition, pp 1412–1416
Jager S (1996) Recovering writing traces in off-line handwriting recognition: using a global optimization technique. In: Proceedings 13th international conference on pattern recognition, pp 150–154
Kato Y, Yasuhara M (1999) Recovery of drawing order from scanned images of multi-stroke handwriting. In: Proceedings of the fifth international conference on document analysis and recognition, pp 261–264. https://doi.org/10.1109/ICDAR.1999.791774
Kato Y, Yasuhara M (2000) Recovery of drawing order from single-stroke handwriting images. IEEE Trans Pattern Anal Mach Intell 22(9):938–949. https://doi.org/10.1109/34.877517
Kumar Bhunia A, Bhowmick A, Kumar Bhunia KA et al (2018) Handwriting trajectory recovery using end-to-end deep encoder–decoder network. In: Proceedings—international conference on pattern recognition. https://doi.org/10.1109/ICPR.2018.8546093
Marcelli A, Santoro A, De Stefano C et al (2017) Process of handwriting recognition and related apparatus. US Patent: US9665768, 2017
Nagoya T, Fujioka H (2011) Recovering drawing order from static handwritten images using probabilistic tabu search. In: TENCON 2011—2011 IEEE region 10 conference, pp 379–384
Nagoya T, Fujioka H (2012) Recovering dynamic stroke information of multi-stroke handwritten characters with complex patterns. In: International workshop on frontiers in handwriting recognition, pp 722–727. https://doi.org/10.1109/ICFHR.2012.258
Nguyen HT, Nakamura T, Nguyen CT et al (2020) Online trajectory recovery from offline handwritten Japanese kanji characters of multiple strokes. In: Proceedings—international conference on pattern recognition. https://doi.org/10.1109/ICPR48806.2021.9413294
Nguyen V, Blumenstein M (2010) Techniques for static handwriting trajectory recovery: a survey. In: Proceedings of the 9th IAPR international workshop on document analysis systems, DAS ’10, pp 463–470. https://doi.org/10.1145/1815330.1815390
Noubigh Z, Kheralla M (2017) A survey on handwriting recognition based on the trajectory recovery technique. In: 2017 1st international workshop on arabic script analysis and recognition (ASAR), pp 69–73
Parziale A, Senatore R, Marcelli A (2020) Exploring speed-accuracy tradeoff in reaching movements: a neurocomputational model. Neural Comput Appl 32:13377–13403
Pervouchine V, Leedham G, Melikhov K (2005) Three-stage handwriting stroke extraction method with hidden loop recovery. In: International conference on document analysis and recognition (ICDAR’05), pp 307–311. https://doi.org/10.1109/ICDAR.2005.241
Phan D, Na IS, Kim SH et al (2015) Triangulation based skeletonization and trajectory recovery for handwritten character patterns. KSII Trans Internet Inf Syst 9(1):358–377. https://doi.org/10.3837/tiis.2015.01.022
Plamondon R, Djioua M (2006) A multi-level representation paradigm for handwriting stroke generation. Hum Mov Sci 25(4–5):586–607. https://doi.org/10.1016/j.humov.2006.07.004
Plamondon R, Privitera CM (1999) The segmentation of cursive handwriting: an approach based on off-line recovery of the motor-temporal information. IEEE Trans Image Process 8(1):80–91. https://doi.org/10.1109/83.736691
Qiao Y, Nishiara M, Yasuhara M (2006) A framework toward restoration of writing order from single-stroked handwriting image. IEEE Trans Pattern Anal Mach Intell 28(11):1724–1737. https://doi.org/10.1109/TPAMI.2006.216
Rabhi B, Elbaati A, Boubaker H et al (2021) Multi-lingual character handwriting framework based on an integrated deep learning based sequence-to-sequence attention model. Memet Comput. https://doi.org/10.1007/s12293-021-00345-6
Rijntjes M, Dettmers C, Büchel C et al (1999) A blueprint for movement: functional and anatomical representations in the human motor system. J Neurosci 19(18):8043–8048. https://doi.org/10.1523/JNEUROSCI.19-18-08043.1999
Rousseau L, Anquetil E, Camillerapp J (2005) Recovery of a drawing order from off-line isolated letters dedicated to on-line recognition. In: Eighth international conference on document analysis and recognition (ICDAR’05), pp 1121–1125
Senatore R, Marcelli A (2012) A neural scheme for procedural motor learning of handwriting. In: 2012 international conference on frontiers in handwriting recognition, pp 659–664. https://doi.org/10.1109/ICFHR.2012.160
Senatore R, Marcelli A (2019) A paradigm for emulating the early learning stage of handwriting: performance comparison between healthy controls and parkinson’s disease patients in drawing loop shapes. Hum Mov Sci 65:89–101. https://doi.org/10.1016/j.humov.2018.04.007
Sparrow WA, Newell KM (1998) Metabolic energy expenditure and the regulation of movement economy. Psychon B Rev 5(2):173–196. https://doi.org/10.3758/BF03212943
Sumi T, Iwana BK, Hayashi H et al (2019) Modality conversion of handwritten patterns by cross variational autoencoders. In: Proceedings of the international conference on document analysis and recognition, ICDAR. https://doi.org/10.1109/ICDAR.2019.00072
Viard-Gaudin C, Lallican PM, Knerr S et al (1999) The ireste on/off (ironoff) dual handwriting database. In: Proceedings of the international conference on document analysis and recognition, pp 455–458. https://doi.org/10.1109/ICDAR.1999.791823
Viard-Gaudin C, Lallican PM, Knerr S (2005) Recognition-directed recovering of temporal information from handwriting images. Pattern Recognit Lett 26(16):2537–2548. https://doi.org/10.1016/j.patrec.2005.04.019
Wang TQ, Liu CL (2021) Handwriting trajectory recovery from off-line multi-stroke characters by deep ordering prediction and heuristic search. In: 2021 IEEE international conference on multimedia and expo (ICME), pp 1–6. https://doi.org/10.1109/ICME51207.2021.9428463
Yang M, Zhou X, Sun Y et al (2021) Drawing order recovery from trajectory components. In: 2021 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp 1–5. https://doi.org/10.1109/ICASSP39728.2021.9413542
Yu Qiao, Yasuhara M (2006) Recover writing trajectory from multiple stroked image using bidirectional dynamic search. In: 18th international conference on pattern recognition (ICPR’06), pp 970–973
Zhang R, Chen J, Yang M (2019) Drawing order recovery based on deep learning. In: 11th international conference on advanced computational intelligence, ICACI 2019. https://doi.org/10.1109/ICACI.2019.8778533
Zhao B, Yang M, Tao J (2018) Pen tip motion prediction for handwriting drawing order recovery using deep neural network. In: 2018 24th international conference on pattern recognition (ICPR), pp 704–709
Acknowledgements
This research did not receive any specific grant from funding agencies in the public, commercial, or not-for-profit sectors. The authors would like to thank Luigi P. Cordella for many useful discussions on skeleton distortions. Angelo Marcelli would like to thank George Nagy for pointing out the shortcuts and associated risks in assessing the performance evaluation in the field of document processing, and Theo Pavlidis for providing insights on the subtleties of the skeletonization algorithms.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
Authors have no financial or non-financial interests that are directly or indirectly related to the work submitted for publication.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix
Appendix
1.1 Distortion correction
As spurious branches are associated with small protrusions appearing on the trace main body, and considering that our approach is dealing with ribbons, i.e., objects whose local thickness is much smaller than the length, the length and the local thickness at the tip (of the spurious branches) are expected to be smaller than the local thickness (T) of the ink trace in correspondence of the protrusion. Considering the ratio \(\rho \) between the difference \(\Delta = T_{BP}-T_{EP}\) and the length L of the branch, \(\rho = 0\) for a branch whose local thickness at the tip of the protrusion is the same as the local thickness of the trace and therefore, cannot be considered as representing a protrusion. On the other hand, a protrusion made by just one pixel would generate a branch for whom \(\Delta = T_{BP}-1\) and \(L = T_{BP}+1\), so that \(\rho \ge 0.5\), and becomes larger and larger as \(T_{BP}\) becomes bigger. Consequently, the skeleton branches starting from a BP and ending in an EP, for whom \(\rho \ge 0.5\) are considered spurious branches, and removed from the skeleton.
Before distortion correction, a polygonal approximation of each skeletal branch is performed through a split-and-merge algorithm, wherein the vertices of the polyline are constrained to be the extremes of the sequences of collinear pixels (i.e. pixels aligned along the same rectilinear line). They must include the EPs and the BPs of the skeleton.
In order to illustrate the criteria to eliminate the distortions introduced by the skeletonization process, three types of distortions, called V-shape, T-shape, and X-shape, can be distinguished, as shown in Fig. 13.
A V-shape distortion occurs when the ink trace presents a sharp curve. In such a case, the polyline of the trace is that of Fig. 13A because of the triangular shape of the ink trace in correspondence with the sharp curve. Such distortions, thus, can be identified by analyzing the polyline segments joining in a BP that connects three segments. If the following conditions hold:
-
1.
one of the segments is delimited by an EP;
-
2.
the thickness at the BP is bigger than that of the EP;
-
3.
the angles \(\alpha _1\) and \(\alpha _2\) between the segment delimited by the EP and the two other segments joining in the BP have similar amplitude, that is \( |\alpha _1-\alpha _2 |\le \theta _1 \);
the spurious segment between the BP and EP is removed, and the two segments are connected so that they join in the EP, as represented by the dotted lines in Fig. 13A.
A T-shape distortion occurs when two parts of ink trace touch each other producing a T-shaped pattern. In these cases, the polyline of the touching region is shown in Fig. 13B: it presents three segments joining in a BP whose corresponding ink thickness is bigger than those at the other vertices of the segments connected to the BP, and the segments of the part of ink trace that can be interpreted as the top bar of the T bends toward the vertical bar instead of being parallel to the contour of the top bar. In Fig. 13B, the distorted segments are represented by the continuous lines starting from BP and ending in \(V_1\), \(V_2\), and \(V_3\). The point BP’ is the intersection point between the line connecting \(V_1\) and \(V_2\) and the line obtained by extending the segments ending in \(V_3\), \(\alpha \) is the angle measured at the intersection obtained by extending the segments passing from \(V_1\) and \(V_2\), and d is the distance between BP and BP’. These distortions are characterized by the following conditions:
-
1.
the ink thickness at the BP is bigger than that of both the vertices \(V_1\) and \(V_2\);
-
2.
the segments connecting \(V_1\) and \(V_2\) with BP form a smooth curve, that is \(\alpha \ge \theta _2\);
-
3.
the branch point \(BP'\) is centrally located within the part of the trace corresponding to the top bar, that is \(d<T_{BP}\);
When the previous conditions hold, the branch point BP is replaced by BP’, and the segments starting from \(V_1\), \(V_2\), and \(V_3\) are connected at BP’, as represented by the dotted lines in Fig. 13B.
An X-shape distortion occurs when two parts of the ink trace cross each other. In this case, the polyline of the crossing region presents five segments that connect in two BPs, instead of four segments joining in a single BP, as expected (Fig. 13C). These distortions are detected by considering each pair of BPs connected by a segment of the polyline, from each of which three rectilinear segments start. If the following conditions hold:
-
1.
the ink thickness at the \(BP_i\) is bigger than those at the vertices \(V_{ij}\);
-
2.
the segments connecting \(V_{ij}\) with \(BP_i\) do not form a smooth curve, that is \(\alpha _i \le \theta _3\);
the five segments are replaced by four segments, connecting the vertices \(V_{ij}\) with the new branch points \(BP'\), which is located at the intersection between the segments connecting the vertices \(V_{11}\) with \(V_{22}\) and \(V_{12}\) with \(V_{21}\), as represented by the dotted lines in Fig. 13C.
1.2 Starting/ending points selection
These criteria depend on whether or not the graph contains only one type of node or any combination of them, and in the former case, from their type:
-
1.
the graph contains only even degree BPs. The leftmost BP is selected as the source node, and the rightmost BP is selected as the destination node. An example of this condition is represented by the shape of the digit ‘8’.
-
2.
the graph contains only two odd nodes and any number of even degree nodes. According to the orientation of the connected component represented by the graph (horizontally or vertically extended) and the distance (horizontal or vertical, respectively) between the nodes, the leftmost or the uppermost one is selected as the source, and the rightmost or the lowermost as the destination, as depicted in the flowchart of Fig. 14.
-
3.
the graph contains more than two odd nodes and any number of even nodes. Source and destination nodes are selected according to the flowchart reported in Fig. 15. The source/destination node is selected among the two leftmost/rightmost odd nodes of the graph depending on the type of both the candidate node (EP or BP) and the nodes connected to it. In particular, the function selectSrc(NodeSet) selects as the source node the leftmost or the uppermost among those belonging to the NodeSet depending on the orientation of the component, as in the previous case. Similarly, the function selectDst(NodeSet) selects as the destination node the rightmost or the lowermost among those belonging to the NodeSet.
A particular case occurs when the ink trace contains only normal points, as it happens with a skeleton of a trace representing a closed loop, as it may happen in the case of an isolated letter o. In this case, the top-left polygonal approximation point is selected as both source and destination node and the corresponding graph degenerates into a single node.
1.3 Chinese arcs insertion
Starting from the set of odd degree nodes, the leftmost node \(n_i\) is chosen (in case two nodes are located at the same horizontal coordinate, the uppermost is chosen):
-
If \(n_i\) is an EP, a Chinese arc to the leftmost odd node \(n_{i+1}\) is added. This criterion arises from the considerations that handwriting is performed from the left to the right and that an EP usually represents either a point from which a retracing movement is started or a point where the pen tip is lifted from the paper.
-
If \(n_i\) is a BP, among the odd nodes connected to it through a “loop” or a “bridge” is not considered for being further connected. This criterion follows from the particular topology of loops and bridges. Here a “loop” is a path that starts and ends in the same BP (f.i., the upper part of the trajectory of the letter and ), and as “bridge” an arc whose removal disconnects the graph (f.i., the ligature between two characters). Being very unlikely that a loop or a bridge be drawn twice when writing the word, the presence of a retracing involving these two types of branches is excluded. Once the odd nodes connected through loops or bridges were excluded from being further connected, three cases can be observed:
-
no already connected nodes are available for being connected: a pen-up is added between the node \(n_i\) and the leftmost unconnected odd node \(n_{i+1}\);
-
only one connected node is available: it is connected to \(n_i\) with a retracing arc;
-
two or more odd nodes already connected are available for being connected: if there are EPs, the closest EP is connected to \(n_i\), otherwise the closest BP is chosen, and in both cases, a retracing arc is added.
-
This procedure is performed until all the odd nodes are connected and transformed into even ones, and the graph becomes semi-Eulerian.
1.4 Changes in the estimated trajectory according to the estimated energy
An estimated trajectory is changed according to the following steps:
-
1.
the energy vector is analyzed in search of a non-zero value in correspondence of the EP or BP that is the starting point of the trajectory. If such an element is found and there are alternative nodes to be considered as source nodes, the current source node is removed from the possible candidates, and a new source node is selected, as described in the paragraph 2.2, a new trajectory is generated by the unfolding module, segmented in strokes and its energy consumption is estimated by computing the energy score. Eventually, between the two trajectories, the one with the lowest energy score is selected for the next step, as illustrated in Fig. 16;
-
2.
the energy vector of the selected trajectory is analyzed in search of a non-zero value in correspondence of the EP or BP that is the ending point of the trajectory. If such an element is found and there are alternative nodes to be considered as destination nodes, the current destination node is removed from the possible candidates, a new destination node is selected as described in the paragraph 2.2, a new trajectory is generated, and its energy consumption is estimated, as illustrated in Fig. 17. As in the previous case, the trajectory with the lowest energy score is selected for the next step;
-
3.
if the selected trajectory contains additional arcs and non-zero values are found in correspondence with the EP/BP representing the starting/ending of the additional arc, the additional arc is removed, and other possible combinations for connecting odd nodes are evaluated following the procedure for building the semi-Eulerian graph described in the paragraph 2.2, a new trajectory is generated and its energy consumption estimated, as illustrated in Fig. 18. This step is iterated until a trajectory is generated whose energy vector elements corresponding to the starting/ending points of the additional arcs are equal to zero, or all alternative additional arcs have been evaluated. Therefore, the step is repeated at most \(n_{IT}\) times, where \(n_{IT}\) depends on the number of odd nodes n to be connected:
$$\begin{aligned} n_{IT}= \prod _{i=0}^{\frac{n}{2}-1} (n-2i-1) \end{aligned}$$Among the set of estimated trajectories, the one with the lowest energy score is selected for the last step;
-
4.
the energy vector is analyzed in search of the non-zero value in correspondence of BPs that are not the starting/ending point of the trajectory, and if such elements are found, for each BP another possible choice of coupling the arcs connected to it is made, a new trajectory is generated and its energy consumption evaluated, as illustrated in Fig. 19. This step is iterated until a trajectory is generated, whose energy vector elements corresponding to the BPs that are neither starting nor ending points are equal to zero, which therefore represents the desired one, or all alternative couplings of the arcs connected to the BP have been evaluated. As at each step an alternative is evaluated for each BP, the step is repeated at most \(n-1\) times, where n is the largest degree of the BPs under investigation. Among the set of estimated trajectories, the one with the lowest energy score is selected as the final one.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Senatore, R., Santoro, A., Parziale, A. et al. A biologically inspired approach for recovering the trajectory of offline handwriting. Memetic Comp. 15, 355–375 (2023). https://doi.org/10.1007/s12293-023-00397-w
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s12293-023-00397-w