A method of soft pen handwriting rendering

By establishing a stroke feature model and performing curve fitting, the problem of low fidelity between the handwriting effect and the actual character shape in existing soft-pen handwriting drawing was solved, achieving a more realistic soft-pen writing effect and improving the user experience.

CN115826823BActive Publication Date: 2026-01-23SICHUAN CHANGHONG EDUCATION TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211576633.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-09
Publication Date
2026-01-23
Estimated Expiration
2042-12-09

AI Technical Summary

Technical Problem

Existing penmanship drawing methods cannot realistically simulate effects such as pausing, pressing, and turning the pen, resulting in a poor user experience.

Method used

By establishing a stroke feature model, obtaining vector coordinate data of stroke points, calculating the speed and angle differences between stroke points, determining the stroke type, and performing curve fitting and filling, the effects of pausing, pressing, and turning the pen during the soft-pen writing process are simulated.

Benefits of technology

It achieves more realistic variations in pen thickness, making the pen strokes smoother and more fluid, simulating the effects of pausing, pressing, and turning the pen in soft-pen writing, thus improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115826823B_ABST
    Figure CN115826823B_ABST
Patent Text Reader

Abstract

The present application mainly relates to handwriting modeling technical field, in order to solve the problem of low degree of actual character restoration in the handwriting drawing effect of existing soft pen handwriting drawing method, the present application provides a kind of soft pen handwriting drawing method, the soft pen note drawing method of the present application first establishes stroke feature model to different stroke sample, obtains the vector coordinate data Pf of each stroke point;According to the angle formed by the stroke and horizontal direction, stroke interval division is carried out;Obtain the relevant parameters of each stroke point in the writing process;Get the stroke point set of current writing track;Curve fitting is carried out to stroke point set, and closed area is formed, and the closed area is filled to obtain the final soft pen writing track.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates primarily to the field of handwriting modeling technology, and in particular to a method for drawing handwriting with a soft pen. Background Technology

[0002] On traditional smart interactive screens, whiteboard software collects coordinate information from touch and mouse inputs to generate various handwriting styles and display the written content. Soft-pen calligraphy, as one type of handwriting selection in whiteboard software, typically uses the difference in speed between adjacent data points as the element for thickness variation during writing. It then dynamically adjusts the line width using techniques such as texture mapping or curve optimization to simulate soft-pen writing. This method can only simply describe the thickness variation during soft-pen writing, resulting in poor smoothness, jagged edges, and an inability to simulate the effects of pauses, pressure, turns, and strokes in real soft-pen writing, leading to a poor user experience. To improve the soft-pen writing effect and incorporate effects such as pauses, pressure, turns, and strokes, a new method for drawing soft-pen handwriting is needed, enabling the lines to be strong, dynamic, and varied. Summary of the Invention

[0003] The technical problem to be solved by this invention:

[0004] This paper provides a method for drawing handwriting with a soft pen, which solves the problem that the handwriting drawing effect is not highly accurate in reproducing the actual character shape in existing soft pen handwriting drawing methods.

[0005] A method for drawing handwriting with a soft pen, the method comprising the following steps:

[0006] Step 1: Establish stroke feature models for different stroke samples and obtain vector coordinate data Pf for each stroke point;

[0007] Step 2: Divide the stroke intervals according to the angle between the stroke and the horizontal X-axis;

[0008] Step 3: Obtain the coordinates P, writing time T, and distance L between two adjacent strokes during the writing process; calculate the writing speed V between two adjacent strokes; measure the angle θ of the line connecting two adjacent strokes relative to the horizontal X-axis; and calculate the difference between each pair of adjacent angles θ {θ1, θ2, ..., θn-1}.

[0009] Step 4: Determine the type of stroke in the writing and match it with the established stroke feature model;

[0010] Step 5: Based on the scaling factor of the width and length of the written strokes, the offset of the center point Pc of the stroke relative to the center point in the stroke feature model, the average angle θc of the line connecting each pair of adjacent stroke points and the horizontal X-axis, and the vector coordinate data Pf of each stroke point in the stroke feature model, obtain the set of stroke points for the current writing trajectory.

