Handwriting generation method, device and equipment and computer readable storage medium
By smoothing the erase report points on the electronic ink screen of the e-book reader and trajectory regenerate, the problems of large amount of calculation and low accuracy in the handwriting erasing operation of the electronic ink screen are solved, and the erase accuracy and efficiency are improved .
Patent Information
- Application Number
- CN202310787884.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
When performing handwriting erasing operations, the electronic ink screen of the e-book reader is limited by the screen size and high point-report rate, resulting in large amount of erasing calculations and inability to ensure accuracy.
By smoothing multiple erase reports, the erase track is determined, and the handwriting is regenerated according to the erase area in the writing track, and the writing track is updated to improve erase accuracy and efficiency.
The erase calculation amount is reduced, the erase accuracy and efficiency is improved, and the problem of low precision caused by waste of repeated reporting points and excessive spacing is avoided.
Smart Images

Figure CN119225613A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of display technology, and in particular to a handwriting generation method, device, equipment and computer-readable storage medium. Background Art
[0002] At present, with the popularization of mobile terminals and the development of e-book readers, e-books are becoming more and more popular among readers. At the same time, in order to further improve the user experience of e-book users, more and more e-book readers have handwriting touch functions, which support users to use electromagnetic pens to write notes on the reader screen, and users can also erase the written notes by executing operations.
[0003] E-book readers are usually electronic ink screens, which receive point reporting data in response to the user's touch operation, thereby generating a writing track or an erasing track. Since the electronic ink screen is small and has a high point reporting rate, the point reporting data in the writing track and the erasing point reporting in the erasing track are relatively dense. In this case, the amount of calculation is large when performing the erasing operation, and the erasing accuracy cannot be guaranteed. Summary of the invention
[0004] The embodiments of the present disclosure provide a handwriting generation method, apparatus, device and computer-readable storage medium.
[0005] In a first aspect, an embodiment of the present disclosure provides a handwriting generation method, which is applied to an electronic ink screen, and is characterized in that the method comprises:
[0006] In response to the handwriting erasing operation, a plurality of first erasing reporting points are obtained;
[0007] Smoothing the plurality of first erasure reporting points to determine an erasure trajectory;
[0008] Determine an erasure area in the writing track according to the erasure track and the pre-acquired writing track; and perform erasure processing on the erasure area;
[0009] According to the remaining reporting points in the writing trajectory outside the erasing area, the handwriting is regenerated as an updated writing trajectory.
[0010] In some embodiments, the step of smoothing the plurality of first erasure reporting points to determine the erasure trajectory includes:
[0011] Based on a preset erasure accuracy, determining invalid reporting points and intervals to be supplemented in the first erasure reporting points;
[0012] Deleting the invalid reporting points, and supplementing a preset number of supplementary reporting points in the interval to be supplemented, to form a smoothed second erasure reporting point;
[0013] According to the erasing accuracy, a corresponding erasing pattern is configured for each of the second erasing reporting points, each of the erasing patterns constitutes the erasing track, and the erasing pattern is a pattern with the second erasing reporting point as the geometric center.
[0014] In some embodiments, the determining, based on a preset erasure accuracy, invalid reporting points and intervals to be supplemented in the first erasure reporting points includes:
[0015] Determine, according to a preset erasing precision, an effective distance range between any two adjacent first erasing reporting points among the plurality of first erasing reporting points;
[0016] When the distance between two adjacent first erasure reporting points is less than the effective distance range, the latter of the two adjacent first erasure reporting points is determined as the invalid reporting point;
[0017] When the distance between two adjacent first erasure reporting points is greater than the effective distance range, the area between the two adjacent first erasure reporting points is determined as the to-be-supplemented interval.
[0018] In some embodiments, the replenishing of a preset number of replenishment reporting points within the interval to be replenished includes:
[0019] Based on the Bezier curve, the coordinate value of each of the supplementary reporting points is determined.
[0020] In some embodiments, determining the erased area in the writing trajectory according to the erased trajectory and the pre-acquired writing trajectory includes:
[0021] The writing trajectory includes a plurality of writing strokes, and the plurality of writing strokes are detected to determine at least one target stroke intersecting with the erasing trajectory;
[0022] The target stroke is detected, at least one overlapping region of the target stroke and the erasure trajectory is determined, and the at least one overlapping region is determined as the erasure region.
[0023] In some embodiments, detecting a plurality of the written strokes and determining at least one target stroke intersecting with the erasing trajectory comprises:
[0024] For each of the written strokes, the following steps are performed:
[0025] Determine the enclosing area of the writing stroke according to the coordinate information and time information corresponding to each writing reporting point in the writing stroke, wherein the enclosing area is the minimum circumscribed rectangular area of the writing stroke;
[0026] In the case where the enclosed area overlaps with the erasing track, the writing stroke corresponding to the enclosed area is determined as the target stroke.
[0027] In some embodiments, regenerating handwriting according to the remaining reporting points in the writing trajectory outside the erasure area as an updated writing trajectory includes:
[0028] The target stroke includes a plurality of writing points, traversing the plurality of writing points, determining at least one target writing point located in the erasing area; and clearing the target writing point;
[0029] generating at least two updated strokes according to the remaining strokes in the target stroke except the target stroke;
[0030] The at least two updated strokes corresponding to each of the target strokes are used as the updated writing trajectory.
[0031] In some embodiments, generating at least two updated strokes according to remaining strokes in the target stroke except the target stroke includes:
[0032] Based on at least one overlapping area included in the erasing area, the remaining reporting points corresponding to the target stroke are divided into at least two groups, and two adjacent groups of remaining reporting points are located on both sides of the overlapping area;
[0033] According to the coordinate information and time information corresponding to the remaining reporting points, the update strokes corresponding to each group of the remaining reporting points are drawn and generated.
[0034] In some embodiments, before regenerating handwriting based on the remaining reporting points in the writing trajectory outside the erasure area, the method further includes:
[0035] The writing trajectory includes a plurality of writing strokes, and the following steps are performed for each writing stroke:
[0036] The writing strokes are smoothed to determine the smoothed writing strokes, wherein the smoothed writing strokes include a plurality of first writing points, and the distance between any two adjacent first writing points is within a preset range.
[0037] In some embodiments, in response to the handwriting erasure operation, before obtaining a plurality of first erasure reporting points, the method further includes:
[0038] In response to the mode selection operation, it is determined that the current input mode is the erase mode.
[0039] In a second aspect, an embodiment of the present disclosure provides a handwriting generation device, the device comprising:
[0040] An acquisition module, configured to obtain a plurality of first erasure reporting points in response to a handwriting erasure operation;
[0041] A first determination module is configured to perform smoothing processing on the plurality of first erasure reporting points to determine an erasure trajectory;
[0042] A second determination module is configured to determine an erased area in the writing track according to the erased track and the pre-acquired writing track; and perform an erase process on the erased area;
[0043] The handwriting generation module is configured to regenerate handwriting as an updated writing trajectory according to the remaining reporting points in the writing trajectory outside the erasure area.
[0044] In a third aspect, an embodiment of the present disclosure provides a handwriting generation device, comprising:
[0045] at least one processor; and
[0046] a memory communicatively connected to the at least one processor; wherein,
[0047] The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor so that the at least one processor can execute the handwriting generation method as described in the first aspect.
[0048] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the handwriting generation method as described in the first aspect.
[0049] In the handwriting generation method provided by the embodiment of the present disclosure, the first erasure reporting point is smoothed, on the one hand, to avoid wasting computing resources by repeated reporting points or reporting points with small spacing, and on the other hand, to improve the defect of reducing the erasure precision by reporting points with too large spacing; further, the erasure area is determined according to the erasure trajectory and the writing trajectory, and the handwriting is regenerated according to the writing reporting points outside the erasure area. Compared with the related art, due to the uneven movement speed of the electromagnetic pen or finger on the electronic ink screen, the first erasure reporting point generated is uneven, and the distance between two adjacent reporting points is sometimes too small and sometimes too large. When the distance between two adjacent reporting points is small, the latter reporting point has been covered by the erasure range corresponding to the previous reporting point. In this case, it will cause a waste of calculation. When the distance between two adjacent reporting points is large, it will affect the precision of erasure, and the user experience is not good. In this scheme, by smoothing the erasure reporting points, the intervals between the erasure reporting points are made more uniform and closer, thereby improving the erasure precision while reducing the number of judgments and improving the erasure efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0051] Figure 1 A flowchart of a handwriting generation method provided in an embodiment of the present disclosure.
[0052] Figure 2 A flowchart of another handwriting generation method provided in an embodiment of the present disclosure.
[0053] Figure 3 A schematic diagram of a handwriting erasing effect provided in an embodiment of the present disclosure.
[0054] Figure 4 An enlarged schematic diagram of an erasing track provided in an embodiment of the present disclosure.
[0055] Figure 5 A schematic diagram of a supplementary reporting point provided in an embodiment of the present disclosure.
[0056] Figure 6 A schematic diagram of the structure of a handwriting generation device provided in an embodiment of the present disclosure.
[0057] Figure 7 A schematic diagram of the structure of a handwriting generation device provided in an embodiment of the present disclosure.
[0058] Figure 8 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0059] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0061] Unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not represent any order, quantity or importance, but are only used to distinguish different components. Similarly, "including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0062] Electronic ink screen devices are also called handwriting reading devices. Their display material is electronic ink. These electronic inks are in a capsule structure. Inks of different colors are attached to positive and negative charges. After power is turned on, the positive and negative voltages make the charges with different colors of ink attract or repel each other, change the arrangement of charges, and display text and pictures. Electronic ink is composed of tiny capsules, the size of which is about the diameter of a human hair. Each capsule contains multiple liquid particles mixed with black and white, with white particles carrying negative charges and black particles carrying positive charges. According to the principle that like repels like and opposites attract, as long as positive and negative charges are added on both sides of the capsule as needed, the black and white particles can swim according to certain rules, thereby displaying white or black, forming various texts and patterns.
[0063] The electronic ink screen does not need a backlight. It uses ambient light to shine on the display screen and then refract into the human eye. Compared with the traditional display screen that uses backlight emission and the light needs to pass through the display screen before entering the eye, the electronic ink screen simulates the characteristics of ink and paper, and because there is no light flicker, the eyes are not easily fatigued when reading for a long time. In addition, the electronic ink screen can continuously display the picture without power supply, and only consumes a small amount of power when the picture changes, such as when the screen refreshes when turning pages. This feature greatly reduces power consumption. Therefore, the display based on the electronic ink screen is closer to ordinary paper, which can relieve eye pressure and has the characteristics of low power consumption, and is increasingly favored by readers.
[0064] In order to further improve the user experience of electronic ink screens, more and more electronic ink screens support users to add handwriting on the screen with electromagnetic pens, and users can also erase existing handwriting by performing corresponding operations. However, due to the small size of electronic ink screens and the high reporting rate, the reporting data in the writing track and the erasing points in the erasing track are relatively dense. In this case, the amount of calculation is large when performing the erasing operation, and the erasing accuracy cannot be guaranteed.
[0065] In order to solve at least one of the above technical problems, the embodiments of the present disclosure provide a handwriting generation method, which reduces the amount of erasing calculation and improves the erasing accuracy when performing handwriting erasing operations on an electronic ink screen.
[0066] Figure 1 A flow chart of a handwriting generation method provided by an embodiment of the present disclosure is shown as follows: Figure 1 As shown, in some embodiments, the handwriting generation method includes steps S1 to S4, specifically:
[0067] Step S1, in response to a handwriting erasing operation, a plurality of first erasing reporting points are obtained.
[0068] Specifically, the handwriting erasing operation can be generated by the user using an electromagnetic pen or a finger to perform a touch operation on the electronic ink screen. For example, an erase button is set at a certain position on the electronic ink screen or the currently displayed page. The user triggers the erase button to enter the handwriting erasing mode. Further movement operations generated by the electromagnetic pen or a finger on the electronic ink screen are recognized as handwriting erasing operations. The handwriting erasing operation will generate an erasing track on the currently displayed page.
[0069] In addition, when an erasing track is generated following the handwriting erasing operation, the first erasing reporting point of the erasing track will be saved. The reporting point data corresponding to the above-mentioned first erasing reporting point includes coordinate information, time information and erasing accuracy information, which is specifically described in the following embodiment.
[0070] Step S2, smoothing the plurality of first erasure reporting points to determine an erasure trajectory.
[0071] In the handwriting erasing operation, due to the uneven movement speed of the electromagnetic pen or finger on the electronic ink screen, the first erasing points generated are uneven, and the distance between two adjacent points is sometimes too small and sometimes too large. At this time, multiple first erasing points are smoothed so that the spacing between the smoothed erasing points is uniform, thereby achieving a more realistic and accurate erasing effect.
[0072] Step S3, determining the erasure area in the writing track according to the erasure track and the pre-acquired writing track; and performing erasure processing on the erasure area.
[0073] Step S4, regenerates the handwriting according to the remaining reported points in the writing trajectory outside the erased area as the updated writing trajectory.
[0074] In the handwriting generation method provided by the embodiment of the present disclosure, the first erasure reporting point is smoothed, on the one hand, to avoid wasting computing resources by repeated reporting points or reporting points with small spacing, and on the other hand, to improve the defect of reducing the erasure precision by reporting points with too large spacing; further, the erasure area is determined according to the erasure trajectory and the writing trajectory, and the handwriting is regenerated according to the writing reporting points outside the erasure area. Compared with the related art, due to the uneven movement speed of the electromagnetic pen or finger on the electronic ink screen, the first erasure reporting point generated is uneven, and the distance between two adjacent reporting points is sometimes too small and sometimes too large. When the distance between two adjacent reporting points is small, the latter reporting point has been covered by the erasure range corresponding to the previous reporting point. In this case, it will cause a waste of calculation. When the distance between two adjacent reporting points is large, it will affect the precision of erasure, and the user experience is not good. In this scheme, by smoothing the erasure reporting points, the intervals between the erasure reporting points are made more uniform and closer, thereby improving the erasure precision while reducing the number of judgments and improving the erasure efficiency.
[0075] Figure 2 A flowchart of another handwriting generation method provided by an embodiment of the present disclosure is shown in FIG. Figure 3 A schematic diagram of a handwriting erasing effect provided by an embodiment of the present disclosure. In some embodiments, such as Figure 2 As shown, before step S1, the method further includes:
[0076] Step S0, in response to the mode selection operation, determining that the current input mode is the erase mode.
[0077] Specifically, the above-mentioned mode selection operation may be a user triggering an "erase icon" on the currently displayed page, or a user triggering an "erase button" on the electronic ink screen, which is not limited in the present embodiment. Figure 3 As shown, the user touches / clicks the "erase icon" on the currently displayed page to enter the erase mode.
[0078] Similarly, before the handwriting operation is performed, in response to the mode selection operation, the current input mode is determined to be the writing mode, and the operation of selecting the writing mode and the erasing mode is the same. The user can switch the mode before performing the corresponding operation. In addition, the display page also includes other function icons, and before the user performs the corresponding operation, the trigger function graphic can be awakened / entered into the corresponding operation.
[0079] Figure 2 A flow chart of a handwriting generation method provided by an embodiment of the present disclosure is provided. In some embodiments, for example, Figure 2 As shown, the above step S2 includes steps S21 to S23:
[0080] Step S21, based on the preset erasure accuracy, determining the invalid reporting points and the interval to be supplemented in the first erasure reporting points.
[0081] It should be understood that in the erasing mode, the erasing range is the graphic area centered on the erasing point, and graphic areas of different sizes represent different erasing widths. Figure 3 As shown, different erasing widths are formed under different erasing accuracies. Figure 3 , wherein the erasing track c1 and the erasing track c2 have the same erasing width, and the two can be the same track or two independently formed tracks, and the erasing track c3 has a greater erasing width than the erasing tracks c1 and c2. Furthermore, based on the same smooth reporting rule, under different erasing accuracies, the thresholds for filtering or supplementing reporting points are different.
[0082] Specifically, step S21 may include steps S01 to S03:
[0083] S01, determining an effective distance range between any two adjacent first erasure reporting points among a plurality of first erasure reporting points according to a preset erasure accuracy.
[0084] In one example, according to the requirement of erasing accuracy, the effective distance between two reporting points is 2-4 times of the erasing width. When the erasing range is set to a rectangular area of 10*10, that is, the erasing width is 10, the effective distance range between two adjacent first erasing reporting points is 20-40. It should be noted that the units of the above width, distance, and distance range all refer to the number of pixels. For example, an erasing width of 10 means that the erasing width is 10 pixels.
[0085] S02: When the distance between two adjacent first erasure reporting points is less than the effective distance range, the latter of the two adjacent first erasure reporting points is determined as an invalid reporting point.
[0086] In one example, the distance between two adjacent first erase reporting points is 15. When the above-mentioned erasing precision is relatively small, for example, when the erasing range is set to a 5*5 rectangular area, the effective distance range is 10-20, and the two first erase reporting points are both valid reporting points. When the above-mentioned erasing precision is relatively large, for example, when the erasing range is set to a 40*40 rectangular area, the effective distance range is 80-160, and the erasing range corresponding to the previous reporting point has covered the next reporting point. At this time, in order to save computing resources, there is no need to generate the erasing range corresponding to the next reporting point, and therefore the next reporting point is determined as an invalid reporting point.
[0087] S03: When the distance between two adjacent first erasure reporting points is greater than the effective distance range, the area between the two adjacent first erasure reporting points is determined as a to-be-supplemented interval.
[0088] In one example, the distance between two adjacent first erasure reporting points is 40. When the above-mentioned erasure accuracy is relatively small, for example, when the erasure range is set to a 5*5 rectangular area, the effective distance range is 10-20. At this time, the distance between two adjacent first erasure reporting points exceeds the maximum value of the effective distance range. The area between the two adjacent first erasure reporting points is determined as the interval to be supplemented, that is, a preset number of second erasure reporting points are supplemented between the two, thereby improving the accuracy of the erasure trajectory.
[0089] Step S22, deleting the invalid reporting points, and supplementing a preset number of supplementary reporting points in the interval to be supplemented, to form a smoothed second erasure reporting point.
[0090] Figure 4 An enlarged schematic diagram of an erasing track provided by an embodiment of the present disclosure. In one example, the plurality of first erasing reporting points include a plurality of valid reporting points and at least one invalid reporting point. After filtering out the invalid reporting points and supplementing the corresponding supplementary reporting points, smoothing is completed. At this time, Figure 4 As shown, the smoothed plurality of second erasure reporting points include a plurality of effective reporting points and at least one supplementary reporting point.
[0091] Step S23, according to the erasing accuracy, a corresponding erasing pattern is configured for each second erasing reporting point, each erasing pattern constitutes an erasing track, and the erasing pattern is a pattern with the second erasing reporting point as the geometric center.
[0092] It should be understood that the erasing pattern may be a rectangle, a circle, or other polygons, and the embodiments of the present disclosure are not limited thereto.
[0093] In one example, if Figure 4 As shown, the erasing pattern may be a rectangle, and the above-mentioned erasing width may refer to the length of the wide side of the rectangle. It should be noted that when the erasing pattern is a rectangle, the long side and the wide side of the rectangle extend in the same direction as the long side and the wide side of the electronic ink screen. Figure 4 As shown, the erasing track is composed of erasing graphics corresponding to multiple second erasing reporting points.
[0094] The specific process of supplementary reporting points provided by the embodiments of the present disclosure is described in detail below in conjunction with specific embodiments.
[0095] In some embodiments, the step of supplementing a preset number of supplementary reporting points within the interval to be supplemented includes: determining the coordinate value of each supplementary reporting point based on a Bezier curve.
[0096] Figure 5A schematic diagram of a supplementary reporting point provided in an embodiment of the present disclosure, such as Figure 5 As shown, the point filling operation between two adjacent second erased reporting points b1 and b2 can be realized by relying on the second-order Bezier curve. Specifically, the second-order Bezier curve includes the starting point P0, the control point P1 and the drawing end point P2, wherein the coordinate value of P1 is the coordinate value of the previous second erased reporting point b1, P2 is the coordinate value of the midpoint b12 between the two second erased reporting points b1 and b2, and P0 is the coordinate value of the focus b01 between the second erased reporting point b1 and the previous reporting point b0 of b1. Point B is a first-order Bezier curve from point Q1 to point Q2, while point Q1 is a first-order Bezier curve from point P0 to point P1, and point Q2 is a first-order Bezier curve from point P1 to point P2. As time t changes, the positions of points Q1 and Q2 will change, so that point P will move along a curve from P0, P1 to P2, and the curve is a smooth curve.
[0097] Among them, point B is the interpolation point corresponding to different values of t (the range of t is 0-1), and the value of time t is related to the number of supplementary points. For example, if the number of supplementary reporting points inserted is 9, the value of t can be 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9. Specifically, the coordinates of point B can be determined by the following formula:
[0098] B(t)=(1-t) 2 P 0 +2(1-t)P 1 +t 2 P 2 , t∈[0,1]
[0099] In some embodiments, Figure 2 As shown, the above step S3 may specifically include:
[0100] Step S31: the writing trajectory includes a plurality of writing strokes, the plurality of writing strokes are detected, and at least one target stroke intersecting with the erasing trajectory is determined.
[0101] With such a setting, the strokes that have no intersection with the erasing track can be filtered out first, and there is no need to detect every writing stroke and every reporting point in the writing track, thereby reducing the amount of calculation and improving the erasing efficiency.
[0102] Step S32, detecting the target stroke, determining at least one overlapping region of the target stroke with the erasure trajectory, and determining the at least one overlapping region as the erasure region.
[0103] Step S33, erasing the erasure area.
[0104] Specifically, the writing points within the erasing area are deleted.
[0105] It should be noted that the detection order of multiple writing strokes can be determined according to the formation time of the writing strokes, and the formation time of the writing strokes can be determined according to the time information of the writing reporting point. The specific process will not be repeated here.
[0106] like Figure 3 As shown, multiple writing strokes are shown in the figure. When the erasing tracks c1 and c2 are the same track, there can be one or more overlapping areas between the same erasing track and a writing stroke. Then at least one overlapping area in the same writing stroke constitutes the erasing area of the writing stroke.
[0107] In the handwriting generation method provided by the embodiment of the present disclosure, the erasure track is formed based on the second erasure reporting point after smoothing, and the erasure area that needs to be erased is determined according to the overlapping area of the erasure track and the writing track. By smoothing the erasure reporting points, the intervals between the erasure reporting points are made more uniform and closer, further improving the accuracy of the erasure area, thereby improving the erasure precision while reducing the number of judgments and improving the erasure efficiency.
[0108] In some embodiments, step S31 includes:
[0109] The following steps are performed for each written stroke: based on the coordinate information and time information corresponding to each writing point in the written stroke, the enclosing area of the written stroke is determined, wherein the enclosing area is the minimum circumscribed rectangular area of the written stroke; when the enclosing area overlaps with the erasing trajectory, the written stroke corresponding to the enclosing area is determined as the target stroke.
[0110] Among them, the enclosing area of the written strokes is determined based on the reporting point coordinate information and time information corresponding to the reporting points of the strokes. The enclosing area encloses the coordinates corresponding to these reporting points, and the enclosing area does not consider the display effects such as the thickness and pen tip of the strokes. For example, these reporting points are connected in chronological order, and the width of the connecting line is a preset value. The enclosing area can be the minimum circumscribed rectangular area of the connecting line. By searching for the target stroke according to the enclosing area, only the written reporting points in the target stroke are further detected to reduce the amount of calculation and improve the detection efficiency.
[0111] In some embodiments, Figure 2 As shown, the above step S4 may specifically include:
[0112] Step S41, the target stroke includes a plurality of writing points, the plurality of writing points are traversed, at least one target writing point located in the erasing area is determined; and the target writing point is cleared.
[0113] Specifically, since the handwriting erasing operation is based on the existing writing trajectory, the erasing points of the erasing trajectory generated by the handwriting erasing operation overlap with the writing points of the writing trajectory. The point data of the overlapping part is determined as the point data to be cleared in the writing trajectory, that is, the target point, and then the above-mentioned target point is cleared.
[0114] Step S42, generating at least two updated strokes according to the remaining reporting points in the target stroke except the target reporting point.
[0115] Specifically, based on at least one overlapping area included in the erase area, the remaining reporting points corresponding to the target strokes are divided into at least two groups, and two adjacent groups of remaining reporting points are located on both sides of the overlapping area; according to the coordinate information and time information corresponding to the remaining reporting points, updated strokes corresponding to each group of remaining reporting points are drawn and generated.
[0116] Furthermore, the erased points in the erased track include coordinate information, time information, and line information (erased width). Similarly, the writing points corresponding to the writing track also include the above coordinate information, time information, and line information, and the writing points may also include the writing type (for example, pen, pencil), etc. After the erasing step of the target points in step S41, the remaining points of the target stroke may be truncated into multiple tracks. This step can directly redraw / generate the writing strokes according to the remaining points after the erasing operation is completed to form an updated stroke.
[0117] Step S43: taking at least two updated strokes corresponding to each target stroke as an updated writing trajectory.
[0118] The updated writing trajectory includes the initial writing strokes that do not intersect with the erasing trajectory, and the updated strokes that are regenerated based on the target strokes.
[0119] In addition, the regenerated updated stroke is obtained by connecting each reporting point in time sequence, and the width of the center line of the stroke is a preset width, for example, the preset width can be a pixel-level size, which is not limited in the embodiments of the present disclosure.
[0120] In some embodiments, before step S4, the method may further include: the writing trajectory includes a plurality of writing strokes, and performing the following steps for each writing stroke:
[0121] Smoothing is performed on the writing strokes to determine the smoothed writing strokes, wherein the smoothed writing strokes include a plurality of first writing reporting points, and the distance between any two adjacent first writing reporting points is within a preset range.
[0122] Similarly, in the embodiment of the present disclosure, the first erasure reporting point (initial erasure reporting point) in the erasure trajectory is smoothed, and the first writing reporting point (initial writing reporting point) in the writing trajectory / writing stroke can also be smoothed. That is, the effective reporting point range is determined according to the writing accuracy. When the distance between adjacent writing reporting points is less than the effective reporting point range, the next writing reporting point is determined as an invalid reporting point and filtered out; when the distance between adjacent writing reporting points is greater than the effective reporting point range, a supplementary reporting point is added between the two writing reporting points. The specific process is the same as the supplementary reporting point process in the erasure reporting point, and will not be repeated here. By smoothing the writing trajectory, the authenticity of the handwriting is simulated, and a more delicate handwriting is obtained.
[0123] In addition, for multiple writing points in the smoothed writing strokes, the spacing between adjacent writing points is uniform and small. After determining the erasure area, the spacing between the remaining writing points outside the erasure area and the erasure area will also be reduced, thereby improving the erasure fineness.
[0124] Based on the same inventive concept mentioned above, an embodiment of the present disclosure provides a handwriting generation device, which is used to execute the handwriting generation method mentioned above. Figure 6 A schematic diagram of the structure of a handwriting generation device provided in an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the handwriting generation device includes: an acquisition module 10 , a first determination module 20 , a second determination module 30 and a handwriting generation module 40 .
[0125] The acquisition module 10 is configured to obtain a plurality of first erasure reporting points in response to a handwriting erasure operation.
[0126] The first determination module 20 is configured to perform smoothing processing on the plurality of first erasure reporting points to determine an erasure trajectory.
[0127] The second determination module 30 is configured to determine the erasure area in the writing trajectory according to the erasure trajectory and the pre-acquired writing trajectory; and perform an erasure process on the erasure area.
[0128] The handwriting generation module 40 is configured to regenerate handwriting according to the remaining reporting points in the writing trajectory outside the erasure area as an updated writing trajectory.
[0129] The functions of each module are described in the above handwriting generation method and will not be repeated here.
[0130] Figure 7 A schematic diagram of the structure of a handwriting generation device provided in an embodiment of the present disclosure is shown in FIG. Figure 7As shown, the electronic device 100 includes: a memory 101 and a processor 102. The memory 101 stores a computer program, wherein the computer program is executed by the processor 102 to implement the above-mentioned handwriting generation method, for example, to implement Figure 1 Steps S1 to S4 in .
[0131] The electronic device 100 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The electronic device 100 may include, but is not limited to, a processor 102 and a memory 101. Those skilled in the art will appreciate that Figure 7 It is only an example of the electronic device 100 and does not constitute a limitation of the electronic device 100. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 100 may also include input and output devices, network access devices, buses, etc.
[0132] The processor 102 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor 102 may be a microprocessor or any conventional processor, etc.
[0133] The memory 101 may be an internal storage unit of the electronic device 100, such as a hard disk or memory of the electronic device 100. The memory 101 may also be an external storage device of the electronic device 100, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 100. Further, the memory 101 may also include both an internal storage unit of the electronic device 100 and an external storage device. The memory 101 is used to store the computer program and other programs and data required by the terminal device. The memory 101 may also be used to temporarily store data that has been output or is to be output.
[0134] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0135] Figure 8 A schematic diagram of a computer-readable storage medium provided in an embodiment of the present disclosure is shown in FIG. Figure 8 As shown, a computer readable storage medium 200 stores a computer program 201, wherein the computer program 201 implements the above-mentioned handwriting generation method when executed by a processor, for example, Figure 1 The computer readable storage medium 200 includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device, or any other medium that can be used to store the desired information and can be accessed by the computer. In addition, it is well known to those skilled in the art that communication media typically contain computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery media.
[0136] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and substance of the present disclosure, and these modifications and improvements are also considered to be within the scope of protection of the present disclosure.
Claims
1. A handwriting generation method, applied to an electronic ink screen, characterized in that: The method comprises: In response to the handwriting erasing operation, a plurality of first erasing reporting points are obtained; Smoothing the plurality of first erasure reporting points to determine an erasure trajectory; Determine an erasure area in the writing track according to the erasure track and the pre-acquired writing track; and perform erasure processing on the erasure area; According to the remaining reporting points in the writing trajectory outside the erasing area, the handwriting is regenerated as an updated writing trajectory.
2. The handwriting generation method according to claim 1, characterized in that: The step of smoothing the plurality of first erasure reporting points to determine an erasure trajectory includes: Based on a preset erasure accuracy, determining invalid reporting points and intervals to be supplemented in the first erasure reporting points; Deleting the invalid reporting points, and supplementing a preset number of supplementary reporting points in the interval to be supplemented, to form a smoothed second erasure reporting point; According to the erasing accuracy, a corresponding erasing pattern is configured for each of the second erasing reporting points, each of the erasing patterns constitutes the erasing track, and the erasing pattern is a pattern with the second erasing reporting point as the geometric center.
3. The handwriting generation method according to claim 2, characterized in that: The determining, based on the preset erasure accuracy, of the invalid reporting points and the interval to be supplemented in the first erasure reporting points includes: Determine, according to a preset erasing precision, an effective distance range between any two adjacent first erasing reporting points among the plurality of first erasing reporting points; When the distance between two adjacent first erasure reporting points is less than the effective distance range, the latter of the two adjacent first erasure reporting points is determined as the invalid reporting point; When the distance between two adjacent first erasure reporting points is greater than the effective distance range, the area between the two adjacent first erasure reporting points is determined as the to-be-supplemented interval.
4. The handwriting generation method according to claim 2, characterized in that: The replenishment reporting point of replenishing a preset number of items within the interval to be replenished includes: Based on the Bezier curve, the coordinate value of each of the supplementary reporting points is determined.
5. The handwriting generation method according to claim 1, characterized in that: The step of determining the erased area in the writing track according to the erased track and the pre-acquired writing track includes: The writing trajectory includes a plurality of writing strokes, and the plurality of writing strokes are detected to determine at least one target stroke intersecting with the erasing trajectory; The target stroke is detected, at least one overlapping region of the target stroke and the erasure trajectory is determined, and the at least one overlapping region is determined as the erasure region.
6. The handwriting generation method according to claim 5, characterized in that: Detecting a plurality of the written strokes to determine at least one target stroke intersecting with the erasing trajectory comprises: For each of the written strokes, the following steps are performed: Determine the enclosing area of the writing stroke according to the coordinate information and time information corresponding to each writing reporting point in the writing stroke, wherein the enclosing area is the minimum circumscribed rectangular area of the writing stroke; In the case where the enclosed area overlaps with the erasing track, the writing stroke corresponding to the enclosed area is determined as the target stroke.
7. The handwriting generation method according to claim 6, characterized in that: Regenerating handwriting according to the remaining reported points in the writing trajectory outside the erasing area as an updated writing trajectory, including: The target stroke includes a plurality of writing points, traversing the plurality of writing points, determining at least one target writing point located in the erasing area; and clearing the target writing point; generating at least two updated strokes according to the remaining strokes in the target stroke except the target stroke; The at least two updated strokes corresponding to each of the target strokes are used as the updated writing trajectory.
8. The handwriting generation method according to claim 7, characterized in that: Generating at least two updated strokes according to remaining strokes in the target stroke except the target stroke, including: Based on at least one overlapping area included in the erasing area, the remaining reporting points corresponding to the target stroke are divided into at least two groups, and two adjacent groups of remaining reporting points are located on both sides of the overlapping area; According to the coordinate information and time information corresponding to the remaining reporting points, the update strokes corresponding to each group of the remaining reporting points are drawn and generated.
9. The handwriting generation method according to claim 1, characterized in that: Before regenerating handwriting based on the remaining reported points in the writing trajectory outside the erased area, the method further includes: The writing trajectory includes a plurality of writing strokes, and the following steps are performed for each writing stroke: The writing strokes are smoothed to determine the smoothed writing strokes, wherein the smoothed writing strokes include a plurality of first writing points, and the distance between any two adjacent first writing points is within a preset range.
10. The handwriting generation method according to claim 1, characterized in that: In response to the handwriting erasing operation, before obtaining a plurality of first erasure reporting points, the method further includes: In response to the mode selection operation, it is determined that the current input mode is the erase mode.
11. A handwriting generation device, characterized in that: The device comprises: An acquisition module, configured to obtain a plurality of first erasure reporting points in response to a handwriting erasure operation; A first determination module is configured to perform smoothing processing on the plurality of first erasure reporting points to determine an erasure trajectory; A second determination module is configured to determine an erased area in the writing track according to the erased track and the pre-acquired writing track; and perform an erase process on the erased area; The handwriting generation module is configured to regenerate handwriting as an updated writing trajectory according to the remaining reporting points in the writing trajectory outside the erasure area.
12. A handwriting generation device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor so that the at least one processor can execute the handwriting generation method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the handwriting generation method according to any one of claims 1 to 10.