A method and device for determining writing direction based on single-character stroke features

By using a writing direction determination method based on the stroke features of a single character, the system acquires the coordinate point sequence of the stylus in real time, calculates and weights the score to determine the writing direction, solves the technical problems existing in the prior art, realizes the instant determination of the writing direction of a single character, and improves the real-time performance and accuracy of recognition.

CN122369034APending Publication Date: 2026-07-10GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-20
Publication Date
2026-07-10

AI Technical Summary

Technical Problem

Existing technologies require waiting for the layout of multiple characters when determining the writing direction, resulting in response delays and failure of single-character recognition, thus failing to achieve real-time response.

Method used

The method for real-time writing direction determination based on single-character stroke features obtains the stylus coordinate point sequence in real time, calculates the character's geometric aspect ratio, pen stroke axis direction, and stroke density distribution features, and then performs weighted scoring to determine the writing direction.

Benefits of technology

It enables real-time determination of the writing direction of individual characters, avoiding response delays and character recognition failures, improving the real-time performance and accuracy of recognition, and adapting to different writing habits and fonts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122369034A_ABST
    Figure CN122369034A_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for real-time writing direction determination based on single-character stroke features. The method includes: acquiring a sequence of coordinate points of a stylus on a whiteboard in real time; calculating a feature set representing the writing features of a single character based on the coordinate point sequence; calculating a horizontal comprehensive score by weighting the feature set; calculating a vertical comprehensive score by weighting the reciprocals of each feature in the feature set; and determining the writing direction of the stylus based on the horizontal and vertical comprehensive scores to obtain a determination result. This invention proposes a method and apparatus for real-time writing direction determination based on single-character stroke features. It calculates a feature set and calculates a weighted score based on the single-character stroke features in real time to determine the writing direction, without relying on multi-character layouts, thus avoiding response delays at the source and enabling independent and effective recognition of single characters. Therefore, it can solve the problems of response delays and single-character recognition failures caused by existing technologies that rely on multi-character layouts to determine writing direction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text processing, and in particular to a method and apparatus for real-time determination of writing direction based on the stroke characteristics of a single character. Background Technology

[0002] The fields of smart education and meeting / office operations are continuously developing, with intelligence and interactivity becoming the mainstream trends in the industry. Interactive smart whiteboards, with their advantage of adapting to various scenarios, have become mainstream devices in education, teaching, and office collaboration. Current mainstream smart whiteboard products on the market already possess basic handwriting processing capabilities, converting handwriting into standard text, aligning with the overall development environment of popularizing smart education and promoting efficient office work. Existing mainstream multilingual writing processing technologies employ layout analysis, requiring the user to write multiple consecutive characters before calculating the aspect ratio of the smallest bounding rectangle of the overall area formed by these characters to determine the user's writing direction.

[0003] However, the layout analysis method relies on the aspect ratio of the smallest bounding rectangle of the overall area composed of multiple consecutive characters to determine the writing direction, and does not set a real-time direction determination mechanism based on single character features. This method has to wait for multiple characters to be written before it can determine the direction, and cannot respond to single character writing in real time. In addition, there is no multi-character layout reference in the single character scenario, so it cannot accurately determine the direction. Therefore, it cannot solve the problems of response delay and single character recognition failure. Summary of the Invention

[0004] This invention provides a method and apparatus for real-time determination of writing direction based on the stroke features of a single character, in order to solve the problems of response delay and single-character recognition failure caused by the existing technology's reliance on multi-character layout to determine the writing direction.

[0005] To achieve the above objectives, the present invention provides a method for real-time determination of writing direction based on the stroke features of a single character, comprising: Real-time acquisition of the coordinate sequence of the stylus on the whiteboard; Based on the coordinate point sequence, a feature set representing the writing characteristics of a single character is calculated; The horizontal comprehensive score is obtained by weighting the feature set, and the vertical comprehensive score is obtained by weighting the reciprocals of each feature in the feature set. If the horizontal comprehensive score is greater than a preset threshold, and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than a preset difference, the writing direction of the stylus is determined to be horizontal; if the vertical comprehensive score is greater than the preset threshold, and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than the preset difference, the writing direction of the stylus is determined to be vertical.

[0006] This invention acquires the coordinate point sequence of the stylus on the whiteboard in real time. This step enables synchronous data capture during the writing process, solving the response delay problem caused by the need to accumulate multi-character layout data in existing technologies. Based on this, a feature set representing the writing characteristics of a single character is extracted from the coordinate point sequence. This allows focusing on the inherent attributes of a single character's strokes, such as direction, length, and turns. These features are directly related to the writing direction and do not rely on the arrangement rules of multi-character layouts. Even when writing only a single character, effective directional judgment criteria can be extracted, successfully avoiding the single-character recognition failure problem caused by the lack of multi-character layout support in existing technologies. Furthermore, considering the significant horizontal extension and horizontal displacement features in horizontal writing, the horizontal feature weights are amplified through positive weighting to accurately quantify horizontal writing attributes. Conversely, considering the weakened horizontal features in vertical writing, the reciprocal of the features is used to achieve a reverse numerical mapping, transforming weak horizontal features into vertical quantification criteria, and then weighted to obtain a comprehensive vertical score that specifically represents vertical writing attributes. When determining the writing direction as horizontal, the horizontal comprehensive score must simultaneously exceed a preset threshold and be significantly higher than the vertical comprehensive score. This ensures that the horizontal writing features are sufficiently prominent while also guaranteeing that they are significantly superior to the vertical features, avoiding directional confusion. Conversely, when determining the writing direction as vertical, the vertical comprehensive score must simultaneously exceed a preset threshold and be significantly higher than the horizontal comprehensive score. This ensures that the vertical writing features are sufficiently effective while also guaranteeing that they are significantly superior to the horizontal features, eliminating ambiguity in the determination. The entire determination process revolves solely around real-time stroke data for a single character, eliminating the need to wait for the formation of multi-character layouts. This not only ensures stable determination response speed but also reliably achieves effective determination in single-character scenarios, comprehensively and thoroughly solving the core problems existing in current technologies.