[0011] Step 6: Perform curve fitting on the set of stroke points to form a closed region, and fill the closed region to obtain the final soft pen writing trajectory.

[0012] Furthermore, the specific method of step 4 includes: calculating the total length of the current handwriting. Divide by the current system's preset soft-pen line width W to obtain the baseline length of the stroke. The reference length is compared with the length of a stroke point in the soft brush. To make a comparison, if If the stroke type of the writing trajectory is considered to be "point", then... If so, then the stroke type of the writing trajectory is not considered to be "dot".

[0013] Furthermore, step 4 also includes that when the type of soft brush stroke is determined to be "dot", if there is a value in {θ1, θ2, ..., θn-1} that exceeds the threshold θm, then the "dot" is a "turning stroke starting point", otherwise it is a "pause stroke starting point".

[0014] Furthermore, after determining that the stroke type is "dot", the method for calculating the width scaling factor in step 5 is as follows: β is an empirical coefficient; the length scaling factor is calculated as follows: ,in The length between the furthest left stroke point and the center stroke point Pc. It is the length between the farthest right-hand stroke point and the center stroke point Pc.

[0015] Furthermore, if it is determined that the stroke type is not a "dot", that is... When the writing trajectory is divided into the beginning, middle, and end segments, and processed separately, the set of stroke points of the entire writing handwriting is obtained, where the length of the beginning segment is... and the length of the tail segment The length of the middle section is a preset fixed value. For variable length, the angle between the line connecting the first and last stroke points of the head segment and the horizontal X-axis is compared with the interval defined in step 2 to match the corresponding stroke feature model.

[0016] Furthermore, the calculation methods for the length and width scaling factors of the head and tail segments are as follows: The width scaling factor of the head segment is... The width scaling factor for the tail section is... The length scaling factor for the head section is... The length scaling factor for the tail segment is: ;in , These represent the writing speeds of two adjacent points at the beginning and end of the segment, respectively. and These are the reference lengths of the first and last strokes, respectively, where β is an empirical coefficient. The length between the furthest left stroke point and the center stroke point Pc. It is the length between the farthest right-hand stroke point and the center stroke point Pc.

[0017] Furthermore, the processing method for the middle section is as follows: The handwriting segments with an angle variation variance not exceeding a fixed threshold are denoted as "lines," and the handwriting regions with an angle variation variance exceeding the threshold are denoted as "corners." This yields all bends in the middle section. Simultaneously, the coordinates of all strokes, the distance between adjacent strokes, and the writing speed are calculated. For each interval "line," N equal division points are taken from the stroke region, and the line is extended towards the tangent direction of the line connecting these N points. Obtain the set of stroke points `P_line` for the interval `line`, where Where β is an empirical coefficient, The writing speed of the interval line;

[0018] The trajectory set `P corner` of the restored stroke points in the corner region is obtained using the same trajectory acquisition method as the first and last segments.

[0019] Connect the set of stroke points `Pline` of all interval lines and the set of trajectories `Pcorner` of stroke points after restoring all corner regions according to the order in which the lines and corners are written, to obtain the complete set of stroke point trajectories for the middle section.

[0020] The beneficial effects of this invention are:

[0021] The handwriting drawing method described in this invention can more realistically reproduce the changes in the thickness of the handwriting during the writing process, making the handwriting smoother and more rounded. It can realistically simulate the effects of pausing, pressing, and turning the pen during the soft-pen writing process, making soft-pen writing more powerful, flexible, and varied, thus improving the user experience. Attached Figure Description

[0022] Figure 1 This is a flowchart of the method described in this invention.

[0023] Figure 2 This is a classification of the key feature model described in this invention.

[0024] Figure 3 These are the key feature data of the character "Yong" in the embodiments of the present invention.

[0025] Figure 4 These are the key feature data of the character "Shi" in the embodiments of the present invention.

[0026] Figure 5 These are the key feature data of the "vertical stroke starting with a pause" and the rotated key feature data in the embodiments of the present invention.

[0027] Figure 6 This is the drawing process of the "dot" of the soft pen trajectory in the embodiments of the present invention.

