arXiv:2609.02251cs.CVSep 2026

Manuscript Offprint

arXiv:2609.02251

Handwriting Trajectory Recovery via Autoregressive Ordered Stroke Instance Prediction

En-Guang Wang, Yan-Ming Zhang, Fei Yin, Cheng-Lin Liu

Abstract

Handwriting trajectory recovery aims to infer the dynamic writing process hidden behind a static handwritten image. Since offline handwriting preserves only the final spatial ink pattern, temporal information such as stroke order, writing direction, and pen-tip motion is lost, making recovery inherently ambiguous. Existing learning-based methods often directly predict the complete character trajectory without explicitly exploiting the stroke-level organization of handwriting. We argue that recovering the writing process should follow the writing process itself. Accordingly, we propose a two-stage framework that first recovers ordered stroke instances and then reconstructs continuous within-stroke motion. The first stage integrates stroke extraction and stroke-order recovery through autoregressive ordered stroke prediction, while direction-related structural cues further support within-stroke trajectory generation. Experiments on Chinese handwriting show that the proposed ordered prediction is more effective than post-hoc stroke ordering. Even without trajectory simplification, our full-point model achieves numerically better results than those reported by all compared baselines, while a controlled analysis shows that trajectory sampling density substantially affects measured recovery performance. Additional experiments demonstrate generalization to unseen Chinese character categories and cross-language extensibility to English and Tamil handwriting.

Keywords: Offline-to-online handwriting trajectory recovery, Handwriting analysis, Writing process recovery, Stroke order recovery, Trajectory reconstruction

*Corresponding author. Email address: ymzhang@nlpr.ia.ac.cn (Yan-Ming Zhang)

Figure

Figure 1: Examples of offline handwritten character images (top) and their corresponding online writing trajectories (bottom). Green dots denote trajectory sampling points, and the trajectory color progresses from cool to warm tones as writing time advances.

1. Introduction

Handwriting is inherently a dynamic process generated by continuous pen-tip movements, whereas an offline handwritten image preserves only the final spatial ink pattern produced by this process [1]. Unlike online handwriting, which records pen-tip coordinates and their temporal order, offline handwriting loses dynamic information such as stroke order, writing direction, and continuous pen-tip motion during image formation [1, 2]. Offline-to-online handwriting trajectory recovery therefore aims not merely to reconstruct the observed character shape, but to infer the underlying writing process that produced the static image. As illustrated in Fig. 1, the offline image shows only the final ink pattern, whereas the corresponding online trajectory explicitly reveals the pen-tip motion and its temporal evolution.

Inferring this dynamic process from a static image is inherently ambiguous [3, 4]. Different stroke orders, starting positions, and writing directions may produce similar or even nearly identical final glyphs [2, 5]. The ambiguity becomes more severe for multi-stroke characters containing intersections, contacts, overlaps, or cursive connections, where local ink appearance may be insufficient to determine stroke ownership and temporal precedence [6, 7]. Consequently, the central challenge is not simply to find a geometric path compatible with the observed image, but to recover the stroke structure, inter-stroke order, and continuous within-stroke pen-tip motion that together constitute the writing process.

Early studies primarily relied on explicit structural reasoning. Skeleton analysis and global optimization were used to recover plausible writing paths from static ink patterns [8, 2], while graph search and hierarchical character structures were further employed for stroke-order recovery in multi-stroke Chinese characters [5, 9]. Deep learning later shifted the problem toward direct trajectory prediction. DED-Net formulated trajectory recovery as end-to-end image-to-sequence generation [10], whereas Cross-VAE modeled the conversion between offline and online handwriting modalities [3]. Subsequent studies em-ployed attention- or Transformer-based architectures for variable-length and complex trajectory recovery [4, 11]. In parallel, stroke decomposition and ordering explicitly introduced stroke-level structure [6], while stroke segmentation improved stroke parsing from static handwriting images [12, 13].

Despite these advances, a common gap remains. Direct whole-character generation typically treats the complete trajectory as the primary prediction target, leaving stroke instance parsing, inter-stroke ordering, and long-sequence trajectory generation to be resolved implicitly within a character-level decoding process. In contrast, methods that explicitly introduce stroke structure often follow an extract-then-order paradigm, in which stroke elements are first determined and only afterward arranged into a writing sequence [6]. The former does not fully exploit the intrinsic hierarchy of handwriting, whereas the latter treats stroke order as a post-hoc operation that cannot participate in stroke-instance formation. This raises the central question addressed in this work: how can the lost dynamic information be progressively recovered according to the organization of the actual writing process?

We argue that recovering the writing process should follow the writing process itself rather than directly predicting the final trajectory. Handwriting has a natural hierarchy: continuous pen-tip movements form individual strokes, and temporally ordered strokes further compose a complete character [9, 7]. Accordingly, we first recover ordered stroke instances and then recover continuous pen-tip motion within each stroke. Rather than producing an unordered stroke set followed by post-hoc ordering, the first stage conditions instance prediction on the preceding writing state so that each decoding step directly forms the next stroke, integrating stroke extraction and stroke-order recovery within the same prediction process.

To further recover within-stroke motion, the first stage jointly predicts stroke start and end points as direction-aware auxiliary structural cues, with the predicted start point transferred across stages to determine the writing origin of the current stroke. The second stage then reconstructs subsequent pen-tip motion from this initialized writing origin. Finally, the recovered stroke trajectories are concatenated according to their predicted order to form the complete character trajectory.

Extensive experiments validate both the design choices and the overall effectiveness of the proposed framework. On Chinese handwriting, the autoregressive ordered formulation achieves better stroke-order recovery and downstream trajectory recovery than post-hoc ordering pipelines, while the full-point model achieves numerically better results than those reported by all compared baselines across DTW, LDTW, AIoU, and LPIPS. The framework further generalizes to unseen Chinese character categories and extends to English and Tamil handwriting, while controlled experiments reveal the substantial influence of trajectory sampling density on measured recovery performance.

The main contributions of this work are summarized as follows:

  • Writing-process-oriented trajectory recovery. We propose a two-stage framework that follows the writing process itself, decomposing com-

plete trajectory recovery into ordered stroke instance prediction and within-stroke trajectory generation.

  • Autoregressive ordered stroke instance prediction. We reformulate query-based unordered set prediction as autoregressive ordered stroke prediction, jointly modeling stroke extraction and stroke-order recovery during instance formation rather than through post-hoc ordering.

  • Direction-aware supervision and start-point initialization. We introduce stroke start/end points as auxiliary structural supervision for ordered stroke prediction and transfer the predicted start point across stages to initialize within-stroke trajectory generation.

  • Full-point trajectory recovery and sampling-density analysis. We evaluate complete trajectory recovery while retaining all original trajectory samples and systematically analyze the influence of trajectory sampling density; even without trajectory simplification, our method achieves numerically better results than those reported by all compared baselines.

References (30)