[0007] Compared to existing technologies, this invention calculates feature sets in real time based on the stroke features of a single character and determines the writing direction by weighted scoring. It does not rely on the layout of multiple characters, thus avoiding response delay at the source. It can also achieve independent and effective recognition of a single character. Therefore, it can solve the problems of response delay and single character recognition failure caused by existing technologies that rely on the layout of multiple characters to determine the writing direction.

[0008] As a preferred embodiment, the feature set includes character geometric aspect ratio, pen stroke axis direction, and stroke density distribution features; Wherein, the character geometric aspect ratio is the ratio of the width to the height of the smallest bounding rectangle of all strokes of a single character, the pen stroke axis direction is the ratio of the total horizontal displacement to the total vertical displacement plus a preset value when writing a single character, and the stroke density distribution feature is the ratio of the total number of horizontal strokes to the total number of vertical strokes plus a preset value when writing a single character.

[0009] In this preferred scheme, the aspect ratio of characters can intuitively reflect the horizontal or vertical extension trend of a single character as a whole, the direction of the pen stroke axis can reflect the overall pen stroke tendency during the writing process, and the stroke density distribution characteristics can distinguish directional differences from the perspective of stroke composition. The combination of these three factors makes the feature set more representative and comprehensive. At the same time, clarifying the specific definitions of each feature provides a unified standard for feature calculation, improves the standardization and accuracy of feature extraction, provides reliable support for subsequent comprehensive score calculation, and thus improves the accuracy of writing direction determination. This also adapts to the writing habits of different writers and the writing characteristics of different fonts, enhancing the versatility and stability of the method.

[0010] As a preferred embodiment, the method for obtaining the total horizontal displacement and the total vertical displacement is as follows: The coordinate point sequence is sampled at preset time intervals to obtain a sampled point sequence; The horizontal and vertical displacements of adjacent sampling points in the sampling point sequence are calculated respectively to obtain several horizontal displacement values ​​and several vertical displacement values; The absolute values ​​of the plurality of horizontal displacement values ​​and the absolute values ​​of the plurality of vertical displacement values ​​are summed to obtain the total horizontal displacement and the total vertical displacement.

[0011] This preferred solution provides specific methods for obtaining the total horizontal and vertical displacements. By sampling at preset time intervals, it effectively controls the amount of sampled data while ensuring data integrity, avoiding excessive redundant data that would increase the computational burden, thus balancing real-time performance and computational efficiency. By calculating the horizontal and vertical displacements of adjacent sampling points and summing their absolute values, it accurately reflects the overall pen movement amplitude in the horizontal and vertical directions during writing, eliminating irrelevant interference such as minor jitters during writing, making the calculation of the pen movement axis direction more precise. This method is simple to operate, logically clear, requires no complex algorithm support, is easy to implement in engineering, and can quickly output reliable total displacement data, providing a solid foundation for the calculation of the pen movement axis direction characteristics, further improving the real-time performance and accuracy of writing direction determination.

[0012] As a preferred embodiment, the method for obtaining the total number of horizontal strokes and the total number of vertical strokes is as follows: The positions in the coordinate point sequence with curvature greater than a preset value are determined as stroke inflection points, and the coordinate point sequence is divided into several independent strokes based on the stroke inflection points. For each of the aforementioned independent strokes, calculate the angle between the line connecting the start and end points and the horizontal axis to obtain the target angle; Strokes whose target angle is within a preset horizontal angle range are defined as horizontal strokes, and the total number of all horizontal strokes in the plurality of independent strokes is taken as the total number of horizontal strokes; strokes whose target angle is within a preset vertical angle range are defined as vertical strokes, and the total number of all vertical strokes in the plurality of independent strokes is taken as the total number of vertical strokes.

[0013] This optimized approach uses curvature to determine the inflection points of strokes, separating them into independent strokes. This accurately distinguishes different strokes and avoids classification errors caused by stroke adhesion, making it particularly suitable for complex scenarios such as cursive and cursive writing. Horizontal and vertical strokes are classified by calculating the angle between the line connecting the start and end points of the stroke and the horizontal axis. This method is standardized, highly operable, and objectively reflects the actual direction of the strokes, avoiding errors caused by subjective judgment. The method accurately counts the number of horizontal and vertical strokes, making the calculation of stroke density distribution characteristics more scientific, thereby improving the rationality of the overall score. This makes the determination of writing direction more consistent with actual writing logic, reduces misjudgments of direction due to incorrect stroke classification, and enhances the method's adaptability to different writing styles.

[0014] As a preferred solution, the sequence of coordinate points of the stylus on the whiteboard is acquired in real time, specifically: Real-time monitoring of the touch signals of the stylus on the whiteboard, and acquisition of the initial coordinate point sequence corresponding to the touch signals; When the initial coordinate point sequence stops updating, mark the time when the update stops as the completion time; If no new touch signal from the stylus is detected within a preset time window after the completion time, the initial coordinate point sequence is used as the coordinate point sequence; if a new touch signal is detected, the coordinate point sequence corresponding to the new touch signal is merged into the initial coordinate point sequence to obtain the coordinate point sequence.

[0015] This optimized solution effectively addresses the issue of incomplete coordinate point sequences in scenarios such as pauses during single-character writing and continuous writing by monitoring touch signals and setting completion times and preset time windows. After the initial coordinate point sequence stops updating, the time window determines whether a new stroke has occurred. This avoids premature determination of the coordinate point sequence, which could lead to incomplete single-character writing and affect feature extraction and direction determination, while also preventing delayed determination from degrading real-time performance. Simultaneously, incorporating the coordinate point sequence corresponding to the new stroke signal into the initial sequence accurately captures the complete trajectory of continuous writing, ensuring that feature set calculations are based on complete writing data and improving the accuracy of direction determination. This approach adapts to different writing speeds and habits, enhancing the method's practicality and robustness.