[0028] Figure 7 This is the actual trajectory diagram of the "horizontal fold and hook" of the soft pen in the embodiments of the present invention.

[0029] Figure 8 This is the schematic diagram of the classified trajectories of the head section, middle section and tail section of the "horizontal fold and hook" of the soft pen in the embodiments of the present invention.

[0030] Figure 9 This is the final filling schematic diagram of the "horizontal fold and hook" written with the soft pen in the embodiments of the present invention. Detailed implementation manners

[0031] As Figure 1 shown, the soft pen handwriting drawing method of the present invention first establishes a stroke feature model for different stroke samples, obtains the vector coordinate data Pf of each stroke point; divides the stroke intervals according to the angle formed by the stroke and the horizontal direction; obtains the coordinates P of each stroke point, the writing time T, and the distance L between adjacent two stroke points during the writing process, calculates the writing speed V between adjacent two points; measures the angle θ of the line connecting adjacent two stroke points relative to the horizontal X-axis, calculates the difference {θ1, θ2,..., θn-1} of each adjacent two angles θ; determines the type of the written stroke and matches it with the established stroke feature model; calculates the width and length scaling coefficients of the stroke according to the type of the writing trajectory, calculates the offset of the center point Pc of the written stroke relative to the center point in the stroke feature model, the average value Θc of the angles formed by the lines connecting each adjacent two stroke points in the actual stroke points and the vector coordinate data Pf of each stroke point in the stroke feature model to obtain the stroke point set of the current writing trajectory; performs curve fitting on the obtained stroke point set to form a closed area, and fills the closed area to obtain the final soft pen writing trajectory.

[0032] Embodiment:

[0033] For stroke classification, soft pen writing includes three steps: starting stroke, running stroke, and lifting stroke. Among them, the starting stroke in the whiteboard refers to a segment of input after detecting the touch or mouse press; the lifting stroke in the whiteboard refers to a segment of input before detecting the touch or mouse lift. The running stroke is a segment of the trajectory in the glyph input excluding the starting stroke and the lifting stroke. During the starting stroke, running stroke, and lifting stroke, there are usually changes in the pen tip. The starting stroke includes the paused starting stroke, the turning starting stroke, the ordinary starting stroke, etc. The running stroke includes the pressing running stroke, the turning running stroke, the ordinary running stroke, etc. The lifting stroke includes the paused lifting stroke, the pen tip lifting stroke, the turning lifting stroke, etc. Combining with the basic strokes such as "dot, horizontal, vertical, left-falling stroke, right-falling stroke, rising stroke" in Chinese characters, establish stroke model classifications such as: paused starting stroke dot, turning starting stroke dot, paused starting stroke horizontal, ordinary starting stroke vertical, paused lifting stroke horizontal, pen tip lifting stroke vertical, turning running stroke horizontal, pen tip lifting stroke vertical, turning running stroke horizontal, etc. For example, as Figure 2 shown, the stroke model of the Chinese character "永" includes "paused starting stroke dot, running stroke turning dot, paused starting stroke left-falling stroke, pen tip making right-falling stroke, turning making vertical hook, pen tip picking up left-falling stroke, running stroke paused horizontal stroke, paused starting stroke horizontal, ordinary starting stroke dot" and other strokes. When writing the character "永" on the whiteboard, the above-established stroke model is called for whiteboard writing.

