Signature drawing method and terminal based on trajectory prediction and correction
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUJIAN CENTM INFORMATION
- Filing Date
- 2026-03-25
- Publication Date
- 2026-08-07
AI Technical Summary
然而,电磁屏的采样频率(通常为100–220点/秒)远低于处理器的运行频率,导致处理器在等待下一个坐标点时处于空闲状态,而绘制阶段又因计算和渲染耗时,造成笔尖物理位置与屏幕轨迹不同步,产生视觉延迟
[0006]The beneficial effects of this invention are as follows: By acquiring real-time sampling points from the pen tip, a data foundation is established for subsequent processing. If no new sampling point is received within the sampling interval and the prediction conditions are met, prediction is made based on historical trajectory points and immediately pre-drawn on the front end. This shifts the drawing timing from traditional post-sampling drawing to pre-sampling, fully utilizing the processor's idle window and fundamentally eliminating visual delays caused by waiting for actual sampling points. When a new sampling point arrives, the predicted point and the actual point are fused and corrected to generate the final drawing point on the back end. Real-time calibration ensures consistency between the pre-drawn trajectory and the actual trajectory, preserving the low-latency advantage of pre-drawing while guaranteeing the authenticity and legal validity of the handwriting. Finally, the screen is updated based on the corrected drawing points, outputting a smooth and continuous signature trajectory. Without increasing hardware costs, a dynamic balance between latency compensation and fidelity in signature drawing is achieved, improving writing real-time performance and user experience, and solving the problem of signature trajectory drawing delay caused by the electromagnetic screen sampling frequency being lower than the processor's operating frequency.
Smart Images