[0016] As a preferred embodiment, after obtaining the writing direction determination result of the stylus, the method further includes: If the writing direction of the stylus is horizontal, the handwriting image corresponding to the coordinate point sequence is identified, and the identification result is rendered horizontally. If the writing direction of the stylus is vertical, the handwriting image corresponding to the coordinate point sequence is rotated 90 degrees before recognition, and the recognition result is rendered vertically.

[0017] This optimized solution, after determining the writing direction, performs targeted handwriting recognition and rendering, effectively improving the overall experience and accuracy of handwriting recognition. For horizontal writing, direct recognition and horizontal rendering align with common reading and usage habits, enhancing ease of use. For vertical writing, the handwriting image is rotated 90 degrees before recognition, resolving the issues of low adaptation between stroke direction and recognition model and large recognition errors in direct vertical handwriting recognition, significantly improving the accuracy of vertical writing recognition. Simultaneously, vertical rendering conforms to the reading habits of vertical writing, making the recognition results more intuitive. This achieves accurate recognition and adaptive rendering for both horizontal and vertical writing, expanding the applicable scenarios of handwriting recognition methods, meeting the writing and usage needs of different users, and improving the practicality and user experience of the handwriting recognition system.

[0018] As a preferred embodiment, if both the horizontal and vertical comprehensive scores are less than or equal to a preset threshold, or if the absolute value of the difference between the horizontal and vertical comprehensive scores is less than or equal to a preset difference, the writing situation of the stylus is determined to be a Founder character writing scenario with blurred features, and a preset active prediction logic for the writing direction is triggered.

[0019] This optimized solution considers the scenario of writing square characters with ambiguous features and incorporates an active prediction logic. This effectively solves the problem of inaccurate writing direction determination in such scenarios, improving the method's fault tolerance and adaptability. When the combined scores of horizontal and vertical directions are close or both too low, the method does not forcibly determine the direction but triggers active prediction, avoiding recognition errors caused by misjudgment and ensuring the reliability of writing direction determination. The active prediction logic can further determine the direction by combining information such as historical writing habits and contextual writing directions, filling the judgment gap in scenarios with ambiguous features. This allows the method to adapt to more complex writing scenarios, achieving stable direction determination for both square characters with balanced strokes and illegible cursive characters, further improving the versatility and practicality of handwriting recognition methods and reducing operational inconvenience caused by misjudgment of direction for users.

[0020] The present invention also provides a device for real-time determination of writing direction based on the stroke features of a single character, including a data acquisition module, a feature extraction module, a comprehensive calculation module and a direction determination module; The data acquisition module is used to acquire the coordinate point sequence of the stylus on the whiteboard in real time. The feature extraction module is used to calculate a feature set representing the writing features of a single character based on the coordinate point sequence. The comprehensive calculation module is used to calculate the horizontal comprehensive score by weighting the feature set, and to calculate the vertical comprehensive score by weighting the reciprocal of each feature in the feature set. The direction determination module is used to determine that the writing direction of the stylus is horizontal if the horizontal comprehensive score is greater than a preset threshold and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than a preset difference; and to determine that the writing direction of the stylus is vertical if the vertical comprehensive score is greater than the preset threshold and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than the preset difference.

[0021] The present invention also provides a storage medium storing a computer program, which is called and executed by a computer to realize the method for real-time determination of writing direction based on the stroke features of a single character as described above.

[0022] The present invention also provides a computer program product, including a computer program or instructions, which, when executed by a communication device, implements the writing direction instant determination method based on the stroke features of a single character as described above. Attached Figure Description

[0023] Figure 1 This is a flowchart illustrating a method for real-time determination of writing direction based on the stroke features of a single character, provided in an embodiment of the present invention. Figure 2 This is an example diagram of the coordinate system provided in the embodiments of the present invention; Figure 3 This is the pattern prediction logic flow based on feature values ​​R1, R2, and R3 provided in the embodiments of the present invention; Figure 4 This is a system flowchart provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of a writing direction instant determination device based on the stroke features of a single character, provided in an embodiment of the present invention. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] In the description of this invention, unless otherwise stated, "a number" means two or more.

[0026] The present invention provides a method for real-time determination of writing direction based on the stroke features of a single character. This method aims to solve the technical problem that existing mainstream technical solutions rely on the analysis of multiple character layouts to determine the writing direction when processing handwriting recognition in multiple languages ​​such as Chinese and Japanese. This not only results in significant lag and response delay, making it impossible to achieve real-time conversion of writing results and affecting the smoothness of interaction, but also makes it difficult to accurately determine the direction in scenarios where users write independent single characters due to the lack of reference to the position of subsequent characters. This can easily lead to recognition or layout errors in vertically written single characters.

[0027] Example 1: Please see Figure 1 The present invention provides a method for real-time determination of writing direction based on the stroke features of a single character, including S1 to S4, and the specific implementation steps are as follows: S1. Real-time acquisition of the coordinate sequence of the stylus on the whiteboard.

[0028] Step S1 in this embodiment of the invention includes S1.1 to S1.2, specifically as follows: S1.1 Real-time monitoring of touch signals generated by the user's operation on the whiteboard using a stylus. A high-frequency sampling method with a sampling rate of no less than 120Hz is used to obtain the initial coordinate point sequence P corresponding to the touch signal. This high-frequency sampling mechanism ensures the smoothness of handwriting reconstruction and the accuracy of subsequent feature extraction; where P={p1,p2,...,p...} n}, each sampling point p i Includes the following multidimensional information: ① Spatial coordinates: x-coordinate, y-coordinate; ②Time information: A high-precision timestamp t used to calculate writing speed and time intervals; ③ Physical attribute: The pen pressure value ρ used to distinguish between pen strokes and pauses. This parameter is optional.

[0029] Sequence P will serve as the sole sample source for all subsequent processing steps, including stroke rendering, character segmentation, and feature sampling, ensuring the integrity and consistency of the data source.

[0030] Among them, "stylus" refers to a dedicated touch device for handwriting input that is adapted to whiteboard devices. It is a common tool for handwriting input, including active stylus pens, capacitive stylus pens, and other stylus writing pens with functions such as position sensing and pen pressure detection. "Whiteboard" refers to an intelligent display interactive device with touch interaction, handwriting acquisition, and handwriting recognition functions, including mainstream touch interactive display devices such as interactive smart tablets and smart whiteboard all-in-one machines. The touch signals monitored by this device in real time include not only the signals generated by the stylus pen operating on the whiteboard, but also the touch signals generated by the human hand directly performing handwriting operations on the whiteboard surface.