[0034] Perform contour sampling from standard fonts such as calligraphy models. Sample feature points from the glyph contour at equal intervals according to the set interval. Denote the sampled feature points as stroke points Pti, where i represents the i-th stroke point. Connect all adjacent feature points with straight lines. If the angle difference between the connections of all adjacent feature points does not exceed the set maximum difference threshold, it means that there are no bends and curves in the stroke contour, indicating that the stroke contour is well-fitted. Then remove the intermediate feature points n-1, only retain Pt1 and Ptn as stroke points. If there is an angle difference between the connections of adjacent points that exceeds the set difference threshold, it means that there are bends or curves in this segment of the stroke contour. Then set a first-type control point Pci at the midpoint of the connection of these two adjacent points, where i represents the i-th control point for Bezier curve fitting, where i represents the i-th control point; if the curve after fitting still has a large difference from the stroke contour, then set a second-type control point at the midpoint between the control point and its corresponding stroke point for quadratic Bezier curve fitting until a series of points that can well fit the stroke contour are found, obtaining all the feature point data in the stroke contour. Describe the positions of all feature points in the two-dimensional coordinate system. Denote the position coordinates of the stroke points as and the control point coordinates as Arrange the stroke points and control points in the order on the stroke contour. For example, as Figure 3 shown, the Chinese character "十" includes a paused starting stroke vertical, a paused starting stroke horizontal, a paused picking up horizontal stroke, and a pen tip lifting stroke vertical. When writing the Chinese character "十", the above-established stroke model is called for writing; as Figure 4As shown, taking the vertical line starting with a pause in the stroke as an example, after taking feature points at equal intervals, the adjacent feature points are connected. Control points are added between the feature points where the set connection angle difference threshold is exceeded. Finally, the description of the feature points of the vertical line starting with a pause in the Chinese character "十" is as follows Figure 4 shown, {Pt1, Pc1, Pt2, Pc2, Pt3, Pc3, Pt4, Pc4, Pt5, Pc5, Pt6, Pc6, Pt7, Pc7, Pt8, Pc8, Pt9}; where Pt1, Pt2,..., Pt7 are stroke points, and Pc1, Pc2,..., Pc6 are control points. The path described by this model is: taking Pc1 as the control point, a Bezier curve is made with Pt1 and Pt2 as vertices; taking Pc2 as the control point, a Bezier curve is made with Pt2 and Pt3 as vertices; taking Pc3 as the control point, a Bezier curve is made with Pt3 and Pt4 as vertices; taking Pc4 as the control point, a Bezier curve is made with Pt4 and Pt5 as vertices; taking Pc5 as the control point, a Bezier curve is made with Pt5 and Pt6 as vertices; taking Pc6 as the control point, a Bezier curve is made with Pt6 and Pt7 as vertices; taking Pc7 as the control point, a Bezier curve is made with Pt7 and Pt8 as vertices; taking Pc8 as the control point, a Bezier curve is made with Pt8 and Pt9 as vertices.