Figure CN122526445A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of human-computer interaction technology, and in particular to a signature drawing method and terminal based on trajectory prediction and correction. Background Technology
[0002] In handwritten signature devices (such as bank counter signage), the electromagnetic screen acquires the coordinates of the writing trajectory via an electromagnetic pen. These coordinates are processed by a processor and ultimately drawn into the signature trajectory. However, the sampling frequency of the electromagnetic screen (typically 100–220 points / second) is much lower than the processor's operating frequency. This causes the processor to be idle while waiting for the next coordinate point, while the drawing stage is time-consuming due to calculation and rendering, resulting in a desynchronization between the pen tip's physical position and the screen trajectory, causing visual latency. Related technologies (such as trajectory interpolation or smoothing algorithms) can improve the smoothness of the trajectory, but these are post-hoc compensations and cannot solve the inherent latency problem. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a signature drawing method and terminal based on trajectory prediction and correction, which can eliminate the problem of signature trajectory drawing delay caused by the electromagnetic screen sampling frequency being lower than the processor operating frequency.
[0004] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows: A signature drawing method based on trajectory prediction and correction, characterized in that it includes: Acquire real-time sampling points of the writing pen tip; If no new real-time sampling points are received and the prediction conditions are met, trajectory prediction is performed based on historical trajectory points, prediction points are generated, and pre-drawn on the front end. When the new real-time sampling point arrives, the predicted point is fused and corrected with the new real-time sampling point, and the final drawing point is generated in the backend. Update the signature trajectory on the screen based on the final drawing point.
[0005] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: A signature drawing terminal based on trajectory prediction and correction includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the computer program to implement the various steps of the aforementioned signature drawing method based on trajectory prediction and correction.
[0006] The beneficial effects of this invention are as follows: By acquiring real-time sampling points from the pen tip, a data foundation is established for subsequent processing. If no new sampling point is received within the sampling interval and the prediction conditions are met, prediction is made based on historical trajectory points and immediately pre-drawn on the front end. This shifts the drawing timing from traditional post-sampling drawing to pre-sampling, fully utilizing the processor's idle window and fundamentally eliminating visual delays caused by waiting for actual sampling points. When a new sampling point arrives, the predicted point and the actual point are fused and corrected to generate the final drawing point on the back end. Real-time calibration ensures consistency between the pre-drawn trajectory and the actual trajectory, preserving the low-latency advantage of pre-drawing while guaranteeing the authenticity and legal validity of the handwriting. Finally, the screen is updated based on the corrected drawing points, outputting a smooth and continuous signature trajectory. Without increasing hardware costs, a dynamic balance between latency compensation and fidelity in signature drawing is achieved, improving writing real-time performance and user experience, and solving the problem of signature trajectory drawing delay caused by the electromagnetic screen sampling frequency being lower than the processor's operating frequency. Attached Figure Description
[0007] Figure 1 This is a flowchart of a signature drawing method based on trajectory prediction and correction according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating a signature drawing method based on trajectory prediction and correction applied to a handwritten signature scenario, according to an embodiment of the present invention. Figure 3 This is a schematic diagram of a signature drawing terminal based on trajectory prediction and correction according to an embodiment of the present invention. Detailed Implementation
[0008] To explain in detail the technical content, objectives, and effects of the present invention, the following description is provided in conjunction with the embodiments and accompanying drawings.
[0009] In existing technologies, handwritten signatures are widely used in scenarios such as financial counters and judicial administration. Users write on an electromagnetic screen using an electromagnetic pen, and the processor collects the coordinates and draws the signature trajectory in real time. However, the sampling frequency of the electromagnetic screen in these technologies is typically 100-220 points / second, far lower than the processor's operating frequency of 2.0GHz or higher. This results in a significant amount of idle waiting time for the processor during the sampling interval. When the sampling point arrives, the processor then performs the drawing and rendering, causing a noticeable visual delay between the physical position of the pen tip and the screen trajectory, affecting the smoothness of writing and the user experience. Traditional solutions such as trajectory interpolation or smoothing algorithms are all post-compensation methods and cannot fundamentally eliminate the inherent delay between sampling and drawing, nor can they meet the stringent requirements for the authenticity and non-repudiation of handwriting in financial and judicial scenarios.
[0010] To at least address the aforementioned issues, the pen tip's sampling points are acquired in real time. During the idle time while waiting for the next sampling point, the pen tip's upcoming position is predicted based on existing historical trajectory points, and this predicted point is immediately drawn on the screen, enabling advance display of the handwriting. When the actual sampling point arrives, the previously predicted point is fused and calibrated with the actual sampling point to calculate a more accurate position before redrawing. This method eliminates the delay in signature trajectory drawing caused by the electromagnetic screen's sampling frequency being lower than the processor's operating frequency, improving the user's writing real-time performance and experience.
[0011] The following details a signature drawing method based on trajectory prediction and correction according to the present invention. Please refer to [link / reference]. Figure 1 This includes steps 110 to 140: Step 110: Obtain real-time sampling points of the handwriting.
[0012] Specifically, in handwritten signature scenarios such as financial counters and judicial and government affairs, users write on an electromagnetic screen using an electromagnetic pen, and the information is reported to the processor in real time through an interface. The processing area obtains real-time sampling points as raw data for subsequent processing, which is used for trajectory prediction and correction.
[0013] Step 120: If no new real-time sampling point is received and the prediction conditions are met, then trajectory prediction is performed based on historical trajectory points, prediction points are generated, and pre-drawn on the front end.
[0014] Specifically, when the system is in drawing mode and has not received new sampling points, the processor uses this idle window to predict the trajectory based on historical trajectory points. The system generates predicted points and displays the handwriting on the front-end screen in advance through pre-drawing, visually eliminating the sense of delay caused by waiting for actual sampling points.
[0015] Step 130: When a new real-time sampling point arrives, the predicted point is fused and corrected with the new real-time sampling point, and the final drawing point is generated in the backend.
[0016] Specifically, when a new real-time sampling point arrives, the processor merges and corrects the predicted point and the actual sampling point, and generates the final drawing point that merges the predicted point and the actual sampling point in the backend, thereby realizing real-time calibration of the pre-drawn trajectory.
[0017] Step 140: Update the signature trajectory on the screen based on the final drawing point.
[0018] Specifically, the processor sends the generated final drawing point to the graphics rendering engine to overwrite or correct the previously pre-drawn trajectory on the screen, ensuring that the signature trajectory persistently displayed on the screen is highly consistent with the actual writing trajectory. At the same time, the drawing point is stored in the historical trajectory cache queue as the data basis for subsequent prediction cycles.
[0019] As described above, this invention establishes a data foundation for subsequent processing by acquiring real-time sampling points from the pen tip. Within the sampling interval, if no new real-time sampling point is received, prediction is made based on historical trajectory points, and pre-drawing is immediately performed on the front end. Trajectory prediction and pre-drawing are performed within an idle window, shifting the note-taking timing forward and fundamentally eliminating visual delays caused by waiting for actual sampling points. When a new sampling point arrives, the predicted point and the actual sampling point are dynamically weighted and fused to calibrate the pre-drawn trajectory in real time, reducing trajectory distortion while maintaining low latency. Finally, the screen is updated based on the corrected drawing points, outputting a smooth and continuous signature trajectory. Without increasing hardware costs, a dynamic balance between latency compensation and fidelity in signature drawing is achieved, improving writing real-time performance and user experience, and meeting the stringent requirements for handwriting authenticity and non-repudiation in financial, judicial, and other scenarios.
[0020] Furthermore, steps 121 and 122 are included before step 120.
[0021] Step 121: Monitor the pen tip's motion data in real time, and determine the current system state based on the motion data and preset state switching rules; the system state includes drawing state and non-drawing state.
[0022] Specifically, during the signature drawing process, the processor continuously collects the pen tip's movement data and dynamically determines the current operating mode of the system based on preset state switching rules. The system has two states: drawing state and non-drawing state. Through intelligent management by the state machine, the system can adapt to different writing scenarios, avoiding resource waste or trajectory jitter caused by using prediction unnecessarily.
[0023] Step 122: When the system is in the drawing state, it is determined that the prediction conditions are met.
[0024] Specifically, once the system is in a drawing state, the processor confirms that the current conditions for enabling trajectory prediction are met. By using the drawing state as the admission condition for prediction, the prediction mechanism is ensured to be enabled only during the effective writing phase when the pen tip is continuously moving. This ensures both the delay compensation effect and avoids misprediction in scenarios such as when the pen is stationary or lifted.
[0025] As described above, by introducing a state management mechanism, the system state is dynamically switched based on pen tip movement data, and the drawing state is used as the admission condition for prediction, thus achieving scenario-adaptive activation of the prediction mechanism. Through the collaboration of the state machine and the prediction mechanism, the system can maintain stable and reliable drawing performance in all scenarios, further improving the robustness of signature drawing and user experience.
[0026] Furthermore, the non-drawing state includes the initial state, the static state, and the pen-lifting state; the motion data includes the number of historical trajectory points, the movement distance between adjacent sampling points, and the pressure sensitivity value; step 121 determines the current system state based on the motion data and the preset state switching rules, including steps 123 to 126.
[0027] Step 123: If the number of historical trajectory points is less than the preset number, the system is in the initial state and draws directly based on the real-time sampling points.
[0028] Specifically, at the initial stage of a user's stroke, the historical trajectory point cache queue has not yet accumulated enough data points (e.g., less than 2), making effective trajectory prediction impossible. The system determines that it is in the initial state and directly uses the real-time sampling points reported by the electromagnetic screen for drawing, avoiding prediction deviations due to insufficient historical data, while eliminating the delay in the first stroke and ensuring that the handwriting can be displayed instantly upon the moment the pen is placed.
[0029] Step 124: If the moving distance between consecutive historical trajectory points is less than the activity threshold, the system is in a static state and is drawn directly based on the real-time sampling points.
[0030] Specifically, when a user pauses or writes carefully, and the pen tip moves less than a set activity threshold, the system determines that the writing is stationary. In this case, the trajectory prediction function is disabled, and the writing is directly drawn based on real-time sampling points. This avoids trajectory swaying or resource waste caused by the prediction algorithm being overly sensitive to minute fluctuations, ensuring stable display of static handwriting.
[0031] Step 125: If the moving distance between consecutive historical trajectory points is greater than or equal to the activity threshold, the system switches to drawing mode.
[0032] Specifically, when the pen tip moves continuously and the displacement between adjacent historical trajectory points reaches or exceeds a preset activity threshold, it indicates that the user is performing a valid writing operation. The system automatically switches to drawing mode, enables trajectory prediction and correction processes, and performs pre-drawing within the sampling interval to compensate for latency, achieving real-time tracking of the handwriting.
[0033] Step 126: If the pressure sensitivity value is detected to be continuously lower than the pressure sensitivity threshold, it is determined to be a pen lift event, the system enters the pen lift state, and clears the historical trajectory points.
[0034] Specifically, when the stylus is lifted off the screen, the pressure sensor detects that the pressure value remains below a preset threshold, and the system determines that a pen-lifting event has occurred. At this point, the system enters a pen-lifting state, immediately clearing the historical trajectory point cache queue to avoid carrying the trajectory data of the previous stroke into the next stroke and causing interference, while also preventing ghost trajectory phenomena caused by residual data.
[0035] As described above, a complete signature drawing state machine is constructed by defining four system states: initial state, static state, drawing state, and pen-lifting state, along with their corresponding switching rules. In the initial state, when the number of historical trajectory points is insufficient, drawing is performed directly based on real-time sampling points, effectively ensuring a rapid response for the first stroke upon pen placement and avoiding initial delays caused by waiting for historical data accumulation. In the static state, when the pen tip movement distance is less than the activity threshold, the prediction function is disabled, and actual sampling points are drawn directly, avoiding trajectory wobbling caused by the prediction algorithm's oversensitivity to minor jitters, ensuring handwriting stability during fine writing or pauses. In the drawing state, when the pen tip moves continuously, the trajectory prediction and correction process is activated, pre-drawing is performed within the sampling interval to compensate for the inherent delay between sampling and display, achieving real-time handwriting tracking. In the pen-lifting state, when the pressure sensitivity value is detected to be continuously below the threshold, historical trajectory points are promptly cleared, completely eliminating interference from residual data from the previous stroke to the next stroke, preventing the generation of ghost trajectories. The four states are intelligently switched based on motion data such as the number of historical trajectory points, movement distance, and pressure sensitivity value, enabling the system to adapt to different writing stages such as pen placement, writing, pausing, and pen lifting. It can maintain stable and reliable drawing performance throughout the entire process, effectively improving the stability, accuracy, and scene adaptability of the signature trajectory.
[0036] Further, step 120 performs trajectory prediction based on historical trajectory points, generates predicted points, and pre-draws them on the front end, including steps 1201 and 1202. Step 1201: Obtain the two most recent historical trajectory points.
[0037] Specifically, when the system is in drawing mode and enters an idle window within the sampling interval, the processor reads the two most recent historical trajectory points. Using the two most recent points as input for prediction reflects the current movement trend of the pen tip while avoiding excessive computational complexity caused by introducing too much historical data.
[0038] Step 1202: Based on the assumption of uniform motion, the predicted point is generated by calculating the displacement vectors of the two most recent historical trajectory points using the linear extrapolation method.
[0039] Specifically, based on the objective law that the pen tip's movement speed does not change significantly within a short period during writing, this method uses the assumption of uniform motion for trajectory prediction. The processor calculates the displacement vector between the two most recent historical trajectory points. Assuming the pen tip continues to maintain the same movement speed and direction in the next sampling period, the coordinates of the predicted point are obtained by adding this displacement vector to the latest point. This linear extrapolation method has extremely low computational cost, which can be completed within microseconds, perfectly matching the timing requirements of the processor's idle window. After generating the predicted point, the system immediately sends it to the graphics engine for pre-drawing, enabling the early display of the handwriting.
[0040] As described above, the linear extrapolation method based on the two most recent historical trajectory points is used for trajectory prediction, which fully utilizes the processor's idle window computing resources. This method requires only simple addition and subtraction operations, resulting in low computational complexity and fast response speed. It can generate prediction points and complete pre-drawing within microseconds, effectively compensating for the rendering delay caused by the mismatch between the sampling frequency and the processor's operating frequency. Furthermore, the prediction model based on the assumption of uniform motion conforms to the motion law of handwritten signatures, maintaining high prediction accuracy in most writing scenarios, providing a solid data foundation for subsequent dynamic correction.
[0041] Further, step 1202, which calculates the predicted point based on the displacement vectors of the two most recent historical trajectory points, includes step 1203.
[0042] Step 1203,
[0043]
[0044]
[0045]
[0046] in, Let x be the displacement vector along the x-axis. This is the displacement vector along the y-axis. For prediction points x-axis coordinates For prediction points y-axis coordinate, The coordinates of the most recent historical trajectory point on the x-axis. The coordinates of the second most recent historical trajectory point on the x-axis. The coordinates of the second most recent historical trajectory point on the x-axis. The coordinates of the second most recent historical trajectory point on the y-axis.
[0047] Specifically, in obtaining the two most recent historical trajectory points and Next, the processor calculates the coordinates of the predicted point based on the assumption of uniform motion. First, it calculates... Compared to Displacement components along the x and y axes: The displacement vector is located in the x-axis direction. This is the displacement vector along the y-axis, reflecting the direction and magnitude of the pen tip's movement within the most recent sampling period. Based on the assumption that the pen tip's movement trend remains constant over a short period, this displacement vector is superimposed onto the current trajectory point. By extrapolating from the above, the predicted point coordinates for the next acquisition time can be obtained. On the x-axis, the predicted point coordinates equal the x-coordinate of the most recent historical trajectory point plus the x-axis displacement component; on the y-axis, the predicted point coordinates equal the y-coordinate of the most recent historical trajectory point plus the y-axis displacement component. Using the above linear extrapolation formula, the predicted points can be generated quickly. .
[0048] The calculation formula involves only addition and subtraction, requiring minimal computation and can be completed within microseconds, perfectly matching the timing requirements of the processor's idle window. After generating the prediction points, the system immediately sends them to the graphics engine for pre-drawing, enabling the handwriting to be displayed in advance.
[0049] As described above, trajectory prediction based on the two most recent historical trajectory points is achieved through a simple linear extrapolation formula. This formula has a clear physical meaning, extrapolating historical displacement trends to future moments based on the assumption of uniform motion, which aligns with the objective laws of pen tip movement during handwritten signatures. The calculation process involves only addition and subtraction, requiring no complex matrix operations or iterative convergence, minimizing computational overhead while ensuring prediction accuracy and fully utilizing the idle window resources within the processor's sampling interval. Using this prediction formula, the system can generate predicted points and complete pre-drawing within microseconds, effectively compensating for the drawing delay caused by the mismatch between the electromagnetic screen sampling frequency and the processor's operating frequency, laying the algorithmic foundation for improving the real-time performance of signature drawing.
[0050] Further, step 130 includes steps 131 to 133.
[0051] Step 131: Calculate the Euclidean distance between the predicted point and the new real-time sampling point.
[0052] Specifically, when a new real-time sampling point arrives, the processor retrieves the previously generated predicted point and calculates the Euclidean distance between them. The Euclidean distance is calculated using the following formula: distance equals the sum of the predicted point's x-coordinate minus the square of the actual sampling point's x-coordinate, plus the sum of the predicted point's y-coordinate minus the square of the actual sampling point's y-coordinate, and then the square root of the sum. This distance reflects the degree of deviation between the predicted point and the actual sampling point. The smaller the distance, the more accurate the prediction; the larger the distance, the greater the prediction deviation, which may indicate a sudden change in writing direction or speed. This deviation value will serve as the core basis for subsequent dynamic weight calculations.
[0053] Step 132: Calculate the fusion weight based on the Euclidean distance. The fusion weight is inversely proportional to the Euclidean distance.
[0054] Specifically, the processor dynamically calculates the fusion weights based on the calculated Euclidean distance. The weight calculation follows the rule that the weight equals the maximum of 0 and 1 minus the distance divided by a preset threshold, where the preset threshold is a pre-defined distance threshold. This rule establishes a negative correlation between the weight and the deviation. When the distance is less than the preset threshold, the weight ranges from 0 to 1, with the weight closer to 1 as the distance decreases. When the distance is greater than or equal to the preset threshold, the weight is 0. This dynamic allocation strategy allows the system to adaptively adjust the level of trust in the predicted points based on the prediction accuracy. When the prediction is accurate, it relies more on the predicted points to maintain the delay compensation effect; when the prediction deviation is too large, it fully trusts the actual sampled points to avoid trajectory distortion.
[0055] Step 133: Based on the fusion weights, perform a weighted summation of the predicted points and the new real-time sampling points to obtain the final drawing points.
[0056] Specifically, the processor calculates the final drawing point using a weighted summation formula based on the calculated fusion weights. The final drawing point equals the weight multiplied by the predicted point plus one minus the weight multiplied by the actual sampled point. When the weight is close to 1, the final drawing point is mainly contributed by the predicted point, maintaining the low latency advantage of pre-drawing. When the weight is close to 0, the final drawing point is mainly contributed by the actual sampled point, ensuring that the trajectory is consistent with the actual writing. When the weight takes an intermediate value, the final drawing point integrates information from the predicted point and the actual point, achieving a smooth transition. After generating the final drawing point, the system uses it for subsequent trajectory rendering and stores it in the historical trajectory cache queue as the data basis for the next prediction cycle.
[0057] As described above, the dynamic correction between predicted and actual sampling points is achieved through three steps: calculating the deviation, assigning weights, and weighted fusion. First, the Euclidean distance is calculated to quantify the prediction deviation. Then, fusion weights are dynamically assigned based on the deviation. Finally, the optimal drawing point is generated through weighted summation. The core advantage of this correction mechanism lies in its dynamic adaptability. When the prediction is accurate, it trusts the prediction to maintain low latency; when the prediction deviation is large, it reverts to reality to ensure fidelity, achieving a dynamic balance between latency compensation and trajectory authenticity. In this way, the system fully utilizes the real-time performance improvement brought by the prediction mechanism while controlling the trajectory distortion rate at a low level through real-time calibration of actual sampling points, meeting the stringent requirements for handwriting authenticity in financial and judicial scenarios.
[0058] Furthermore, step 133 includes steps 134 and 135.
[0059] Step 134,
[0060] in, For weight fusion, D is the Euclidean distance between the predicted point and the new real-time sampling point. This is the preset distance threshold.
[0061] Specifically, after obtaining the Euclidean distance D between the predicted points and the actual sampled points, the processor dynamically calculates the fusion weights according to the formula. The design principle of this formula is: when the prediction bias D is small, A larger value for D indicates a more accurate prediction, and the predicted points should be assigned a higher weight; when D approaches 0... Approaching 1, the predicted point is almost completely trusted; as D gradually increases, The linear decrease occurs when D reaches or exceeds the preset threshold (Threshold). When it becomes negative, it takes the maximum value of 0, i.e. The actual sampling points are fully trusted. The max function ensures that the weights are always within the range of [0, 1]. The preset threshold Threshold can be adapted according to factors such as screen resolution and stroke width, for example, it can be set to 1.5 to 2 times the average stroke width, or fixed at 5 pixels, to balance the prediction confidence and distortion control requirements.
[0062] Step 135, the final drawing point is calculated using the following formula:
[0063] in, For the final drawing point, For the prediction point, This is the new real-time sampling point.
[0064] Specifically, the processor will calculate the fusion weights Substitute into the weighted summation formula to generate the final plotting points. The physical meaning of this formula is: the final plotted point is a convex combination of the predicted point and the actual sampled point, with weights... This determines the contribution of the prediction point. When hour, When the final drawing points are all based on the predicted points, the system relies entirely on the prediction results for drawing, resulting in the best delay compensation effect; when hour, The final drawing points are all based on actual sampling points. At this point, the system reverts to the traditional drawing mode to ensure the trajectory is absolutely realistic; when 0 < When the value is less than 1, the final drawn point integrates information from the predicted point and the actual point, achieving a smooth transition from prediction to reality. After generating the final drawn point, the system sends it to the graphics engine for final drawing, updating the signature trajectory on the screen; at the same time, it stores it in the historical trajectory cache queue as the data basis for subsequent prediction cycles, forming a complete closed-loop feedback.
[0065] As described above, a complete dynamic weighted fusion mechanism is constructed using weight calculation and weighted summation formulas. The weight calculation formula achieves adaptive adjustment of the fusion weights and prediction deviations through a negative correlation. When the prediction is accurate, the predicted points are given high weights to maintain low latency; when the prediction deviation is large, the weights are automatically reduced until they reach zero, ensuring that the trajectory is not distorted. The weighted summation formula performs a convex combination of the predicted points and the actual sampling points to generate the final drawing points, which have both low latency and high fidelity. The core innovation of this mechanism lies in introducing the feedforward feedback concept from control theory into the field of signature drawing. The predicted points provide feedforward compensation for latency, while the actual sampling points provide feedback to correct deviations. The two work together to achieve a dynamic balance between real-time performance and accuracy, providing technical support for handwritten signatures in high-requirement scenarios such as finance and justice.
[0066] Furthermore, step 133 also includes steps 1331 and 1332.
[0067] Step 1331: Obtain the pressure sensitivity data or writing speed data of the pen tip.
[0068] Specifically, during the signature drawing process, the electromagnetic screen controller reports not only the coordinates of the pen tip but also pressure-sensitive data simultaneously. The processor reads this pressure value in real time via the I²C interface, reflecting the force applied by the pen tip in contact with the screen. Simultaneously, the processor calculates the writing speed, including instantaneous speed and average speed, based on the displacement and time differences between consecutive sampling points. The instantaneous speed is calculated based on the Euclidean distance between adjacent sampling points and the sampling interval, while the average speed is calculated based on the cumulative displacement and time of multiple sampling points within a historical window. This pressure-sensitive and speed data reflects the pen tip's writing state from different dimensions and can serve as auxiliary information for fusion correction.
[0069] Step 1332: Adjust the fusion weights using pressure sensitivity data or writing speed data as auxiliary factors.
[0070] Specifically, the processor incorporates the acquired pressure-sensitive data or writing speed data into the calculation of the fusion weights, dynamically adjusting the base weights calculated based on Euclidean distance. As one implementation, when a drastic change in pressure sensitivity is detected, it indicates that the user may be lifting or lowering the pen. In this case, the fusion weights can be appropriately reduced to decrease the contribution of predicted points and avoid trajectory anomalies caused by sudden pressure changes. As another implementation, when the writing speed is fast, the fusion weights can be appropriately increased, relying more on predicted points to enhance latency compensation; when the writing speed is slow, the fusion weights can be appropriately decreased, relying more on actual sampling points to ensure the accuracy of fine writing.
[0071] The processor calculates the writing speed in real time, including instantaneous speed and average speed. Instantaneous speed is calculated based on the displacement difference and time difference between consecutive sampling points, using the following formula: ,in, Instantaneous velocity For continuous points, Euclidean distance. The time interval is defined as the average velocity, calculated based on 3 to 8 sampling points within a historical window, as the ratio of average displacement to average time.
[0072] To further enhance the adaptability of prediction and correction, the system dynamically adjusts the cache queue size N based on the quantitative evaluation results of writing speed. The overall speed is calculated by weighting the instantaneous speed and the average speed: Overall Speed = w1 × Instantaneous Speed + w2 × Average Speed. The weights w1 and w2 are used to balance the relative importance of different speed indicators in the overall evaluation and can be preset according to the application scenario, as shown in Table 1.
[0073] Table 1. Overall Speed Weighting Configuration Table
[0074] The dynamic adjustment of the cache queue size N is based on an intelligent adaptive mechanism that uses quantitative evaluation of writing speed. Its core design philosophy is to dynamically optimize the working parameters of the prediction algorithm by monitoring writing speed characteristics in real time, thereby maximizing system response speed while ensuring prediction accuracy. Specific adjustment rules are shown in Table 2.
[0075] Table 2. Dynamic Adjustment Table for Cache Queue Size
[0076] As a preferred implementation, the system can also dynamically adjust the distance threshold Threshold in the fusion weight calculation formula according to the writing speed. When the speed is faster, the threshold is appropriately increased to enhance the prediction effect, and when the speed is slower, the threshold is appropriately decreased to enhance the effect of the real sampling point.
[0077] As described above, based on the Euclidean distance-based fusion weight calculation, pressure-sensitive data and writing speed data are further introduced as auxiliary adjustment factors. This optimization mechanism enables the system to perceive richer writing state information: pressure-sensitive data reflects changes in pen tip contact force and can be used to identify special events such as pen lifting and pen lowering; speed data reflects writing speed and can be used to dynamically balance latency compensation and the need for fine writing. Simultaneously, through comprehensive speed weight configuration, targeted optimizations for different application scenarios are achieved. By integrating multi-dimensional sensing data into weight decision-making, the scenario adaptability and robustness of the fusion correction algorithm are further enhanced, enabling it to maintain a balance between low latency and high fidelity under more varied writing conditions, thus improving the intelligence level and practical value of the signature drawing method.
[0078] Furthermore, step 110 is followed by steps 1101 and 1102.
[0079] Step 1101: Perform low-pass filtering on the acquired real-time sampling points.
[0080] Specifically, during the process of acquiring pen tip coordinates, the electromagnetic screen may introduce high-frequency noise due to inherent hardware or external electromagnetic interference, causing slight jitter in the original sampling points. If unfiltered raw data is used directly for trajectory prediction, this noise may be amplified by the prediction algorithm, resulting in prediction bias or an uneven trajectory. Therefore, after acquiring real-time sampling points, the processor first performs low-pass filtering. As one implementation method, a moving average method can be used, weighting the current sampling point with several previous sampling points to suppress high-frequency noise components. Filtering effectively smooths the sampling data, making the historical trajectory point sequence more stable and reliable, providing a high-quality data foundation for subsequent prediction and correction.
[0081] Step 1102: Store the filtered real-time sampling points into a first-in-first-out (FIFO) buffer queue for subsequent trajectory prediction and correction.
[0082] Specifically, the real-time sampling points, after low-pass filtering, are stored in a fixed-capacity, first-in-first-out (FIFO) buffer queue. This queue employs a FIFO mechanism, always storing the N most recent filtered sampling points; for example, N can be set to 5. When a new filtered point is stored, the oldest sampling point in the queue is automatically removed, ensuring that the queue always maintains the latest historical trajectory information. During the trajectory prediction phase, the processor reads the two most recent historical trajectory points from this queue as input for prediction. During the dynamic correction phase, new real-time sampling points are also filtered before being stored in the queue to update the historical trajectory sequence. Through the cyclical updating of the buffer queue, the system can continuously track the latest movement trend of the pen tip, providing continuous and stable data support for the prediction correction algorithm.
[0083] As described above, by introducing low-pass filtering before storing the sampling points in the buffer, high-frequency noise interference during the electromagnetic screen acquisition process is effectively suppressed, improving the stability and reliability of historical trajectory data. The filtered sampling points are stored in a first-in, first-out (FIFO) buffer queue, ensuring that the data used for prediction is always the most recent optimal data, and preventing the unlimited growth of historical data through the queue's automatic update mechanism. This preprocessing mechanism lays a high-quality data foundation for subsequent trajectory prediction and dynamic correction, avoiding prediction bias and trajectory jitter caused by noise amplification, and further improving the smoothness and accuracy of signature drawing.
[0084] Please refer to Figure 2 In one embodiment of the present invention, a signature drawing process based on trajectory prediction and correction is demonstrated. Taking a handwritten signature scenario at a financial counter as an example, the process specifically includes steps S201 to S204.
[0085] S201. During the signature drawing process, the processor continuously collects motion data such as the coordinate sequence of the pen tip, the moving distance between adjacent sampling points, and the pressure sensitivity value. The system dynamically determines the current operating mode according to the preset state transition rules: when the number of historical trajectory points is less than the preset number (e.g., 2), the system is in the initial state; when the moving distance between consecutive sampling points is less than the activity threshold, the system is in the stationary state; when the moving distance between consecutive sampling points is greater than or equal to the activity threshold, the system switches to the drawing state; when it is detected that the pressure sensitivity value continuously drops below the pressure sensitivity threshold, it is determined as a pen-lifting event, and the system enters the pen-lifting state and clears the historical trajectory points. Through the intelligent management of the state machine, the system can adapt to different writing scenarios, avoiding resource waste or trajectory jitter caused by enabling prediction under unnecessary circumstances. This is equivalent to steps 121 and 123 to 126 above.
[0086] S202. The system first determines whether it is currently in the drawing state. If it is in a non-drawing state, it directly jumps to S204 to perform drawing based on the actual sampling points. If it is in the drawing state, it further determines whether a new real-time sampling point has been reached: if a new sampling point has been reached, the fusion correction process is executed; if a new sampling point has not been reached and it is in the idle window within the sampling interval, trajectory prediction and pre-drawing are performed. This is equivalent to steps 120 and 122 above.
[0087] S203. When the system is in the drawing state and enters the idle window within the sampling interval, the processor obtains the two most recent historical trajectory points from the first-in-first-out cache queue and , and based on the assumption of uniform motion, uses the linear extrapolation method to calculate the displacement vector: and , and then generates the predicted point coordinates at the back end: , , and immediately sends this predicted point to the graphics engine for pre-drawing. By pre-drawing, the handwriting is displayed on the screen in advance, visually eliminating the sense of delay caused by waiting for the actual sampling points. This is equivalent to steps 1201 to 1203 above.
[0088] S204. When the new real-time sampling point arrives, the processor calculates the Euclidean distance D between the predicted point and the actual sampling point, and dynamically calculates the fusion weight according to the distance, following the principle, where Threshold is the preset distance threshold (e.g., 5 pixels). When D < Threshold, takes a value between 0 and 1, and the smaller D is , the closer it is to 1, and the more the drawing result trusts the predicted point; when D ≥ Threshold, The value is set to 0, indicating complete trust in the actual sampling points. Then, a weighted summation formula is used. Generate final drawing points This final drawing point retains the low-latency advantage of pre-drawing while ensuring the authenticity of the trajectory through calibration using actual sampling points. Subsequently, the processor will draw the final point... The data is sent to the graphics rendering engine to update the screen trajectory and stored in the historical trajectory cache queue as the data basis for subsequent prediction cycles. This is equivalent to steps 131 to 135 and step 140 above.
[0089] Through the above steps, a complete closed loop is achieved, which includes pre-drawing within the sampling interval to eliminate latency and fusion correction after the arrival of new points to ensure authenticity. The system intelligently switches working modes based on the pen tip movement state. In drawing mode, it makes full use of the processor's idle window for predictive drawing, while in non-drawing mode, it draws directly to avoid resource waste. Ultimately, this improves the real-time performance and user experience of signature drawing without increasing costs.
[0090] Please refer to Figure 3 The present invention also provides a signature drawing terminal 1 based on trajectory prediction and correction, including a memory 2, a processor 3, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the various steps of the signature drawing method based on trajectory prediction and correction as described above.
[0091] In summary, this invention realizes a signature drawing method and terminal based on trajectory prediction and correction, which fundamentally solves the problem of trajectory drawing delay caused by the electromagnetic screen sampling frequency being lower than the processor operating frequency, and meets the stringent requirements of real-time performance and non-repudiation of handwriting in scenarios such as finance and judiciary.
[0092] Specifically, within the processor's inherent sampling interval idle window, a lightweight linear extrapolation method is used to predict and immediately pre-draw the trajectory, shifting the drawing timing forward and avoiding the visual delay caused by waiting for actual sampling points in traditional solutions. By designing a dynamic weighted fusion algorithm based on Euclidean distance, the system can adaptively adjust the fusion weights according to the prediction deviation. When the prediction is accurate, the prediction is trusted to maintain the low latency advantage; when the prediction deviation is large, the system reverts to the actual sampling points to ensure trajectory fidelity, keeping the trajectory distortion rate within 5%. Simultaneously, the system introduces a four-state machine management mechanism, intelligently switching between initial, static, drawing, and pen-lifting states based on pen tip movement data. This allows the system to adapt to all scenarios, including pen placement, writing, pausing, and pen lifting. In non-drawing states, prediction is disabled to avoid resource waste and trajectory jitter; in pen-lifting states, historical data is cleared promptly to prevent ghost trajectories. This eliminates the problem of signature trajectory drawing delay caused by the electromagnetic screen sampling frequency being lower than the processor's operating frequency.
[0093] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A signature drawing method based on trajectory prediction and correction, characterized in that, include: Acquire real-time sampling points of the writing pen tip; If no new real-time sampling points are received and the prediction conditions are met, trajectory prediction is performed based on historical trajectory points, prediction points are generated, and pre-drawn on the front end. When the new real-time sampling point arrives, the predicted point is fused and corrected with the new real-time sampling point, and the final drawing point is generated in the backend. Update the signature trajectory on the screen based on the final drawing point.
2. The signature drawing method based on trajectory prediction and correction according to claim 1, characterized in that, If no new real-time sampling point is received and the prediction conditions are met, before performing trajectory prediction based on historical trajectory points, generating prediction points, and pre-drawing them on the front end, the method further includes: The system monitors the movement data of the pen tip in real time and determines the current system state based on the movement data and preset state switching rules; the system state includes drawing state and non-drawing state. When the system is in the drawing state, it is determined that the prediction condition is met.
3. The signature drawing method based on trajectory prediction and correction according to claim 2, characterized in that, The non-drawing states include the initial state, the stationary state, and the pen-lifting state; the motion data includes the number of historical trajectory points, the movement distance between adjacent sampling points, and the pressure sensitivity value. The process of determining the current system state based on motion data and preset state switching rules includes: If the number of historical trajectory points is less than the preset number, the system is in the initial state and draws directly based on the real-time sampling points; If the moving distance between consecutive historical trajectory points is less than the activity threshold, the system is in the stationary state and the drawing is performed directly based on the real-time sampling points; If the moving distance between consecutive historical trajectory points is greater than or equal to the activity threshold, the system switches to the drawing state. If the pressure sensitivity value is detected to be continuously lower than the pressure sensitivity threshold, it is determined to be a pen lift event. The system enters the pen lift state and clears the historical trajectory points.
4. The signature drawing method based on trajectory prediction and correction according to claim 1, characterized in that, The process of predicting trajectories based on historical trajectory points, generating predicted points, and pre-drawing them on the front end includes: Obtain the two most recent historical trajectory points; Based on the assumption of uniform motion, the predicted point is generated by linear extrapolation based on the displacement vectors of the two most recent historical trajectory points.
5. The signature drawing method based on trajectory prediction and correction according to claim 4, characterized in that, The step of generating the predicted point based on the displacement vectors of the two most recent historical trajectory points includes: in, Let x be the displacement vector along the x-axis. This is the displacement vector along the y-axis. For the prediction point x-axis coordinates For the prediction point y-axis coordinate, The coordinates of the most recent historical trajectory point on the x-axis. The coordinates of the second most recent historical trajectory point on the x-axis. The coordinates of the most recent historical trajectory point on the y-axis. The coordinates of the second most recent historical trajectory point on the y-axis.
6. The signature drawing method based on trajectory prediction and correction according to claim 1, characterized in that, The step of fusing and correcting the predicted point with the new real-time sampling point after the new real-time sampling point arrives, and generating the final drawing point in the backend, includes: Calculate the Euclidean distance between the predicted point and the new real-time sampling point; The fusion weight is calculated based on the Euclidean distance, and the fusion weight is inversely proportional to the Euclidean distance; Based on the fusion weights, the predicted points and the new real-time sampling points are weighted and summed to obtain the final drawing points.
7. The signature drawing method based on trajectory prediction and correction according to claim 6, characterized in that, The step of weighted summation of the predicted point and the new real-time sampling point according to the fusion weight to obtain the final drawn point includes: Among them, the The fusion weights are defined as follows: D is the Euclidean distance between the predicted point and the new real-time sampling point. This is a preset distance threshold; The final drawing point is calculated using the following formula: in, For the final drawing point, For the predicted point, This refers to the new real-time sampling point.
8. The signature drawing method based on trajectory prediction and correction according to claim 6, characterized in that, The step of weighted summation of the predicted point and the new real-time sampling point according to the fusion weight to obtain the final drawn point further includes: Obtain pressure sensitivity data or writing speed data from the pen tip; The pressure sensitivity data or the writing speed data are used as auxiliary factors to adjust the fusion weight.
9. The signature drawing method based on trajectory prediction and correction according to claim 1, characterized in that, After acquiring the real-time sampling point of the writing pen tip, the method further includes: The acquired real-time sampling points are subjected to low-pass filtering. The filtered real-time sampling points are stored in a first-in-first-out (FIFO) buffer queue for subsequent trajectory prediction and correction.
10. A signature drawing terminal based on trajectory prediction and correction, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements each step of the signature drawing method based on trajectory prediction and correction as described in any one of claims 1 to 9.