[0031] S1.2. Perform temporal analysis based on the initial coordinate point sequence P to achieve single-character writing end detection and obtain the complete coordinate point sequence P. pre Specifically, this is achieved through a two-level decision logic: ① Level 1 Detection (Pen Lifting Event): Real-time monitoring of the whiteboard's touch interruption signal. When the initial coordinate point sequence P stops updating, i.e., when a physical pen lift is triggered, the time when the update stops is marked as the completion time T. end ; ② Secondary judgment (writing interruption threshold): at completion time T end Then, start the timer to monitor whether there is a new pen touch signal within the preset time window ΔT (e.g., 500ms) and generate a new sequence of coordinate points; If no new stylus touch signal is detected in the window, the previously acquired initial coordinate point sequence P is used as an independent and complete writing unit to form a complete coordinate point sequence P. pre ; If a new stroke touch signal is detected within the window, it is determined to be a continuous stroke or stroke supplement of the same character. The coordinate point sequence corresponding to the new stroke touch signal is merged into the initial coordinate point sequence P, and the timing is restarted and monitoring continues until no new stroke touch signal is detected within the preset time window ΔT. Finally, the integrated initial coordinate point sequence P is determined as the complete coordinate point sequence P. pre .

[0032] This embodiment S1 effectively solves the problem of incomplete coordinate point sequence acquisition in scenarios such as pauses during single-character writing and continuous writing by monitoring touch signals and setting completion time and preset time windows. When the initial coordinate point sequence stops updating, the time window determines whether a new stroke has occurred. This avoids premature determination of the coordinate point sequence, which could lead to incomplete single-character writing and affect feature extraction and direction determination, while also preventing delayed determination from degrading real-time performance. Simultaneously, incorporating the coordinate point sequence corresponding to the new stroke signal into the initial sequence accurately captures the complete trajectory of continuous writing, ensuring that feature set calculation is based on complete writing data and improving the accuracy of direction determination. This method adapts to different writing speeds and habits, enhancing its practicality and robustness.

[0033] S2. Based on the coordinate point sequence, calculate the feature set representing the writing characteristics of a single character.

[0034] Step S2 in this embodiment of the invention is specifically as follows: Based on the coordinate point sequence P pre The feature set representing the writing characteristics of a single character is calculated. This feature set includes the character's geometric aspect ratio R1, the direction of the pen stroke axis R2, and the stroke density distribution feature R3. Among them, the character geometric aspect ratio R1 is the ratio of the width to the height of the smallest bounding rectangle of all stroke points of a single character; the pen stroke axis direction R2 is the ratio of the total horizontal displacement of a single character to the total vertical displacement plus a preset value; and the stroke density distribution feature R3 is the ratio of the total number of horizontal strokes of a single character to the total number of vertical strokes plus a preset value. The method for obtaining the total horizontal displacement and the total vertical displacement is as follows: the coordinate point sequence is sampled at a preset time interval to obtain the sampling point sequence; the horizontal displacement and vertical displacement of adjacent sampling points in the sampling point sequence are calculated respectively to obtain several horizontal displacement values ​​and several vertical displacement values; the absolute values ​​of several horizontal displacement values ​​and several vertical displacement values ​​are summed to obtain the total horizontal displacement and the total vertical displacement. The method for obtaining the total number of horizontal and vertical strokes is as follows: Positions in the coordinate point sequence with curvature greater than a preset value are identified as stroke inflection points. The coordinate point sequence is then divided into several independent strokes based on these inflection points. For each independent stroke, the angle between the line connecting its start and end points and the horizontal axis is calculated to obtain the target angle. Strokes with target angles within a preset horizontal angle range are defined as horizontal strokes, and the total number of all horizontal strokes in the several independent strokes is taken as the total number of horizontal strokes. Strokes with target angles within a preset vertical angle range are defined as vertical strokes, and the total number of all vertical strokes in the several independent strokes is taken as the total number of vertical strokes.

[0035] The calculation methods for each feature are explained in detail below: (1) Character geometric aspect ratio R1: The formula for calculating the geometric aspect ratio of a character is: R1=W / H The formulas for calculating the character width W and character height H are as follows: W=X max -X min H=Y max -Y min Specifically, when R1≥1, the character width is greater than the height, presenting a flat shape, which better conforms to the characteristics of horizontal layout; when R1<1, the character height is greater than the width, presenting a tall and thin shape, which better conforms to the characteristics of vertical layout. max Y min These are the maximum and minimum coordinates of the character in the vertical direction; X max X min These are the maximum and minimum coordinates of the character in the horizontal direction, respectively.

[0036] (2) Main axis direction of pen stroke R2: ① Sampling point selection: For the coordinate point sequence P preUniformly spaced sampling is performed according to the timestamp, and the sampling interval is set to 10 ms, thereby obtaining the refined sampling point sequence Q = {q1, q2,..., q m}. Compared with the original coordinate point sequence P pre , the sampling sequence Q can achieve triple optimization: first, eliminate data redundancy, avoid magnifying the displacement calculation error of the jitter points in the tiny area of the original sequence when writing slowly, and ensure accurate direction determination; second, play an anti-jitter role, complete data smoothing filtering through interval sampling, filter out high-frequency hand jitter, and retain the true writing movement trend; third, improve calculation efficiency, and greatly reduce the amount of computation on the premise that the calculation trend of the total displacement is consistent.