[0035] Taking the vertical line starting with a pause in the Chinese character "十" as an example, as Figure 5As shown, the center of the stroke is found, and the center coordinates C(x,y) between the stroke point and the adjacent control point are calculated sequentially according to the arrangement of feature points. The X-axis and Y-axis coordinates of the center point are subtracted from the X-axis and Y-axis coordinates of the stroke point and the control point, respectively, to obtain the coordinate differences between the stroke point and the center point, and the coordinate differences between the control point and the center point: {Pt1.x - Cx, Pt1.y - Cy}, {Pc1.x - Cx, Pc1.y - Cy}, {Pt2.x - Cx, Pt2.y - Cy}, {Pc2.x - Cx, Pc2.y - Cy}, ..., {Pcn.x - Cx, Pcn.y - Cy}, {Ptn.x - Cx, Ptn.y - Cy}. The difference coordinates are then divided by the line width W of the stroke reference to obtain the reference coordinates Ps = {(Pt1.x - Cx) / W, (Pt1.y ... The coordinates of the reference point are then rotated α degrees clockwise so that the first stroke point is located in the positive half-axis direction of the X-axis, resulting in the final vectorized coordinate data Pf = α * Ps.

[0036] In a planar coordinate system, the angle between the stroke direction and the X-axis is divided into intervals. When the angle between the stroke direction and the X-axis is ∠0° to ∠15° and ∠345° to ∠360°, it is usually a horizontal stroke. In this embodiment, these angles are defined as interval 1. When the angle between the stroke direction and the X-axis is ∠15° to ∠90°, it is usually a lifting stroke. In this embodiment, these angles are defined as interval 2. When the angle between the stroke direction and the X-axis is ∠90° to ∠195°, it is not... Commonly, the above angles are defined as interval 3; when the angle between the stroke direction and the X-axis is ∠195° to ∠255°, it is usually a left-falling stroke, and in this embodiment, the above angles are defined as interval 4; when the angle between the writing direction and the X-axis is ∠255° to ∠285°, it is usually a vertical stroke, and in this embodiment, the above angles are defined as interval 5; when the angle between the writing direction and the X-axis is ∠285° to ∠345°, it is usually a right-falling stroke, and in this embodiment, the above angles are defined as interval 6.

[0037] Obtain the coordinates P, writing time T, and distance H between adjacent stroke points during the writing process; calculate the writing speed V between adjacent points; measure the angle θ of the line connecting adjacent stroke points relative to the horizontal X-axis; calculate the difference {θ1, θ2, ..., θn-1} between adjacent angles θ; the expression for the current writing trajectory is as follows:

[0038] P = {P1,P2,……,Pn};

[0039] T = {T1, T2,……, Tn-1};

[0040] L = {L1,L2,……,Ln-1};

[0041] V = {V1,V2,……,Vn-1};

[0042] Θ = {θ1,θ2,…,θn-1};

[0043] The total length of the current writing trajectory L total = L1 + L2 + …… + Ln-1.

[0044] The baseline length of the current stroke is calculated based on the total length of the writing trajectory and the line width of the system's soft pen, thus determining the stroke type; the total length of the current writing is then... Divide by the current system's preset soft-pen line width W to obtain the baseline length of the stroke. The reference length is compared with the length of a stroke point in the soft brush. To make a comparison, if If the stroke type of the writing trajectory is considered to be "point", then... If so, then the stroke type of the writing trajectory is not considered to be "dot".

[0045] Once the writing trajectory is determined to be a "point," it is further determined whether the "point" is a "turning point" or a "pause point." The specific key feature model of the stroke is then determined. Based on the type of writing trajectory, the scaling factors for the stroke width and length are calculated. The center point Pc of all stroke points in the current actual stroke is calculated, along with the offset of all stroke points relative to the center point Pc and the average angle Θc between the line connecting each adjacent stroke point and the X-axis. Taking the "pause point" as an example, the average angle Θc between the center point Pc and the line connecting each adjacent stroke point and the X-axis is as follows: Figure 6 As shown, since the writing speed V is negatively correlated with the pen width, the scaling factor for the width is calculated as follows: β is an empirical coefficient; the scaling factor for length. The reference length of this writing trajectory Divide by the total length of the key feature model of the stroke Therefore, the method for calculating the length scaling factor is as follows: .

[0046] Based on the vector point coordinates Pf stored in the stroke key feature model, the offset of each stroke point from the center point Pc during actual writing, the average angle Θ between the line connecting each adjacent stroke point and the X-axis, and the scaling factors for width and length, the final set of the restored point trajectory `P is obtained; the specific calculation method is as follows:

[0047] ;

[0048] in The X-axis coordinates of the restored stroke points. The Y-axis coordinates of the restored stroke points. and for and These are the offsets between the stroke point and the center point, respectively. and These are the X-axis and Y-axis coordinates of the corresponding vector coordinates in the stroke key feature model, respectively.

[0049] Perform Bézier curve fitting on the reconstructed trajectory set points, and connect all the stroke points in sequence to form a closed region. Filling the region will yield the final pen writing trajectory.

[0050] If Ls > Lpmax, then the writing trajectory is considered a normal stroke, and the corresponding processing steps are as follows:

[0051] For example Figure 7 Taking the "horizontal stroke with a hook" as an example, the current writing trajectory is divided into three parts: the beginning, the middle, and the end.

[0052] L header = {L1,L2,…, Li};

[0053] L middle = { Li+1,Li+2,…, L j};

[0054] L tail = { L j+1,L j+2,……, Ln-1};

[0055] L total = L header + L middle + L tail;

[0056] Where Lheader and Ltail are preset fixed values, and Lmiddle is a variable writing trajectory length. Similarly, we can obtain:

[0057] P = P header + P middle + P tail;

[0058] V = V header + V middle + V tail;

[0059] Θ = Θ header + Θ middle + Θ tail.

[0060] like Figure 8 As shown, for the head segment, by calculating the difference in angles between the beginning and end of the Θ header, it can be determined whether there is a pen turning point in the head segment trajectory; simultaneously, the angle between the line connecting the beginning and end stroke points of the Θ header and the X-axis is queried, and the basic stroke is obtained by comparing it with the interval table. A matching key feature model of the stroke is selected, and the key point Pf of the trajectory is matched from the key feature model of the stroke. The center point Pch is calculated from P header; the reference length of the head segment is the head segment length divided by the preset line width, i.e., Lsh = L header / W, and the average offset angle Θch along the X-axis is calculated from Θ header.

[0061] Since speed is negatively correlated with line width, the scaling factor Wph for the width of the point is obtained from V header, Wph = β*1 / V header, where β is an empirical coefficient; the scaling factor length Lph of the header segment is the reference length Lsh of the writing trajectory divided by the total length W left + W right of the key feature model of the stroke, that is: Lph = Lsh / (W left + W right).

[0062] Based on the vector point coordinates Pf stored in the stroke key feature model, the offset of each stroke point from the center point Pch during actual writing, the average angle Θ between the line connecting each adjacent stroke point and the X-axis, and the scaling factors for width and length, the final set of the restored point trajectory `P header set is obtained:

[0063] ;

[0064] The tail end is processed in the same way to obtain the tail end trajectory set `P tail.

[0065] like Figure 8 As shown, for the middle section, the intervals with small angle changes in the writing trajectory are denoted as "line," and the intervals with large angle changes and bends are denoted as "corner." That is, the segment is divided by calculating whether the variance of the angles in Θmiddle exceeds a threshold. If it does, the segment is split, and by traversing all angles in Θmiddle, the trajectory of all bends in the middle section can be obtained, represented as:

[0066] Θ middle = {Θ line1, Θ corner1, Θ line2, Θ corner2, ..., Θ cornern, Θ line n}, where Θ line represents a set of angles with small angle changes that do not exceed the threshold, and Θ corner represents a set of angles with significant angle changes that exceed the threshold. Similarly:

[0067] L middle = {L line1,L corner1, L line2,L corner2,……, L corner n, Lline n};

[0068] P middle = {P line1,P corner1, P line2,P corner2,……, P corner n, Pline n};

[0069] V middle = {V line1,V corner1, V line2,V corner2,……, V corner n, Vline n};

[0070] For the interval line, take N equally divided points from the stroke area, connect the N points as the X-axis, and the tangent direction of the connecting line is the Y-axis. Extend W p line on both sides of the Y-axis, where W p line = β*1 / V line, where β is an empirical coefficient. Finally, obtain the points located to the left and right of the connecting line of these points, respectively, denoted as `P line left , `P line right ;

[0071] For the corner interval, the processing method is the same as for the first and last segments, resulting in the set of points whose trajectories have been restored: `P corner = { `P t1, `P c1, `P t2, `P c2, ..., `P t n-1, `P c n-1, `P tn}. Then, the points to the left of the line connecting L corners are denoted as `P corner left`, and the points to the right are denoted as `P corner right`, i.e.: `P corner = `P corner left + `P corner right`. Thus, the set of all points in the restored middle segment is obtained, described according to their position on the left or right side of the connecting line:

[0072] `P middle left = { `P line left 1, `P corner left 1,`P line left 2, `P corner left 2,...`P line left n, `P corner left n};

[0073] `P middle right = { `P line right 1, `P corner right 1,`P line right2, `P corner right 2,...`P line right n, `P corner right n};

[0074] Therefore, the entire writing trajectory can be described as follows:

[0075] `P = `P header + `P middle left + `P tail + `P middle right;

[0076] Finally, draw the Bézier curves sequentially according to the stroke points and control points in `P`, forming a closed region. Filling this region will yield the result shown below. Figure 9 The writing trajectory of the "horizontal stroke with a hook" is shown.

Claims

1. A method for drawing handwriting with a soft brush, characterized in that, The method includes the following steps: Step 1: Establish stroke feature models for different stroke samples and obtain vector coordinate data Pf for each stroke point; Step 2: Divide the stroke intervals according to the angle between the stroke and the horizontal X-axis; Step 3: Obtain the coordinates P, writing time T, and distance L between two adjacent strokes during the writing process; calculate the writing speed V between two adjacent strokes; measure the angle θ of the line connecting two adjacent strokes relative to the horizontal X-axis; and calculate the difference between each pair of adjacent angles θ {θ1, θ2, ..., θn-1}. Step 4: Determine the type of stroke in the writing and match it with the established stroke feature model; Step 5: Based on the scaling factor of the width and length of the written strokes, the offset of the center point Pc of the stroke relative to the center point in the stroke feature model, the average value Θc of the angle between the line connecting each two adjacent stroke points and the horizontal X-axis, and the vector coordinate data Pf of each stroke point in the stroke feature model, obtain the set of stroke points for the current writing trajectory. Once the stroke type is determined to be "dot", the scaling factor for the width is calculated as follows: β is an empirical coefficient; the length scaling factor is calculated as follows: ,in The distance between the furthest left-hand stroke point and the center stroke point Pc is given. The distance between the furthest rightmost stroke point and the center stroke point Pc is given. This is the baseline length for the stroke; If it is determined that the stroke type is not "dot", that is hour, To determine the length of a stroke in a soft-tipped brush, the writing trajectory is divided into three segments: the beginning segment, the middle segment, and the end segment. Each segment is processed separately to obtain the set of stroke points for the entire writing handwriting. The length of the beginning segment is... and the length of the tail segment The length of the middle section is a preset fixed value. For variable length, the angle between the line connecting the first and last stroke points of the first and last segments and the horizontal X-axis is compared with the interval defined in step 2 to match the corresponding stroke feature model. The specific calculation methods for the length and width scaling factors of the beginning and end segments are as follows: The width scaling factor of the beginning segment is... The width scaling factor for the tail section is... The length scaling factor for the head section is... The length scaling factor for the tail segment is: ;in , These represent the writing speeds of two adjacent points at the beginning and end of the segment, respectively. and These are the reference lengths of the first and last strokes, respectively, where β is an empirical coefficient. The length between the furthest left stroke point and the center stroke point Pc. The length between the farthest right stroke point and the center stroke point Pc; Step 6: Perform curve fitting on the set of stroke points to form a closed region, and fill the closed region to obtain the final soft pen writing trajectory.

2. The method for drawing handwriting with a soft brush according to claim 1, characterized in that, Step 4 specifically involves calculating the total length of the current handwriting. Divide by the current system's preset soft-pen line width W to obtain the baseline length of the stroke. The reference length is compared with the length of a stroke point in the soft brush. To make a comparison, if If the stroke type of the writing trajectory is considered to be "dot", then... If so, then the stroke type of the writing trajectory is not "dot".

3. The method for drawing handwriting with a soft brush according to claim 2, characterized in that, Step 4 also includes that when the type of soft brush stroke is determined to be "dot", if there is a value in {θ1, θ2, ..., θn-1} that exceeds the threshold θm, then the "dot" is a "turning stroke starting point", otherwise it is a "pause stroke starting point".

4. The method for drawing handwriting with a soft brush according to claim 1, characterized in that, The processing method for the middle section is as follows: The stroke segments with an angle variation variance not exceeding a fixed threshold are denoted as "lines," and the stroke regions with an angle variation variance exceeding the threshold are denoted as "corners." This yields all bends in the middle section. Simultaneously, the coordinates of all stroke points, the distance between adjacent stroke points, and the writing speed are calculated. For each "line," N equal division points are taken from the stroke region, and the line is extended towards the tangent of the line connecting these N points. Obtain the set of stroke points `P_line` for the interval `line`, where Where β is an empirical coefficient, The writing speed of the interval line; The trajectory set `Pcorner` of the restored stroke points of the corner region is obtained using the same trajectory acquisition method as the first and last segments. Connect the set of stroke points `P_line` of all interval lines and the set of stroke points `P_corner` of all corner regions after restoration, according to the order in which the lines and corners are written, to obtain the complete set of stroke point trajectories for the middle section.

Citation Information

Patent Citations

  • Method and device of beautifying handwriting input

    CN103164865A

  • Handwriting quality evaluation method, device and equipment and storage medium

    CN112183046A