[0037] ② Displacement vector calculation: For adjacent sampling points q i (x i , y i ) and q i+1 (x i+1 , y i+1 ) in the sampling point sequence Q, calculate the horizontal displacement Δx i = x i+1 - x i and the vertical displacement Δy i = y i+1 - y i respectively; ③ Total amount statistics: The sum of the absolute values of all horizontal displacements is obtained to get the total horizontal displacement L x = Σ|Δx i |, and the sum of the absolute values of all vertical displacements is obtained to get the total vertical displacement L y = Σ|Δy i |. This mechanism uses absolute value summation to avoid the mutual cancellation of positive and negative displacements and fully reflects the actual writing stroke distance; ④ Eigenvalue calculation: The main writing axis direction R2 is calculated according to the formula R2 = L x / (L y + 1); where, adding 1 to the denominator is used to prevent the abnormal situation of division by zero. When the value of R2 is large, it indicates that the writing process is mainly horizontal movement and the horizontal displacement dominates; when the value of R2 is small, it indicates that the writing process is mainly vertical movement and the vertical displacement dominates.

[0038] (3) Stroke density distribution feature R3: ① Stroke splitting: Based on the curvature change of the coordinate point sequence P pre , stroke segmentation is performed, and the position where the curvature is greater than the preset threshold κ is determined as the stroke inflection point, and the character is thus split into several independent strokes. For example, the horizontally arranged "chuan" is split into 3 horizontal strokes, and the vertically arranged "chuan" is split into 3 vertical strokes; ② Direction determination: For each independent stroke in a set of independent strokes, calculate the angle between the line connecting the start and end points and the horizontal x-axis to obtain the target angle θ. 笔 ; The target angle θ 笔 Strokes within a preset horizontal angle range are defined as horizontal strokes, and the total number of all horizontal strokes in a set of independent strokes is taken as the total number of horizontal strokes; the target angle θ is defined as follows. 笔 Strokes within a preset vertical angle range are defined as vertical strokes. The total number of vertical strokes is calculated as the total number of vertical strokes among several independent strokes. The specific angle range is as follows: Horizontal stroke: θ 笔 ∈[-30°, 30°]∪[150°, 210°] (including horizontal strokes to the left and right); Vertical stroke: θ 笔 ∈[60°, 120°]∪[240°, 300°] (including vertical strokes pointing upwards and downwards); Slanted stroke: θ 笔 Items not falling within the above scope are not included in the R3 calculation. ③Density calculation: The stroke density distribution characteristic R3 is obtained by calculating R3 using the formula R3 = total number of horizontal strokes / (total number of vertical strokes + 1).

[0039] It should be noted that, based on the structural rules of Chinese characters, horizontally written characters are mainly composed of horizontal strokes, while vertically written characters are mainly composed of vertical strokes. A larger R3 value indicates a higher proportion of horizontal strokes, corresponding to horizontal writing, while an R3 value close to 0 indicates a higher proportion of vertical strokes, corresponding to vertical writing.

[0040] For an explanation of the embodiments of the present invention, please refer to [link / reference]. Figure 2 , Figure 2 This is an example diagram of the coordinate system provided in this embodiment of the invention, presenting a coordinate system reference system for determining the main direction of Chinese character strokes, providing a clear coordinate reference basis for the accurate determination of stroke direction. In this example diagram, different colored lines are used to clearly distinguish different types of strokes, where red lines represent horizontal strokes, blue lines represent vertical strokes, and gray lines represent diagonal strokes. Since the directional characteristics of diagonal strokes are difficult to determine accurately, to ensure the accuracy of the calculation of the stroke density distribution feature R3, these diagonal strokes will not be included in the relevant calculation scope.

[0041] In this embodiment S2, the aspect ratio of a character can intuitively reflect the horizontal or vertical extension trend of the entire character, the direction of the pen stroke axis can reflect the overall pen stroke tendency during the writing process, and the stroke density distribution characteristics can distinguish directional differences from the perspective of stroke composition. The combination of these three features makes the feature set more representative and comprehensive. At the same time, clarifying the specific definition of each feature provides a unified standard for feature calculation, improves the standardization and accuracy of feature extraction, provides reliable support for subsequent comprehensive score calculation, and thus improves the accuracy of writing direction determination. This adapts to the writing habits of different writers and the writing characteristics of different fonts, enhancing the versatility and stability of the method. Furthermore, this embodiment provides a specific method for obtaining the total horizontal and vertical displacements. By sampling at preset time intervals, the amount of sampled data is effectively controlled while ensuring data integrity, avoiding excessive redundant data that would increase the computational burden, thus balancing real-time performance and computational efficiency. By calculating the horizontal and vertical displacements of adjacent sampling points and summing their absolute values, the overall pen movement amplitude in the horizontal and vertical directions during writing can be accurately reflected, eliminating irrelevant interference such as minor tremors during writing, making the calculation of the pen movement axis direction more accurate. This method is simple to operate, logically clear, requires no complex algorithm support, is easy to implement in engineering, and can quickly output reliable total displacement data, providing a solid foundation for the calculation of the pen movement axis direction characteristics, further improving the real-time performance and accuracy of writing direction determination. Furthermore, by determining the inflection points of strokes through curvature and separating them into individual strokes, this method can accurately distinguish different strokes and avoid classification errors caused by stroke adhesion. It is particularly suitable for complex scenarios such as cursive writing and connected writing. Classifying horizontal and vertical strokes by calculating the angle between the line connecting the start and end points of a stroke and the horizontal axis provides clear standards, strong operability, and an objective reflection of the actual direction of the strokes, avoiding errors caused by subjective judgment. This method can accurately count the number of horizontal and vertical strokes, making the calculation of stroke density distribution characteristics more scientific, thereby improving the rationality of the overall score, making the determination of writing direction more consistent with actual writing logic, reducing misjudgments of direction due to incorrect stroke classification, and enhancing the method's adaptability to different writing styles.

[0042] In summary, embodiment S2 of the present invention breaks through the limitations of single feature determination and innovatively constructs a three-dimensional weighted determination model that integrates multi-dimensional character features. It organically integrates the static geometric features, dynamic pen movement features and stroke structure density features of characters. Through this model, it can achieve comprehensive adaptation to various complex writing scenarios and effectively solve the problem of determining various writing directions, including characters with square shapes but obvious writing habits.

[0043] S3. The horizontal comprehensive score is obtained by weighting the feature set, and the vertical comprehensive score is obtained by weighting the reciprocals of each feature in the feature set.

[0044] Step S3 in the embodiment of the present invention is specifically as follows: Perform weighted fusion calculation on the feature set to obtain the horizontal comprehensive score S 横 ; perform weighted fusion calculation on the reciprocals of each feature in the feature set to obtain the vertical comprehensive score S 纵 , and the specific calculation formulas for the two are as follows: S 横 = ω1×R1 + ω2×R2 + ω3×R3 S 纵 = ω1×(1 / R1) + ω2×(1 / R2) + ω3×(1 / R3) Among them, ω1, ω2, and ω3 are the weight coefficients corresponding to each feature, and ω1 + ω2 + ω3 = 1. The default values are: ω1 = 0.4, ω2 = 0.3, ω3 = 0.3; at the same time, the weight coefficients also support manual adjustment by the user or are adaptively adjusted by the system according to the actual usage scenario to adapt to different writing recognition requirements.

[0045] S4. If the horizontal comprehensive score is greater than the preset threshold and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than the preset difference, it is determined that the writing direction of the stylus is horizontal; if the vertical comprehensive score is greater than the preset threshold and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than the preset difference, it is determined that the writing direction of the stylus is vertical.

[0046] Step S4 in the embodiment of the present invention includes S4.1 and S4.2, and is specifically as follows: S4.1. Based on the horizontal comprehensive score S 横 and the vertical comprehensive score S 纵 carry out writing direction determination, and the specific determination rules are as follows: ① If S 横 > θ and S 横 - S 纵 > Δ, it is determined that the writing direction of the stylus is horizontal, that is, the horizontal mode. This determination rule is applicable to flat characters such as "one" and "two", and matches the writing scenarios with horizontal pen movement and dense horizontal strokes; ② If S 纵 > θ and S 纵 - S 横 > Δ, it is determined that the writing direction of the stylus is vertical, that is, the vertical mode. This determination rule is applicable to tall and thin characters such as "丨" and "middle", and matches the writing scenarios with vertical pen movement and dense vertical strokes.

[0047] ③ |S 横 - S 纵 | ≤ Δ or S 横 , S 纵 are both ≤ θ, it is determined that the writing situation of the stylus is a square character writing scenario with blurred features, and the preset writing direction active prediction logic is triggered.

[0048] Where, θ is a preset horizontal threshold, with a value of 0.5. The decision logic for this value is that at least half of the weights or ratios of the feature dimensions must support the corresponding writing direction. If this value is not reached, it means that the feature of the writing direction is ambiguous, and the writing direction needs to be further determined through the active prediction logic of the writing direction; Let Δ be a preset difference threshold, with a value of 0.2 or 0.3. Only when the difference between the scores of the two categories reaches 20% - 30% or more, the determination result of the writing direction is stable. If the difference is less than 0.2, the system will determine that the direction feature cannot be clearly recognized, trigger the active prediction logic of the writing direction or maintain the current state, waiting for the user to write subsequent characters for further verification; Moreover, the thresholds θ and Δ support adaptive adjustment according to the writing language and terminal type actually used. For example, in the usage scenario of vertical writing in Japanese, the value of θ can be lowered to better adapt to the kana characteristics of Japanese characters.

[0049] To apply the embodiments of the present invention, please refer to Figure 3 , Figure 3 is the mode prediction logic flow provided by the embodiments of the present invention based on the eigenvalue R1, R2, and R3, presenting the full process execution logic from eigenvalue input to the final determination of the writing direction; Among them, the eigenvalues R1, R2, and R3 respectively complete multi-dimensional feature portraits for a single written character from three different dimensions of static shape, dynamic writing habits, and stroke structure composition, realizing a comprehensive and three-dimensional characterization of the character writing features. The corresponding horizontal and vertical comprehensive score calculation formulas rely on the weight coefficient ω to perform weighted fusion calculation on the feature portraits of the three dimensions. Through the design idea of mutual exclusion of horizontal and vertical scores, the multi-dimensional eigenvalues are transformed into directly comparable horizontal and vertical comprehensive determination scores, completing the key transformation from feature extraction to determination quantification. θ and Δ are designed to filter out characters with messy writing features or regular-shaped characters that are difficult to directly determine the direction, ensuring that the system gives a clear conclusion on the writing direction only when the feature determination basis is sufficient and the result is stable; if the feature determination is doubtful, the system will trigger the prediction logic as a fallback solution to comprehensively ensure the robustness of the entire writing direction determination system.

[0050] The following specifically describes the "active prediction logic of the writing direction": This logic is applicable to the writing scenarios of square characters with ambiguous features determined by the system, such as characters with regular shapes like "口" and "田" without obvious horizontal and vertical features. In this scenario, the system will not enter a simple observation state, but actively predict the writing direction through multi-dimensional reference bases, and at the same time, a backtracking verification mechanism is provided to ensure the accuracy of the direction determination. The determination bases for this active prediction are mainly divided into two dimensions: ①Previous writing habits: Retrieve the user's writing records within the previous 30 seconds. If there is a clear horizontal or vertical writing behavior within that time period, the direction will be used as the prediction result first. Here, "previous" refers to the moment before the system detects the fuzzy Fangzheng characters and triggers the active writing direction prediction logic. ② Canvas Context: Based on the actual position of the Founder characters on the canvas, if the character is in a preset adjacent position of an existing horizontal text area, the writing direction of the stylus is predicted to be horizontal; if the character is in a blank area of ​​the canvas, or in a preset adjacent position of an existing vertical text area, the writing direction of the stylus is predicted to be vertical. In addition, after making a direction prediction, it is necessary to continuously monitor the user's subsequent writing input. When the user writes a character with clear features and obtains the accurate actual writing direction, the previous prediction result will be verified: if the predicted direction is consistent with the actual determined direction, the original recognition result will be directly retained; if the two are inconsistent, the writing direction of all characters in the current character block will be corrected, and this correction process will be completed in the background without interfering with the user's current writing process.

[0051] In this embodiment, S4.1, considering the scenario of fuzzy Fangzheng characters, an active prediction logic based on temporal inertia (preceding habits) and spatial inertia (canvas context) is set up. This effectively solves the problem of inaccurate writing direction determination in such scenarios, improves the fault tolerance and adaptability of the method, and ensures the robustness of the system in fuzzy scenarios. When the combined scores of horizontal and vertical directions are close or both too low, the direction is not forcibly determined, but active prediction is triggered, avoiding recognition errors caused by misjudgment and ensuring the reliability of writing direction determination. The active prediction logic can further determine the direction by combining historical writing habits, contextual writing direction, and other information, filling the judgment gap in fuzzy scenarios. This allows the method to adapt to more complex writing scenarios, achieving stable direction determination for both Fangzheng characters with balanced strokes and cursive characters with indistinct features. This further improves the versatility and practicality of handwriting recognition methods and reduces the operational trouble caused by user misjudgment.

[0052] S4.2 If the writing direction of the stylus is horizontal, the standard horizontal OCR engine is called to recognize the handwriting image corresponding to the coordinate point sequence, and the recognition result is rendered in a horizontal format. If the writing direction of the stylus is vertical, the handwriting image corresponding to the coordinate point sequence is rotated 90 degrees and then the horizontal OCR engine is reused for recognition, or the vertical OCR engine is directly switched to complete the recognition. Then the recognition result is rendered in the form of a vertical text box at the original handwriting position.

[0053] In this embodiment, S4.2, after determining the writing direction, targeted handwriting recognition and rendering are performed, effectively improving the overall experience and accuracy of handwriting recognition. For horizontal writing, direct recognition and horizontal rendering conform to common reading and usage habits, enhancing ease of use. For vertical writing, the handwriting image is rotated 90 degrees before recognition, solving the problem of low adaptation between stroke direction and recognition model and large recognition errors when directly recognizing vertical handwriting, significantly improving the recognition accuracy of vertical writing. Simultaneously, vertical rendering aligns with the reading habits of vertical writing, making the recognition results more intuitive. This achieves accurate recognition and adaptive rendering for both horizontal and vertical writing, expanding the applicable scenarios of handwriting recognition methods, meeting the writing and usage needs of different users, and improving the practicality and user experience of the handwriting recognition system.

[0054] For an explanation of the embodiments of the present invention, please refer to [link / reference]. Figure 4 , Figure 4 This is a system flowchart provided in an embodiment of the present invention, which shows the full-process execution logic of determining the writing direction in real time based on the stroke features of a single character.

[0055] Overall, this embodiment has the following beneficial effects: This invention acquires the coordinate point sequence of the stylus on the whiteboard in real time. This step enables synchronous data capture during the writing process, solving the response delay problem caused by the need to accumulate multi-character layout data in existing technologies. Based on this, a feature set representing the writing characteristics of a single character is extracted from the coordinate point sequence. This allows focusing on the inherent attributes of a single character's strokes, such as direction, length, and turns. These features are directly related to the writing direction and do not rely on the arrangement rules of multi-character layouts. Even when writing only a single character, effective directional judgment criteria can be extracted, successfully avoiding the single-character recognition failure problem caused by the lack of multi-character layout support in existing technologies. Furthermore, considering the significant horizontal extension and horizontal displacement features in horizontal writing, the horizontal feature weights are amplified through positive weighting to accurately quantify horizontal writing attributes. Conversely, considering the weakened horizontal features in vertical writing, the reciprocal of the features is used to achieve a reverse numerical mapping, transforming weak horizontal features into vertical quantification criteria, and then weighted to obtain a comprehensive vertical score that specifically represents vertical writing attributes. When determining the writing direction as horizontal, the horizontal comprehensive score must simultaneously exceed a preset threshold and be significantly higher than the vertical comprehensive score. This ensures that the horizontal writing features are sufficiently prominent while also guaranteeing that they are significantly superior to the vertical features, avoiding directional confusion. Conversely, when determining the writing direction as vertical, the vertical comprehensive score must simultaneously exceed a preset threshold and be significantly higher than the horizontal comprehensive score. This ensures that the vertical writing features are sufficiently effective while also guaranteeing that they are significantly superior to the horizontal features, eliminating ambiguity in the determination. The entire determination process revolves solely around real-time stroke data for a single character, eliminating the need to wait for the formation of multi-character layouts. This not only ensures stable determination response speed but also reliably achieves effective determination in single-character scenarios, comprehensively and thoroughly solving the core problems existing in current technologies.

[0056] In summary, this invention breaks through the traditional technical limitations of multi-character layout analysis in the industry, innovatively achieving real-time recognition of the direction of handwriting recognition as soon as the pen is lifted when writing a single character. This fundamentally eliminates the delay in direction determination for handwriting recognition, significantly improving the real-time performance and smoothness of human-computer interaction. Furthermore, it not only perfectly adapts to various writing scenarios such as independent single characters and title signing, effectively expanding the application boundaries of devices like smart whiteboards, but its lightweight single-character feature calculation algorithm is also more suitable for the operational needs of embedded all-in-one machines. Moreover, its judgment logic aligns with the natural intuition of human writing and reading. From multiple dimensions, including real-time performance, scenario adaptability, device adaptability, and interactive experience, this invention achieves a comprehensive optimization and upgrade of handwriting recognition direction determination technology.

[0057] Example 2: Please see Figure 5 The present invention provides a device for real-time writing direction determination based on the stroke features of a single character, including a data acquisition module 10, a feature extraction module 20, a comprehensive calculation module 30 and a direction determination module 40. Among them, the data acquisition module 10 is used to acquire the coordinate point sequence of the stylus on the whiteboard in real time; The feature extraction module 20 is used to calculate a feature set representing the writing features of a single character based on the coordinate point sequence; The comprehensive calculation module 30 is used to calculate the horizontal comprehensive score by weighting the feature set and to calculate the vertical comprehensive score by weighting the reciprocal of each feature in the feature set. The direction determination module 40 is used to determine that the writing direction of the stylus is horizontal if the horizontal comprehensive score is greater than a preset threshold and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than a preset difference; and to determine that the writing direction of the stylus is vertical if the vertical comprehensive score is greater than a preset threshold and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than a preset difference.

[0058] It should be noted that the technical concept of this second embodiment is completely consistent with that of the first embodiment. The two maintain a high degree of synergy at the technical logic level. The specific technical details can be referred to the relevant description of the first embodiment, which will not be repeated here.

[0059] Example 3: This invention provides a computer-readable storage medium including a stored computer program, wherein the computer program, when running, controls the device where the computer-readable storage medium is located to execute the aforementioned method for real-time determination of writing direction based on single-character stroke features. The method for real-time determination of writing direction based on the stroke features of a single character, when implemented as a software functional unit and used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0060] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are performed entirely or partially. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user equipment, or other programmable device. The computer program or instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video optical disc; or it can be a semiconductor medium, such as a solid-state drive. The computer-readable storage medium may be a volatile or non-volatile storage medium, or may include both types of storage media.

[0061] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for real-time determination of writing direction based on the stroke features of a single character, characterized in that, include: Real-time acquisition of the coordinate sequence of the stylus on the whiteboard; Based on the coordinate point sequence, a feature set representing the writing characteristics of a single character is calculated; The horizontal comprehensive score is obtained by weighting the feature set, and the vertical comprehensive score is obtained by weighting the reciprocals of each feature in the feature set. If the horizontal comprehensive score is greater than a preset threshold, and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than a preset difference, the writing direction of the stylus is determined to be horizontal. If the vertical comprehensive score is greater than the preset threshold, and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than the preset difference, the writing direction of the stylus is determined to be vertical.

2. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 1, characterized in that, The feature set includes character geometric aspect ratio, pen stroke axis direction, and stroke density distribution features; Wherein, the character geometric aspect ratio is the ratio of the width to the height of the smallest bounding rectangle of all strokes of a single character, the pen stroke axis direction is the ratio of the total horizontal displacement to the total vertical displacement plus a preset value when writing a single character, and the stroke density distribution feature is the ratio of the total number of horizontal strokes to the total number of vertical strokes plus a preset value when writing a single character.

3. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 2, characterized in that, The method for obtaining the total horizontal displacement and the total vertical displacement is as follows: The coordinate point sequence is sampled at preset time intervals to obtain a sampled point sequence; The horizontal and vertical displacements of adjacent sampling points in the sampling point sequence are calculated respectively to obtain several horizontal displacement values ​​and several vertical displacement values; The absolute values ​​of the plurality of horizontal displacement values ​​and the absolute values ​​of the plurality of vertical displacement values ​​are summed to obtain the total horizontal displacement and the total vertical displacement.

4. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 2, characterized in that, The method for obtaining the total number of horizontal strokes and the total number of vertical strokes is as follows: The positions in the coordinate point sequence with curvature greater than a preset value are determined as stroke inflection points, and the coordinate point sequence is divided into several independent strokes based on the stroke inflection points. For each of the aforementioned independent strokes, calculate the angle between the line connecting the start and end points and the horizontal axis to obtain the target angle; Strokes whose target angle is within a preset horizontal angle range are defined as horizontal strokes, and the total number of all horizontal strokes in the plurality of independent strokes is taken as the total number of horizontal strokes; strokes whose target angle is within a preset vertical angle range are defined as vertical strokes, and the total number of all vertical strokes in the plurality of independent strokes is taken as the total number of vertical strokes.

5. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 1, characterized in that, Real-time acquisition of the coordinate sequence of the stylus on the whiteboard, specifically: Real-time monitoring of the touch signals of the stylus on the whiteboard, and acquisition of the initial coordinate point sequence corresponding to the touch signals; When the initial coordinate point sequence stops updating, mark the time when the update stops as the completion time; If no new touch signal from the stylus is detected within a preset time window after the completion time, the initial coordinate point sequence is used as the coordinate point sequence; if a new touch signal is detected, the coordinate point sequence corresponding to the new touch signal is merged into the initial coordinate point sequence to obtain the coordinate point sequence.

6. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 1, characterized in that, After obtaining the writing direction determination result of the stylus, the method further includes: If the writing direction of the stylus is horizontal, the handwriting image corresponding to the coordinate point sequence is identified, and the identification result is rendered horizontally. If the writing direction of the stylus is vertical, the handwriting image corresponding to the coordinate point sequence is rotated 90 degrees before recognition, and the recognition result is rendered vertically.

7. The method for real-time determination of writing direction based on the stroke features of a single character as described in claim 1, characterized in that, If both the horizontal and vertical comprehensive scores are less than or equal to a preset threshold, or if the absolute value of the difference between the horizontal and vertical comprehensive scores is less than or equal to a preset difference, the writing situation of the stylus is determined to be a Founder character writing scenario with blurred features, and a preset active prediction logic for the writing direction is triggered.

8. A device for real-time determination of writing direction based on the stroke features of a single character, characterized in that, It includes a data acquisition module, a feature extraction module, a comprehensive calculation module, and a direction determination module; The data acquisition module is used to acquire the coordinate point sequence of the stylus on the whiteboard in real time. The feature extraction module is used to calculate a feature set representing the writing features of a single character based on the coordinate point sequence. The comprehensive calculation module is used to calculate the horizontal comprehensive score by weighting the feature set, and to calculate the vertical comprehensive score by weighting the reciprocal of each feature in the feature set. The direction determination module is used to determine that the writing direction of the stylus is horizontal if the horizontal comprehensive score is greater than a preset threshold and the difference between the horizontal comprehensive score and the vertical comprehensive score is greater than a preset difference; and to determine that the writing direction of the stylus is vertical if the vertical comprehensive score is greater than the preset threshold and the difference between the vertical comprehensive score and the horizontal comprehensive score is greater than the preset difference.

9. A storage medium, characterized in that, The storage medium stores a computer program, which is called and executed by a computer to implement a method for real-time determination of writing direction based on the stroke features of a single character, as described in any one of claims 1 to 7.

10. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the communication device, they implement the instant writing direction determination method based on the stroke features of a single character as described in any one of claims 1 to 7.