WO2021218445A1 - 笔迹处理方法、笔迹处理装置、存储介质 - Google Patents

笔迹处理方法、笔迹处理装置、存储介质 Download PDF

Info

Publication number
WO2021218445A1
WO2021218445A1 PCT/CN2021/080463 CN2021080463W WO2021218445A1 WO 2021218445 A1 WO2021218445 A1 WO 2021218445A1 CN 2021080463 W CN2021080463 W CN 2021080463W WO 2021218445 A1 WO2021218445 A1 WO 2021218445A1
Authority
WO
WIPO (PCT)
Prior art keywords
trajectory
circle
points
unit
track
Prior art date
Application number
PCT/CN2021/080463
Other languages
English (en)
French (fr)
Inventor
贾红红
胡风硕
王镜茹
Original Assignee
京东方科技集团股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东方科技集团股份有限公司 filed Critical 京东方科技集团股份有限公司
Publication of WO2021218445A1 publication Critical patent/WO2021218445A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Definitions

  • the embodiments of the present disclosure relate to a handwriting processing method, a handwriting processing device, and a non-transitory storage medium.
  • An embodiment of the present disclosure provides a handwriting processing method, including: sampling the original handwriting trace on the touch display screen to obtain multiple sampling points; and calculating at least one trace point group based on the multiple sampling points, Wherein, each track point group in the at least one track point group includes N track points, the N track points include M sampling points, N is an integer greater than or equal to 3, and M is an integer greater than or equal to 3. M ⁇ N; based on the writing speed of at least part of the track points in the at least one track point group, determine multiple track units corresponding to all track points in the at least one track point group one-to-one, wherein the Each track unit of the multiple track units is a drop-shaped drop unit; the multiple track units are sequentially connected to obtain handwriting for display on the touch screen.
  • each of the multiple trajectory drop units includes at least a polygon, a first circle, and a second circle, and the four vertices of the polygon are the The four external common tangent points between the first circle and the second circle are determined to be related to all the trajectories in the at least one trajectory point group based on the writing speed of at least part of the trajectory points in the at least one trajectory point group
  • the multiple trajectory units corresponding to one-to-one points include: determining that the action type in all the trajectory points is the trajectory point of the pen, so as to obtain T1 pen trajectory points, where T1 is less than or equal to the number of all the trajectory points A positive integer of, the plurality of trajectory units include T1 pen trajectory units corresponding to the T1 pen trajectory points one-to-one; obtain the first average reference speed; for the p-th pen in the T1 pen trajectory points Trajectory points, according to the first reference average speed and the writing speed and position corresponding to the p-
  • dt is the diameter of the first circle in the p-th pen trajectory unit
  • dt-1 is the first circle of the previous trajectory unit adjacent in time to the p-th pen trajectory unit
  • Kt is the radius adjustment coefficient corresponding to the p-th pen trajectory point
  • vt is the writing speed corresponding to the p-th pen trajectory point
  • vavg is the first average reference speed
  • ds is the set line width
  • the positional relationship of the center of the circle represents: the center line of the center of the first circle and the center of the second circle rotates a preset center angle in a counterclockwise direction to a corresponding direction, and the center of the first circle and the center of the second circle
  • the center of the second circle satisfies the following relationship:
  • R is the radius of the first circle, do is the distance between the center of the first circle and the center of the second circle, and C1 is a constant;
  • the radius relationship indicates that the radius of the first circle is greater than the radius of the second circle, and the radius of the first circle and the radius of the second circle satisfy the following relationship:
  • r is the radius of the second circle
  • C2 is a constant.
  • each of the multiple trajectory units includes at least a polygon, a first circle, and a second circle, and the four vertices of the polygon are the first circle.
  • the four external common tangent points between a circle and the second circle are determined to be related to all the track points in the at least one track point group based on the writing speed of at least part of the track points in the at least one track point group
  • One-to-one corresponding multiple trajectory units including: determining that the action type in all the trajectory points is the trajectory point of the ending pen, so as to obtain T2 ending trajectory points, where T2 is less than or equal to all the trajectory points
  • the plurality of trajectory units include T2 pen-returning trajectory units corresponding to the T2 pen-returning trajectory points one-to-one; to obtain a second average reference speed, wherein the second average reference speed is less than the first An average reference speed, the first average reference speed is the reference speed corresponding to the pen movement stage
  • dy is the diameter of the first circle in the i-th pen-in trajectory unit
  • dy-1 is the first circle of the previous trajectory unit adjacent in time to the i-th pen-in trajectory unit
  • Ki' is the radius adjustment coefficient corresponding to the i-th pen-in trajectory unit
  • vi is the writing speed corresponding to the i-th pen-in trajectory point
  • vavg' is the second average reference speed
  • the positional relationship of the center of the circle represents: the center line of the center of the first circle and the center of the second circle rotates a preset center angle in a counterclockwise direction to a corresponding direction, and the center of the first circle and the center of the second circle
  • the center of the second circle satisfies the following relationship:
  • R is the adjusted radius of the first circle, do is the distance between the center of the first circle and the center of the second circle, and C1 is a constant;
  • the radius relationship indicates that the radius of the first circle is greater than the radius of the second circle, and the radius of the first circle and the radius of the second circle satisfy the following relationship:
  • r is the radius of the second circle
  • C2 is a constant.
  • each of the multiple trajectory units includes at least a polygon, a first circle, and a second circle, and the four vertices of the polygon are the first circle.
  • the four external common tangent points between a circle and the second circle, and determining a plurality of trajectory units corresponding to all trajectory points in the at least one trajectory point group one-to-one includes: determining the The action type is the stroke point of the stroke to obtain T3 stroke points of the stroke, wherein T3 is a positive integer less than or equal to the number of all the trace points, and the plurality of trajectory units includes one-to-one with the T3 stroke points Corresponding T3 pen-start trajectory units; set the diameter of the first circle of the T3 pen-start trajectory units as the set line width; for the z-th pen-start trajectory point in the T3 pen-start trajectory points, according to the The position corresponding to z pen-start trajectory points determines the center of the first circle in the z-th pen
  • R is the radius of the first circle, do is the distance between the center of the first circle and the center of the second circle, and C1 is a constant;
  • the radius relationship indicates that the radius of the first circle is greater than the radius of the second circle, and the radius of the first circle and the radius of the second circle satisfy the following relationship:
  • r is the radius of the second circle
  • C2 is a constant.
  • connecting the multiple trajectory units in sequence to obtain the handwriting for display on the touch screen includes: based on the at least one trajectory All the track points in the point group correspond to the positions on the original handwriting track, and the multiple track units are sorted; for any adjacent first track unit and the first track unit among the sorted multiple track units
  • a second trajectory unit in response to that neither the first circle and the second circle of the first trajectory unit and any two of the first circle and the second circle of the second trajectory unit are in an implicit relationship, determine the The two first common tangent points and the two second common tangent points between the first circle of the first trajectory unit and the first circle of the second trajectory unit determine the sum of the second circle of the first trajectory unit
  • the two third common tangent points and the two fourth common tangent points between the second circles of the second trajectory unit wherein the two first common tangent points are located at the first common tangent point of the first trajectory unit On the circle, the two second common tangent points are located on the first circle
  • the handwriting processing method provided by an embodiment of the present disclosure further includes: responding to at least two of the first circle and the second circle of the first trajectory unit and the first circle and the second circle of the second trajectory unit If each circle is an inclusive relationship, it is determined that the first track unit and the second track unit do not need to be connected.
  • the selection of four target common tangent points from the fourth common tangent point includes: determining the first outer common tangent line and the second outer common tangent line between the first circle and the second circle of the first trajectory unit, wherein the first trajectory unit The slope of a common tangent is smaller than the slope of the second common tangent; determining the third common tangent and the fourth common tangent between the second circle of the first trajectory unit and the second circle of the second trajectory unit; In response to the slope of the third common tangent line being greater than the slope of the fourth common tangent line, and the slope of the third common tangent line is greater than the slope of the first common tangent line and smaller than the first circle of the first trajectory unit The slope of the line connecting the center of the circle between the center of the circle and the center of the second circle, or, in response
  • connecting the multiple trajectory units in sequence to obtain the handwriting for display on the touch display screen includes: The k-th track point group in the point group, wherein the N track points in the k-th track point group are arranged in sequence in the extension direction of the original handwriting track, and k is a positive integer and is less than or equal to the at least The number of a track point group; determine the first track point and the Nth track point in the k-th track point group in the extension direction of the original handwriting track; obtain the first track point of the first track point A coordinate and the second coordinate of the Nth track point; according to the first coordinate and the second coordinate, the direction of the track segment corresponding to the kth track point group is determined, and the direction of the track segment corresponding to the kth track point group is determined according to the The direction of the trajectory segment corresponding to the k-th trajectory point group is determined, and the first circle on the first circle of each trajectory unit in the N trajectory units corresponding to
  • the direction of the trajectory segment corresponding to the trajectory point group is the horizontal direction, and in response to the first coordinate difference being 0 and the second coordinate difference being not 0, the trajectory corresponding to the k-th trajectory point group is determined
  • the handwriting processing method according to the direction of the trajectory segment corresponding to the k-th trajectory point group, determine which of the N trajectory points in the k-th trajectory point group corresponds to
  • the range of C1 is 1.2-2
  • the range of C2 is 0.2-0.4
  • the range of the preset circle center angle is 20°-40°
  • the abscissa of the center of the first circle is greater than the abscissa of the center of the second circle
  • the ordinate of the center of the first circle The ordinate greater than the center of the second circle.
  • the handwriting processing method based on the writing speed of at least part of the track points in the at least one track point group, it is determined to be one-to-one with all the track points in the at least one track point group.
  • the corresponding multiple trajectory units include: based on the writing speed of at least part of the trajectory points in the at least one trajectory point group, determining multiple intermediate trajectory units corresponding to all the trajectory points in the at least one trajectory point group one-to-one , Performing transparency processing on the plurality of intermediate track units to obtain the plurality of track units.
  • performing transparency processing on the plurality of intermediate trajectory units to obtain the multiple trajectory units includes: according to the plurality of intermediate trajectory units, obtaining and A plurality of intermediate transparency track units corresponding to the plurality of intermediate track units one-to-one, wherein the shape and size of each transparency track unit are the same as the shape and size of the intermediate track unit corresponding to each transparency track unit;
  • For the h-th intermediate transparency trajectory unit among the plurality of intermediate transparency trajectory units a plurality of edge transparency pixels are obtained at the edge of the h-th intermediate transparency trajectory unit, from the center of the h-th intermediate transparency trajectory unit In the direction extending outward, the transparency of the plurality of edge transparency pixels is gradually changed from 100% to 0% to obtain the transparency track unit corresponding to the h-th intermediate transparency track unit, thereby obtaining the transparency track unit corresponding to the plurality of edge transparency pixels.
  • the intermediate transparency track units correspond to a plurality of transparency track units one-to-one, where h is a positive integer greater than or equal to 1 and less than or equal to the number of the plurality of intermediate transparency track units, and at least part of the edges of the plurality of edge transparency pixels
  • the transparency pixel is located in the corresponding h-th intermediate transparency track unit, and the transparency of all pixels in the h-th intermediate transparency track unit except the plurality of edge transparency pixels is 100%;
  • the middle track unit and the multiple transparency track units are superimposed respectively to obtain the multiple track units.
  • calculating at least one trajectory point group based on the multiple sampling points includes: dividing the original handwriting trajectory into at least one group based on the multiple sampling points A trajectory segment, wherein each trajectory segment includes M sampling points; interpolation processing is performed on each trajectory segment in the at least one trajectory segment to obtain a trajectory point group corresponding to each trajectory segment, thereby obtaining the at least A track point group.
  • performing interpolation processing on each trajectory segment in the at least one trajectory segment to obtain a group of trajectory points corresponding to each trajectory segment includes: Segment, according to the M sampling points corresponding to the trajectory segment, the Bezier curve corresponding to the trajectory segment is fitted by fitting, and points are taken on the Bezier curve to obtain the trajectory point corresponding to the trajectory segment Group.
  • the tip type of the handwriting is a brush tip.
  • An embodiment of the present disclosure further provides a handwriting processing device, including: a memory for non-transitory storage of computer-readable instructions; and a processor for running the computer-readable instructions, wherein the computer-readable instructions When run by the processor, the handwriting processing method according to any one of the above embodiments is executed.
  • the handwriting processing apparatus further includes a touch display screen configured to obtain the original handwriting trajectory based on a user's touch operation.
  • the touch display screen is further configured to display the handwriting.
  • An embodiment of the present disclosure also provides a non-transitory storage medium that non-transitory stores computer-readable instructions, wherein when the computer-readable instructions are executed by a computer, the handwriting according to any of the above-mentioned embodiments can be executed.
  • Approach a non-transitory storage medium that non-transitory stores computer-readable instructions, wherein when the computer-readable instructions are executed by a computer, the handwriting according to any of the above-mentioned embodiments can be executed.
  • FIG. 1 is a schematic flowchart of a handwriting processing method provided by an embodiment of the present disclosure
  • FIG. 2A is a schematic diagram of a track point group provided by some embodiments of the present disclosure.
  • FIG. 2B is a schematic diagram of another track point group provided by some embodiments of the present disclosure.
  • FIG. 3A is a schematic diagram of a trajectory unit provided by an embodiment of the present disclosure.
  • 3B is a schematic diagram of the relationship between the writing speed of a track point and the diameter of the first circle of the track unit corresponding to the track point according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a handwriting used for display according to an embodiment of the present disclosure.
  • FIG. 5A is a schematic diagram of a first trajectory unit and a second trajectory unit provided by an embodiment of the present disclosure
  • FIG. 5B is a schematic diagram of another first track unit and a second track unit provided by an embodiment of the present disclosure
  • FIG. 6A is a schematic diagram of still another first track unit and a second track unit provided by an embodiment of the present disclosure
  • FIG. 6B is a schematic diagram of still another first track unit and second track unit provided by an embodiment of the present disclosure.
  • FIG. 7 is a schematic diagram of still another first track unit and a second track unit provided by an embodiment of the present disclosure.
  • FIG. 8A is a schematic diagram of a trajectory unit without transparency provided by an embodiment of the present disclosure.
  • FIG. 8B is a schematic diagram of a trajectory unit with transparency provided by an embodiment of the present disclosure.
  • FIG. 9 is a schematic diagram of a process of simulating the tip of a pencil provided by some embodiments of the present disclosure.
  • FIG. 10 is an effect diagram of simulating the tip of a pencil provided by some embodiments of the present disclosure.
  • FIG. 11 is a schematic block diagram of a handwriting processing device provided by at least one embodiment of the present disclosure.
  • FIG. 12 is a schematic diagram of a storage medium provided by at least one embodiment of the present disclosure.
  • FIG. 13 shows a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
  • the automatic handwriting beautification technology can eliminate the jagged or stepped appearance of the handwriting, and at the same time has the pen-point effect, providing users with a smoother, rounder, smooth, and natural writing experience.
  • An embodiment of the present disclosure provides a handwriting processing method, a handwriting processing device, and a computer storage medium.
  • the handwriting processing method includes: sampling the original handwriting track on the touch display screen to obtain multiple sampling points; Sampling points, at least one trajectory point group is calculated, wherein each trajectory point group in the at least one trajectory point group includes N trajectory points, N trajectory points include M sampling points, N is an integer greater than or equal to 3, M Is an integer greater than or equal to 3, M ⁇ N; based on the writing speed of at least part of the track points in the at least one track point group, determine the multiple track units corresponding to all the track points in the at least one track point group one-to-one, where , Each track unit of the multiple track units is a drop-shaped water drop unit; the multiple track units are sequentially connected to obtain handwriting for display on the touch screen.
  • the pressure-free writing track when a user writes on an electronic device with a hand or a pen, can also be beautified to have the display effect of the brush tip, so that the electronic device The smooth and beautified writing trajectory is displayed on the top, and the effect of handwriting beautification can be realized in real time and effectively without pressure sensitivity.
  • the handwriting processing method has fast calculation speed, simple implementation principle, and good real-time performance, so that the handwriting processing method can be applied to electronic interactive whiteboards (for example, conference whiteboards, teaching whiteboards, etc.), electronic board newspapers, airport digital signature walls, cloud books Wait for scenes that require writing input.
  • FIG. 1 is a schematic flowchart of a handwriting processing method provided by an embodiment of the present disclosure.
  • the handwriting processing method provided by an embodiment of the present disclosure is suitable for a touch display screen with a touch display function, and may include the following steps S10-S13:
  • Step S10 sampling the original handwriting trajectory on the touch display screen to obtain multiple sampling points
  • Step S11 calculating at least one track point group based on multiple sampling points
  • Step S12 Based on the writing speed of at least part of the track points in the at least one track point group, determine multiple track units corresponding to all the track points in the at least one track point group one-to-one;
  • Step S13 Connect multiple track units in sequence to obtain handwriting for display on the touch screen.
  • the handwriting processing method provided by the embodiments of the present disclosure can determine the trajectory unit corresponding to the trajectory point based on the speed of the stroke of the trajectory point, thereby realizing the writing effect of simulating the tip of a brush.
  • the handwriting processing methods provided by these embodiments of the present disclosure can provide an interesting interactive way for airport display screens. As a landmark building of a city, the airport is an important way to attract tourists.
  • the handwriting processing method provided by the present disclosure can be integrated on the display screen of an airport. When a tourist arrives at an airport in a certain city, a signature can be written on the display screen and displayed on the display screen in the form of beautified handwriting.
  • the handwriting processing methods provided by these embodiments of the present disclosure can provide a new type of board newspaper method for smart classrooms.
  • the handwriting processing method can beautify the writing on the blackboard and the board newspaper fonts of students or teachers, and give a clearer picture.
  • the handwriting processing method can also design more handwriting styles, for example, pencil tip, pen tip, etc., without losing the original font, to form a more beautiful font.
  • the handwriting processing method can be applied to an electronic device equipped with an Android system, and the electronic device can include an application layer and an algorithm layer.
  • the application layer can be used to implement the above step S10, and the algorithm layer can be used to implement the above steps S11-S13.
  • the application layer is used to obtain the original handwriting trajectory (for example, the initial data corresponding to the original handwriting trajectory) that the user writes on the touch screen and is collected by the touch screen.
  • Initial data the initial data is processed to obtain the corresponding original handwriting trajectory (for example, the combination of touched points (touch capacitance) on the touch screen)), and the original handwriting trajectory is sampled to obtain multiple sampling points Relevant information such as coordinates, type, and writing time.
  • the application layer can transmit the coordinates of multiple sampling points, the type and writing time and other related information corresponding to each sampling point to the algorithm layer, so that the algorithm layer can perform calculations, judgments, etc. to perform subsequent operations to beautify the handwriting, for example,
  • the algorithm layer smoothes multiple sampling points and calculates the display scheme of the original handwriting trajectory under different strokes (for example, pencil or brush stroke), so that the original handwriting trajectory can achieve the effect of handwriting beautification.
  • the display scheme of the original handwriting trajectory is realized through the application layer.
  • the display scheme of the original handwriting trajectory includes the display scheme of the pen-starting phase, the display scheme of the pen-moving phase, and the display scheme of the pen-finishing phase.
  • the algorithm layer may correspond to the application program itself (for example, a writing program, etc.), the application layer corresponds to the underlying driver, and the underlying driver is for the initial acquisition of the touch screen.
  • the data is processed to obtain the corresponding original handwriting trajectory data, such as time, position, etc.; the algorithm layer obtains the original handwriting trajectory data fed back by the underlying driver program, and then performs further processing.
  • the original handwriting trajectory may be the handwriting input by the user on the touch display screen by hand or pen, that is, the handwriting written by the user.
  • the application layer can sample the original handwriting trajectory by sparsely sampling points to obtain multiple sampling points. The number of multiple sampling points can be determined according to the actual situation.
  • multiple sampling points are spaced apart from each other along the original handwriting trajectory, that is, multiple sampling points do not overlap with each other.
  • the original handwriting trajectory can have any shape.
  • the original handwriting trajectory can be the trajectory of Chinese characters, or the trajectory of foreign characters (for example, English, Japanese, etc.).
  • the original handwriting trajectory is not displayed on the touch screen; in another embodiment, the original handwriting trajectory can also be displayed on the touch screen, so that the user can watch at the same time To the original handwriting trajectory and beautified handwriting.
  • FIG. 2A is a schematic diagram of a track point group provided by some embodiments of the present disclosure
  • FIG. 2B is a schematic diagram of another track point group provided by some embodiments of the present disclosure.
  • each track point group in at least one track point group includes N track points, N track points include M sample points, N is an integer greater than or equal to 3, and M is an integer greater than or equal to 3. , M is less than or equal to N.
  • N is 9 and M is 3.
  • the present disclosure includes but is not limited to this. The number of N and M can be determined according to actual conditions. In other embodiments, M can be 4 and N can be 13.
  • step S11 may include: dividing the original handwriting trajectory into at least one trajectory segment based on a plurality of sampling points, wherein each trajectory segment includes M sampling points; and for each of the at least one trajectory segment Interpolation processing is performed on each trajectory segment to obtain a trajectory point group corresponding to each trajectory segment, thereby obtaining at least one trajectory point group.
  • the application layer may sample points on the original handwriting trajectory 110 at equal time intervals to obtain 9 sampling points C1-C9 (black hollow points).
  • the 9 sampling points C1-C9 are arranged in sequence, for example, the sampling point C1 and the sampling point C2 are adjacent, the sampling point C2 and the sampling point C3 are adjacent, and so on.
  • the original handwriting trajectory 110 is sampled in real time to obtain sampling points.
  • the application layer can Three sampling points are sampled and input to the algorithm layer, and then the algorithm layer can process the sampled three sampling points, which can save time.
  • the application layer can sample the original handwriting trajectory 110.
  • the application layer can sample the sample points C1-C3, the application layer can sample the sample points.
  • C1-C3 are input to the algorithm layer for subsequent processing by the algorithm layer; at the same time, the application layer continues to sample.
  • the application layer After the application layer samples the sampling points C4 and C5, the application layer can input the sampling points C3-C5 to the algorithm layer ,And so on. It should be noted that, for example, after the algorithm layer processes the sampling points C1-C3, the part of the handwriting for display corresponding to the sampling points C1-C3 can be displayed on the touch screen, thereby realizing real-time display . For another example, after all sampling points (for example, sampling points C1-C9) are processed in the algorithm layer, then the complete handwriting for display is displayed on the touch screen.
  • the application layer samples the original handwriting trajectory 110 to obtain sampling points.
  • 9 sampling points C1-C9 can divide the original handwriting trajectory into four trajectory segments, which are the first trajectory segment between sampling points C1-C3 and the second trajectory segment between sampling points C3-C5.
  • the first trajectory section, the second trajectory section, the third trajectory section, and the fourth trajectory section are arranged in sequence in the extension direction of the original handwriting trajectory 110 (that is, the direction from the sampling point C1 to the sampling point C9).
  • the two trajectory segments are adjacent and both correspond to the same sampling point C3, the second trajectory segment and the third trajectory segment are adjacent and both correspond to the same sampling point C5, and the third trajectory segment and the fourth trajectory segment are adjacent and both correspond to the same sampling point C7 .
  • the original handwriting trajectory 110 includes a part corresponding to the pen-up phase, a part corresponding to the pen-handling phase, and a part corresponding to the pen-in phase.
  • the part corresponding to the pen-up phase, the part corresponding to the pen-handling phase, and the part corresponding to the pen-in phase can be determined according to the event-driven rules of the Android system.
  • the pen down event corresponds to the pen up phase
  • the pen up event corresponds to the pen down phase, etc. .
  • the first trajectory segment may represent the part of the original handwriting trajectory 110 corresponding to the pen-up phase
  • the second trajectory segment and the third trajectory segment may represent the part of the original handwriting trajectory 110 corresponding to
  • the fourth trajectory segment may represent the part of the original handwriting trajectory 110 that corresponds to the pen-returning stage.
  • performing interpolation processing on each trajectory segment in at least one trajectory segment to obtain a trajectory point group corresponding to each trajectory segment includes: for each trajectory segment, according to the M sampling points in the trajectory segment, fitting The Bezier curve corresponding to the trajectory segment is obtained, and points are taken on the Bezier curve to obtain the trajectory point group corresponding to the trajectory segment.
  • the second-order Bezier curve fitting can be performed on the three sampling points C1-C3 corresponding to the first trajectory segment to obtain the Bezier curve 100 corresponding to the first trajectory segment.
  • two-order Bezier curve fitting can be performed on the three sampling points C3-C5 corresponding to the second trajectory segment to obtain the Bezier curve corresponding to the second trajectory segment;
  • the second-order Bezier curve can be fitted to the three sampling points C5-C7 corresponding to the third trajectory segment to obtain the Bezier curve corresponding to the third trajectory segment; for the fourth trajectory segment, the first The three sampling points C7-C9 corresponding to the four trajectory segments are subjected to second-order Bezier curve fitting to obtain the Bezier curve corresponding to the fourth trajectory segment.
  • the trajectory point group corresponding to the first trajectory segment includes 9
  • the 9 trajectory points are the three sampling points C1-C3 corresponding to the first trajectory segment and the remaining 6 trajectory points on the Bezier curve 100 shown in FIG. 2A (black solid points, namely interpolation Points obtained). Interpolate points for all trajectory segments respectively, so as to obtain at least one trajectory point group one-to-one corresponding to at least one trajectory segment.
  • the application layer may sample points on the original handwriting track, such as at equal time intervals, to obtain 5 sampling points A1-A5.
  • the original handwriting trajectory five sampling points A1-A5 are arranged in sequence, for example, sampling point A1 is adjacent to sampling point A2, sampling point A2 is adjacent to sampling point A3, and so on.
  • five sampling points A1-A5 can also divide the original handwriting trajectory into four trajectory segments, which are the first trajectory segment between sampling points A1-A2 and the first trajectory segment between sampling points A2-A3.
  • the first trajectory segment, the second trajectory segment, the third trajectory segment, and the fourth trajectory segment are sequentially arranged in the extending direction of the original handwriting trajectory (that is, the direction from the sampling point A1 to the sampling point A5).
  • the application layer transmits the two sampling points A1 and A2 corresponding to the first trajectory segment to the algorithm layer, and then the algorithm layer calculates the midpoint B1 of the sampling points A1 and A2, The points A1 and A2 and the midpoint B1 are fitted with a second-order Bezier curve to obtain the Bezier curve 100 corresponding to the first trajectory segment.
  • the application layer transmits the two sampling points A2 and A3 corresponding to the second trajectory segment to the algorithm layer.
  • the algorithm layer calculates the midpoint B2 of the sampling points A2 and A3.
  • A3, midpoint B2 is fitted with a second-order Bezier curve to obtain the Bezier curve corresponding to the second trajectory segment; for the third trajectory segment, the application layer will perform two sampling points A3 and A3 and corresponding to the third trajectory segment.
  • A4 is transmitted to the algorithm layer, and the algorithm layer calculates the midpoint B3 of the sampling points A3 and A4, and performs the second-order Bezier curve fitting on the sampling points A3 and A4 and the midpoint B3 to obtain the Bézier corresponding to the third trajectory segment Er curve; for the fourth trajectory segment, the application layer transmits the two sampling points A4 and A5 corresponding to the fourth trajectory segment to the algorithm layer.
  • the algorithm layer calculates the midpoint B4 of the sampling points A4 and A5, and the sampling points A4 and A5 and the midpoint B4 perform second-order Bezier curve fitting to obtain the Bezier curve corresponding to the fourth trajectory segment.
  • interpolation is performed on the Bezier curve 100 corresponding to the first trajectory segment to obtain a trajectory point group corresponding to the first trajectory segment, for example, in 3 trajectory points are sampled between sampling point A1 and sampling point B1, and 3 trajectory points are also sampled between sampling point B1 and sampling point A2. Interpolate points for all trajectory segments respectively, so as to obtain at least one trajectory point group one-to-one corresponding to at least one trajectory segment.
  • the trajectory points can be sampled with equal curve intervals.
  • the length of the curve segment between any two adjacent trajectory points in the points is a quarter of the length of the curve segment between the sampling point C1 and the sampling point C2.
  • the sampling point C2 the sampling point C3, and the sampling point There are 3 trajectory points between C2 and sampling point C3.
  • the length of the curve segment between any two adjacent trajectory points in these five trajectory points is the length of the curve segment between sampling point C2 and sampling point C3 A quarter.
  • the track points can also be sampled at equal time intervals, that is, the time difference between any two adjacent track points in each track segment group of the nine track points is fixed. It should be noted that the present disclosure does not specifically limit the way of sampling track points.
  • trajectory points in the trajectory point group corresponding to the first trajectory segment are located on the Bezier curve 100 corresponding to the first trajectory segment, and one of the trajectory point groups corresponding to the first trajectory segment or The multiple trajectory points may not be located on the first trajectory segment.
  • multiple sampling points obtained by sampling may be directly used as the trajectory points in the trajectory point group, without performing interpolation processing on the sampling points.
  • the first trajectory segment can be directly sampled to obtain nine sampling points, which can be used as trajectory points in the trajectory point group corresponding to the first trajectory segment.
  • all the track points in the at least one track point group may be stroke points; in other embodiments, all the track points in the at least one track point group may be stroke points; In still other embodiments, all the track points in the at least one track point group may be pen-end track points.
  • all the track points in the at least one track point group may include at least two of the stroke point, the stroke point, and the stroke point.
  • FIG. 3A is a schematic diagram of a trajectory unit provided by an embodiment of the present disclosure
  • FIG. 3B is a diagram showing the difference between the writing speed of a trajectory point provided by an embodiment of the present disclosure and the diameter of the first circle of the trajectory unit corresponding to the trajectory point Schematic diagram of the relationship.
  • each trajectory unit includes at least a polygon 220, a first circle 200, and a second circle 210.
  • the polygon 220 is a quadrilateral.
  • the radius of the first circle 200 is greater than the radius of the first circle 200.
  • the radius of the second circle 210 and the four vertices of the polygon 220 are the four external common tangent points q1-q4 between the first circle 200 and the second circle 210.
  • the drop-shaped drop unit represents a drop-shaped closed track.
  • each trajectory unit may include two line segments, a first circle and a second circle, and the two line segments are the outer common tangent point q1 of the two outer common tangents of the first circle and the second circle.
  • the line segment between -q4, as shown in Figure 3A, is the line segment q1q3 and the line segment q2q4.
  • the second circle in each track unit may be replaced with a triangle. The present disclosure does not specifically limit this.
  • the application layer can transmit all track points obtained by sampling and related information of all track points to the algorithm layer.
  • the relevant information of the track points may include the coordinates of each track point, the writing time of each track point, the writing speed of each track point, and the action type during the movement of the pen tip (hereinafter referred to as the action type of the track point).
  • a pixel coordinate system OXY is determined by taking the upper left corner of the display screen of the touch display screen as the origin of coordinates, with the X axis extending to the right and the Y axis extending downwards.
  • the X axis may be parallel to the horizontal direction
  • the Y axis may be parallel to the vertical direction.
  • the coordinates of the track point may be the coordinates of any one of the multiple pixels corresponding to the track point; or, the coordinates of the track point may be the coordinates of the middle pixel of the multiple pixels corresponding to the track point.
  • the action type of the trajectory point may include pen up, pen stroke (also called pen stroke), and pen end.
  • pen stroke also called pen stroke
  • pen end When the action type of a certain track point is pen-starting, it means that the track point is in the part of the pen-starting phase of the original handwriting trajectory.
  • pen-stroke When the action type of a certain track point is pen-stroke, it means that the trajectory point is in the pen-drawing phase of the original handwriting trajectory.
  • the action type of a certain track point is the end of the pen, it means that the track point is in the end of the original handwriting track. For example, as shown in FIG.
  • the action types of all track points corresponding to the first trajectory segment are strokes
  • the action types of all track points corresponding to the second trajectory segment and the third trajectory segment are strokes.
  • the action type of all the trajectory points corresponding to the fourth trajectory segment is the ending pen.
  • the writing speed of the sampling point can be determined according to the coordinates and time of the adjacent sampling point, and the speed of the point obtained by interpolation (for example, the black solid point between C1 and C2 on the Bezier curve 100 shown in FIG. 2A)
  • the sum type is determined based on two real sampling points (ie, sampling points C1 and C2) used for interpolation.
  • the writing speed of the sampling point C3 can be determined according to the coordinates and time of the sampling point C2 and the coordinates and time of the sampling point C3, that is, according to the time difference between the sampling point C2 and the sampling point C3
  • the position difference is determined, for example, the writing speed of the sampling point C3 can be obtained by dividing the position difference between the sampling point C2 and the sampling point C3 by the time difference between the sampling point C2 and the sampling point C3.
  • the point speeds obtained by interpolation are all simulated.
  • the writing speed of the points obtained by interpolation can be determined based on the writing speed of the sampling points.
  • the difference between the writing speed of any two adjacent trajectory points among the five trajectory points is one-fourth of the difference between the writing speed of the sample point C2 and the writing speed of the sample point C3, that is, the five trajectory points.
  • the writing speed of each track point is an arithmetic sequence.
  • the writing speed of the three interpolated points is the writing speed of the sampling point C2 and the sampling point C3. The average value of writing speed.
  • the velocity of the first sampling point corresponding to the original handwriting trajectory (for example, for the original handwriting trajectory 110 shown in FIG. 2A, the first sampling point is the sampling point C1) is 0, for (For example, for the original handwriting trajectory 110 shown in FIG. 2A, the second sampling point is the sampling point C2), the writing speed of the second sampling point can be based on the first sampling point (ie, the sampling point C1 ) And the second sampling point (ie sampling point C2) between the time difference and the position difference are determined.
  • the writing speed corresponding to the sampling point can also be directly acquired, that is, the application layer can acquire the writing speed of the sampling point and transmit the writing speed to the algorithm layer.
  • the type of points obtained by interpolation for example, the black solid point between C1 and C2 on the Bezier curve 100 shown in FIG. 2A
  • the two real sampling points used for interpolation ie, sampling points C1 and C2
  • the width of the handwriting is related to the writing speed of the track point.
  • the width of the handwriting is small, and when the writing speed of the track point is slow, the width of the handwriting is large.
  • step S12 for each track point on the original handwriting trajectory, the application layer sets a drop shape at the position corresponding to the track point to simulate the effect of writing by a brush, so as to simulate the stroke of the brush.
  • step S12 includes: determining that the action type in all the trajectory points is the trajectory point of the pen to obtain T1 pen trajectory points, where T1 is a positive integer less than or equal to the number of all trajectory points,
  • the multiple trajectory units include T1 pen trajectory units that correspond to the T1 pen trajectory points one-to-one; obtain the first average reference speed; for the p-th pen trajectory point among the T1 pen trajectory points, average according to the first reference Speed and the writing speed and position corresponding to the p-th pen trajectory point, determine the radius and center of the first circle in the p-th pen trajectory unit corresponding to the p-th pen trajectory unit in the T1 pen trajectory unit, where p Is a positive integer, and p is less than or equal to T1; according to the radius and center of the first circle in the p-th stroke unit, the radius relationship between the radius of the first circle and the radius of the second circle in each trajectory unit and each The positional relationship between the center of the first circle and the center of the second circle of each trajectory
  • the writing speed of the p-th pen trajectory point can pass the time and position corresponding to the p-th pen trajectory point and the p-th pen trajectory point The time and position corresponding to the previous adjacent sampling point are determined.
  • the writing speed of the p-th pen trajectory point can be determined by the writing speed of the two adjacent sampling points .
  • the T1 pen trajectory points are all trajectory points between sample point C3 to sample point C7, sample point C3 and sample point C7; as shown in Figure 2B, T1 pen trajectory points are sample points All trajectory points from A2 to sampling point A4, sampling point A2 and sampling point A4.
  • the center O1 of the first circle 200 is the trajectory point corresponding to the trajectory unit where the first circle 200 is located.
  • the center of the first circle of the p-th pen trajectory unit is the coordinate of the p-th pen trajectory point; in other embodiments, it may be according to a predetermined rule, Determine the center of the first circle of the p-th pen-trajectory unit according to the coordinates of the p-th pen-trajectory point.
  • the predetermined rule may be: the original handwriting trace is located in the first area of the touch display screen, the handwriting used for display is located in the second area of the touch display screen (the second area is located to the right of the first area), and the first circle
  • the position of the preset distance located on the right side of the corresponding track point, etc., the size of the first area, the size of the second area, the predetermined rule and the preset distance can be set by the user according to the actual situation.
  • the radius of the first circle 200 of the p-th pen-trajectory unit is determined by the writing speed and the first average reference speed corresponding to the p-th pen-trajectory point, and satisfies the following relationship:
  • dt is the diameter of the first circle in the p-th pen trajectory unit
  • dt-1 is the previous trajectory unit adjacent in time to the p-th pen trajectory unit
  • the previous trajectory unit may be a pen
  • the trajectory unit may also be the diameter of the first circle of the pen-starting trajectory unit described later
  • kt is the radius adjustment coefficient corresponding to the p-th pen-trajectory point
  • vt is the writing speed corresponding to the p-th pen-trajectory point
  • vavg is The first average reference speed, for example, vavg may be 500 pixels per second.
  • the previous trajectory point adjacent to sampling point C3 is trajectory point C30
  • the trajectory unit corresponding to sampling point C3 is adjacent in time to trajectory point C30.
  • the trajectory unit in time, in time, the previous trajectory point adjacent to sampling point C3 is trajectory point C30, and the trajectory unit corresponding to sampling point C3 is adjacent in time to trajectory point C30. The trajectory unit.
  • the center of the second circle of the p-th pen stroke unit is the p-th pen stroke point, and then, according to the center of the circle between the center of the first circle and the center of the second circle , The center of the first circle of the p-th pen-trajectory unit is determined based on the center of the second circle of the p-th pen-trajectory unit.
  • the algorithm layer presets the first average reference speed vavg of the writing process. If the writing speed of the current trajectory point is less than or equal to the first average reference speed, adjust the diameter of the first circle in the trajectory unit corresponding to the current trajectory point to increase. Make the stroke corresponding to the current trajectory point thicker; if the writing speed of the current trajectory point is greater than the first average reference speed, adjust the diameter of the first circle in the trajectory unit corresponding to the current trajectory point to decrease, so that the stroke corresponding to the current trajectory point changes thin.
  • the adjustment range of the diameter of the first circle 200 is limited.
  • the maximum value of the diameter of the first circle 200 shall not exceed 1.1 times the set line width, and the minimum value of the diameter of the first circle 200 shall not be lower than the set line width.
  • ds is a constant and can be set by the user.
  • the diameter of the first circle 200 actually corresponds to the writing speed of the track point, as shown in FIG. 3B, the maximum value of the diameter of the first circle 200 corresponds to the truncated low speed of the writing speed of the track point, the diameter of the first circle 200 The minimum value of corresponds to the truncated high speed of the writing speed of the track point. Near the average speed, the diameter of the first circle 200 changes relatively smoothly, thereby suppressing the jitter of the stroke width.
  • the positional relationship of the center of the circle means: the center line O1O2 between the center O1 of the first circle 200 and the center O2 of the second circle 210 rotates the preset circle center angle ⁇ in the counterclockwise direction to the corresponding direction VD, the center of the first circle 200 O1 and the center O2 of the second circle 210 satisfy the following relationship:
  • R is the radius of the first circle 200
  • do is the distance between the center O1 of the first circle 200 and the center O2 of the second circle 210
  • C1 is a constant.
  • the radius relationship means: the radius of the first circle 200 is greater than the radius of the second circle 210, and the radius of the first circle 200 and the radius of the second circle 210 satisfy the following relationship:
  • r is the radius of the second circle 210
  • C2 is a constant.
  • the range of C1 is 1.2-2, for example, C1 is 1.8; the range of C2 is 0.2-0.4, for example, C2 is 0.3; the range of the preset circle center angle ⁇ is 20°-40°, For example, the preset circle center angle ⁇ is 30 degrees.
  • the values of C1 and C2 need to satisfy such that the first circle 200 and the second circle 210 do not intersect.
  • the corresponding direction VD may be the opposite direction of the X axis.
  • the abscissa of the center of the first circle 200 is greater than the abscissa of the center of the second circle 210
  • the ordinate of the center of the first circle 200 is greater than the ordinate of the center of the second circle 210, and therefore, as shown in FIG. 3A, the second circle 210 is located at the upper left of the first circle 200.
  • determining multiple track units corresponding to all track points in at least one track point group one-to-one includes: determining that the action type in all track points is a pen-starting track point , To obtain T3 pen-start trajectory points, where T3 is a positive integer less than or equal to the number of all the trajectory points, and the multiple trajectory units include T3 pen-start trajectory units corresponding to the T3 pen-start trajectory points one-to-one; set T3 The diameter of the first circle of each pen-start trajectory unit is the set line width; for the z-th pen-start trajectory point among T3 pen-start trajectory points, according to the position corresponding to the z-th pen-start trajectory point, determine the T3 pen-start trajectory unit and The center of the first circle in the zth stroke unit corresponding to the zth stroke point, where z is a positive integer, and z is less than or equal to T3; according to the radius of the first circle in the zth stroke unit and The center of the
  • the center of the first circle of the z-th pen-start trajectory unit is the coordinate of the z-th pen-start trajectory point.
  • the center of the first circle of the z-th pen-start trajectory unit may be determined according to the coordinates of the z-th pen-start trajectory point according to a predetermined rule.
  • a predetermined rule For the position relationship of the center of the circle and the position of the radius, please refer to the relevant description above, and the repetition will not be repeated.
  • the user can specify to use the set line width for writing.
  • you can set the diameter and set line width of the first circle in the trajectory unit corresponding to the trajectory point of the pen. same.
  • all trajectory points include only one pen-start trajectory point, that is, T3 is 1.
  • the pen-start trajectory point can be sample point C1.
  • the diameter of the first circle is the set line width; in other embodiments, all trajectory points include multiple starting trajectory points, that is, T3 is greater than 1, for example, T3 is 9, at this time, multiple starting trajectory points can be sampling points C1, sampling point C2, sampling point C3, sampling point C1 and sampling point C3, all the trajectory points, the diameter of the first circle of the multiple trajectory units corresponding to the multiple trajectory points are the same and they are all set lines width.
  • FIG. 4 is a schematic diagram of a handwriting for display provided by an embodiment of the present disclosure.
  • determining multiple track units corresponding to all track points in at least one track point group one-to-one includes: determining that the action type in all track points is the track of ending the pen Point to obtain T2 pen ending trajectory points, where T2 is a positive integer less than or equal to the number of all trajectory points, and the multiple trajectory units include T2 pen ending trajectory units corresponding to the T2 pen ending trajectory points one-to-one; obtaining The second average reference speed; for the i-th end-pen trajectory point of T2 end-pen trajectory points, determine the T2 end-pen trajectory according to the second average reference speed and the writing speed and position corresponding to the i-th end-pen trajectory point The radius and center of the first circle in the i-th pen-in trajectory unit corresponding to the i-th pen-in trajectory point in the unit, where i is a positive integer, and i is less than or equal to T2; according to the i-th pen-in trajectory The radius and center of the first circle in the trajectory unit
  • the second average reference speed can be set. If the writing speed of the trajectory point in the closing phase is greater than the second average reference speed, the pen tip processing is performed on the trajectory point in the closing phase, that is, the closing phase is reduced.
  • the trajectory point corresponding to the diameter of the first circle of the trajectory unit makes the width of the trajectory point in the closing phase smaller than the set line width.
  • the line width of the pen-in part (the circled part in Figure 4) is smaller, which is similar to the tip of a writing brush; when the pen-in phase is not correct
  • the line width of the end pen part is larger.
  • the center of the first circle of the i-th pen-in trajectory unit is the coordinate of the i-th pen-in trajectory point.
  • the coordinates of the trajectory point determine the center of the first circle of the i-th pen-returning trajectory unit.
  • the radius of the first circle of the i-th end-pen trajectory unit is determined by the writing speed and the second average reference speed corresponding to the i-th end-pen trajectory point, and satisfies the following relationship:
  • dy is the diameter of the first circle in the i-th pen-in trajectory unit
  • dy-1 is the diameter of the first circle of the previous trajectory unit adjacent in time to the i-th pen-in trajectory unit
  • vi is the writing speed corresponding to the i-th pen-in trajectory point
  • vavg' is the second average reference speed.
  • the first average reference speed is the reference speed corresponding to the pen moving phase
  • the second average reference speed is the reference speed corresponding to the pen closing phase.
  • the second average reference speed vavg' is less than the first average reference speed vavg.
  • the type is the ending pen, that is, the N track points in the last track point group are used as the ending pen track points.
  • the T2 ending pen track points can be sampling point C8, sampling point C9, and sampling point C7
  • the T2 ending trajectory points are all trajectory points between sampling point A5, sampling point A4, and sampling point A5. It should be noted that the embodiments of the present disclosure include but are not limited thereto, and the number of T2 pen-returning trajectory points can be determined according to actual conditions.
  • the touch and display are implemented in the same touch display screen as an example.
  • the present disclosure is not limited to this.
  • the original handwriting trace can be passed through the touch device.
  • the handwriting used for display can be displayed by the display device.
  • the touch device and the display device are set separately.
  • the touch area of the touch device that is, the area where the user can write
  • the angle is the origin, the direction extending to the right is used as the x-axis (the value of x is getting larger and larger), and the direction extending downward is used as the y-axis (the value of y is getting larger and larger) to construct the first coordinate system.
  • the coordinates of the points are the coordinates of each track point in the first coordinate system.
  • the upper left corner of the display area of the display device can be taken as the origin
  • the direction extending to the right can be taken as the x-axis (the value of x is getting larger and larger)
  • the direction extending downward can be taken as the y-axis (the value of y is getting larger and larger).
  • the coordinates of each track point (the coordinates of each track point in the first coordinate system) need to be mapped to the second coordinate system to determine the second coordinate system
  • the center of the first circle of the trajectory unit corresponding to each trajectory point in the system. In other words, the track point is located in the first coordinate system, and the center of the first circle is located in the second coordinate system.
  • FIG. 5A is a schematic diagram of a first trajectory unit and a second trajectory unit provided by an embodiment of the present disclosure
  • FIG. 5B is a schematic diagram of another first trajectory unit and a second trajectory unit provided by an embodiment of the present disclosure.
  • first trajectory unit and second trajectory unit may be based on the difference between the first circle and second circle of the first trajectory unit and the first circle and second circle of the second trajectory unit.
  • the common tangent point connects the first trajectory unit and the second trajectory unit, thereby accurately connecting multiple trajectory units, so that the displayed handwriting is smoother.
  • step S13 includes: sorting multiple trajectory units based on the corresponding positions of all trajectory points in at least one trajectory point group on the original handwriting trajectory;
  • the trajectory unit and the second trajectory unit in response to the first circle and the second circle of the first trajectory unit and any two circles of the first circle and the second circle of the second trajectory unit being not in an implicit relationship, determine the first
  • the two first common tangent points and the two second common tangent points between the first circle of the trajectory unit and the first circle of the second trajectory unit determine the second circle of the first trajectory unit and the first circle of the second trajectory unit
  • Two third common tangent points and two fourth common tangent points between two circles from two first common tangent points, two second common tangent points, two third common tangent points, and two fourth common tangent points
  • Four target common tangent points are selected from the common tangent points; connect the four target common tangent points in sequence to determine a quadrilateral, so that the first trajectory unit and the second trajectory unit are connected, and the multiple trajectory units are processed
  • the multiple trajectory units corresponding to all the trajectory points are sorted along the direction from the sampling point C1 to the sampling point C9.
  • any adjacent first trajectory unit 300 and second trajectory unit 310 in the plurality of trajectory units if the first circle and the second circle of the first trajectory unit 300 and the second trajectory unit Any two circles in the first circle and the second circle of 310 are not inclusive. At this time, the two first circles between the first circle of the first trajectory unit 300 and the first circle of the second trajectory unit 310 are calculated.
  • a common tangent point w11 and w12 and two second common tangent points w21 and w22 calculate two third common tangent points w31 between the second circle of the first trajectory unit 300 and the second circle of the second trajectory unit 310 And w32 and the two fourth common tangent points w41 and w42; for example, the two first common tangent points w11 and w12 are located on the first circle of the first trajectory unit 300, and the two second common tangent points w21 and w22 are located on the first circle On the first circle of the second trajectory unit 310, the two third common tangent points w31 and w32 are located on the second circle of the first trajectory unit 300, and the two fourth common tangent points w41 and w42 are located on the second circle of the second trajectory unit 310. On the second round.
  • FIG. 5B shows various positional relationships between the first trajectory unit 300 and the second trajectory unit 310.
  • a shaded circle represents the first trajectory unit 300
  • an unshaded circle represents the second trajectory unit 310.
  • the Jiugong grid is determined with the first trajectory unit 300 as the center, and the Jiugong grid includes areas 1-9.
  • the first trajectory unit 300 is located in the second row and second column of the Jiugong grid, that is, the first trajectory unit 300 is located in area 5.
  • the second trajectory unit 310 can be located at any position of the Jiugong grid.
  • the two circles in the first trajectory unit 300 and the second trajectory unit 310 may have an intersection or an implicit relationship;
  • the two trajectory units 310 are located in areas 1, 2, 3, 4, 6, 7, 8, and 9, any two circles in the first trajectory unit 300 and the second trajectory unit 310 are not in an implicit relationship.
  • r 1 represents the radius of the first circle of the first trajectory unit 300
  • r 2 represents the radius of the first circle of the second trajectory unit 310
  • a 1 represents the abscissa of the center of the first circle of the first trajectory unit 300
  • a 2 represents the abscissa of the center of the first circle of the second trajectory unit 310
  • b 1 represents the ordinate of the center of the first circle of the first trajectory unit 300
  • b 2 represents the center of the first circle of the second trajectory unit 310 The ordinate.
  • two groups (k, b) can be calculated according to the above formulas (1) and (2). Substituting the two groups (k, b) into the following equations (3) and (4), the two first common tangent points w11 between the first circle of the first trajectory unit 300 and the first circle of the second trajectory unit 310 And w12 and the two second common tangent points w21 and w22.
  • Two groups (x 1 , y 1 ) represent two first common tangent points w11 and w12, and two groups (x 2 , y 2 ) represent two second common tangent points w21 and w22.
  • FIG. 6A is a schematic diagram of still another first trajectory unit and a second trajectory unit provided by an embodiment of the present disclosure
  • FIG. 6B is a schematic diagram of still another first trajectory unit and a second trajectory unit provided by an embodiment of the present disclosure.
  • the slope of the first outer common tangent between the first circle and the second circle of the first trajectory unit is k1, and the slope between the first circle and the second circle of the first trajectory unit
  • the slope of the second tangent line is k2
  • the slope of the line connecting the center of the first circle and the center of the second circle of the first trajectory unit is expressed as k0, when the first circle and the second circle of the first trajectory unit
  • the slope of the third external common tangent between the second circle of the first trajectory unit and the second circle of the second trajectory unit is k3, and the second circle between the second circle of the first trajectory unit and the second circle of the second trajectory unit is the first
  • the slope of the quadrant common tangent is k4.
  • k3 is greater than k4, and in the example shown in FIG. 6B, k3 is less than k4.
  • k3 and k4 are determined by the positional relationship between the first trajectory unit and the second trajectory unit.
  • the slope k3 of the third common tangent line is greater than the slope k4 of the fourth common tangent line, that is, in the example shown in FIG.
  • the slope of the line k0 between the center of the first circle and the center of the second circle of the unit, or, in response to the slope of the third external common tangent, k3 is less than the slope of the fourth common tangent, k4, as shown in Figure 6B
  • the slope k3 of the third external common tangent is smaller than the slope k2 of the second external common tangent and is greater than the slope k0 of the line between the center of the first circle and the center of the second circle of the first trajectory unit.
  • the second trajectory unit 310 may be located in the area 1 in the first row and first column of the Jiugong grid or in the area 9 in the third row and third column of the Jiugongge.
  • the slope of the second grand tangent is k2.
  • the first common tangent point of the second circle far away from the first trajectory unit and the two third common tangent points w31 and w32 of the two first common tangent points w11 and w12 can be far away from the first trajectory unit.
  • the fourth common tangent point of the first circle of the second trajectory unit is used as the four target common tangent points.
  • FIG. 7 is a schematic diagram of still another first track unit and a second track unit provided by an embodiment of the present disclosure.
  • the distance between the first common tangent point w11 and the center of the second circle of the first trajectory unit 310 Is d1
  • the distance between the first common tangent point w12 and the center of the second circle of the first track unit 310 is d2. Since d1 is greater than d2, the first common tangent point w11 can be selected as the target common tangent point.
  • the handwriting processing method further includes: in response to the first circle and the second circle of the first trajectory unit and the first circle and the second circle of the second trajectory unit, at least two of the four circles have an inclusive relationship, It is determined that the first track unit and the second track unit do not need to be connected.
  • the second trajectory unit 310 is located in the area 5 of the Jiugong grid, and the first circle of the first trajectory unit 300 and the first circle of the second trajectory unit 310 are in an implicit relationship. In this case , It can be determined that the first track unit and the second track unit do not need to be connected.
  • step S13 includes: for the k-th track point group in at least one track point group, the N track points in the k-th track point group are arranged in sequence in the extension direction of the original handwriting track, and k is a positive integer, And less than or equal to the number of at least one track point group; determine the first track point and the Nth track point in the k-th track point group in the extension direction of the original handwriting track; obtain the first track point of the first track point Coordinates and the second coordinate of the Nth track point; according to the first coordinate and the second coordinate, determine the direction of the track segment corresponding to the k-th track point group; according to the track segment corresponding to the k-th track point group Direction, determine the first connection point on the first circle and the second connection
  • the direction of the track segment can be set to include 6 directions, and the 6 directions are respectively the horizontal direction, the vertical direction, the skew direction, the nap direction, the lift direction, and other directions.
  • the first coordinate difference being 0 and the second coordinate difference being 0
  • it is determined that the direction of the track segment corresponding to the k-th track point group is other directions, and in response to the first coordinate difference being not 0 and the second coordinate difference being 0 ,
  • the direction of the track segment corresponding to the k-th track point group is determined to be the horizontal direction, and in response to the first coordinate difference being 0 and the second coordinate difference being not 0, the direction of the track segment corresponding to the k-th track point group is determined to be vertical Direction, in response to the first coordinate difference being 0 and the second
  • the first connection on the first circle of each of the N track units corresponding to the N track points in the k-th track point group Point and the second connection point on the second circle including:
  • (xbj, ybj) is the coordinate of the first connection point corresponding to the jth trajectory unit in the N trajectory points corresponding to the N trajectory points in the kth trajectory point group
  • (xsj, ysj) is the jth
  • the coordinates of the second connection point corresponding to each trajectory unit (x2j, y2j) is the coordinate of the center of the first circle of the j-th trajectory unit
  • Rj is the radius of the first circle of the j-th trajectory unit
  • (x1j, y1j ) Is the coordinate of the center of the second circle of the j-th trajectory unit
  • rj is the radius of the second circle of the j-th trajectory unit.
  • the N trajectory units corresponding to the N trajectory points in the k-th trajectory point group include a third trajectory unit and a fourth trajectory unit, and the third trajectory unit and the fourth trajectory unit are adjacent to each other .
  • the first connection point and the second connection point corresponding to the point and the second connection point and the fourth trajectory unit define a quadrilateral, thereby connecting the third trajectory unit and the fourth trajectory unit.
  • first connect the first connection point and the second connection point corresponding to the third trajectory unit, connect the first connection point and the second connection point corresponding to the fourth trajectory unit, and then connect the third trajectory
  • the first connection point corresponding to the unit and the first connection point corresponding to the fourth trajectory unit connect the second connection point corresponding to the third trajectory unit and the second connection point corresponding to the fourth trajectory unit to determine a quadrilateral so that the first connection point
  • the three-track unit is connected to the fourth track unit.
  • FIG. 8A is a schematic diagram of a trajectory unit without transparency provided by an embodiment of the present disclosure
  • FIG. 8B is a schematic diagram of a trajectory unit with transparency provided by an embodiment of the present disclosure.
  • step S12 includes: determining, based on the writing speed of at least part of the track points in the at least one track point group, a plurality of intermediate track units corresponding to all the track points in the at least one track point group one by one; Perform processing to obtain multiple trajectory units.
  • processing multiple intermediate trajectory units to obtain multiple trajectory units includes: obtaining multiple intermediate transparency trajectory units one-to-one corresponding to the multiple intermediate trajectory units according to the multiple intermediate trajectory units, wherein each transparency The shape and size of the trajectory unit are the same as the shape and size of the intermediate trajectory unit corresponding to each transparency trajectory unit; for the hth intermediate transparency trajectory unit among the multiple intermediate transparency trajectory units, in the hth intermediate transparency trajectory unit Obtain multiple edge transparency pixels from the edge, and gradually change the transparency of multiple edge transparency pixels from 100% to 0% in the direction extending outward from the center of the h-th intermediate transparency track unit to obtain the h-th intermediate transparency track Transparency track unit corresponding to the unit, thereby obtaining a plurality of transparency track units corresponding to the multiple intermediate transparency track units one-to-one, where h is a positive integer greater than or equal to 1 and less than or equal to the number of multiple intermediate transparency track units, and multiple At least part of the edge transparency pixels in the edge transparency pixels are located in the corresponding h-th intermediate transparency track unit, and
  • Figure 8A shows the intermediate track unit without transparency
  • Figure 8B shows the intermediate track unit with transparency.
  • the intermediate track unit without transparency and the intermediate track unit with transparency can be represented by a pixel matrix
  • the intermediate track The shape of the unit is the same as the shape of the intermediate transparency track unit, and the size of the intermediate track unit and the size of the intermediate transparency track unit are also the same.
  • the gray scale value of the pixels inside the middle track unit is 1, and the gray scale value of the pixels outside the middle track unit is 0.
  • a grayscale value of 1 indicates that the pixel is opaque
  • a grayscale value of 0 indicates that the pixel is transparent.
  • the transparency of multiple edge transparency pixels at the edge of the intermediate transparency track unit is changed from 100% ( That is, the gray value is 1) gradually becomes 0% (that is, the gray value is 0), so as to obtain the transparency track unit corresponding to the middle track unit.
  • the intermediate trajectory unit corresponding to the trajectory point and the transparency trajectory unit can be superimposed to obtain the trajectory unit corresponding to the trajectory point.
  • the transparency of a certain pixel exceeds 100%, the transparency of the certain pixel is set to 100%.
  • the transparency of the pixel is multiplied by the RGB value of the pixel to determine the true color of the pixel, and the true color of each pixel is combined to finally determine the color of the handwriting used for display.
  • the transparent trajectory unit may not be provided.
  • FIG. 9 is a schematic diagram of the process of simulating the tip of a pencil provided by some embodiments of the present disclosure
  • FIG. 10 is an effect diagram of simulating the tip of a pencil provided by some embodiments of the present disclosure.
  • the tip type used for handwriting displayed on the touch screen is a brush tip.
  • the embodiments of the present disclosure include but are not limited thereto.
  • the pen tip type used for the handwriting displayed on the touch display screen may also be a pencil tip. For example, during the simulation of the pencil tip, you can set the line width displayed on the application layer to a constant value.
  • the application layer uses the set line width as the diameter and the initial sampling point (for example, the sampling point C1 shown in Figure 2A) as the center to determine the circle corresponding to the initial sampling point, so that the pen-starting part become rounded.
  • the pen movement stage keep the line width constant, determine the circle corresponding to each track point in the pen movement stage, then calculate the connection point of the circle corresponding to each track point, and finally connect each track in turn based on the connection point of the circle corresponding to each track point The circle corresponding to the point.
  • the sampling points corresponding to the writing speed are linearly positively correlated, and the direction of the long axis of the ellipse is related to the two circles corresponding to the last two sampling points collected by the application layer (for example, the sampling point C8 and the sampling point C9 shown in Figure 2A)
  • the connection direction between the center of the circle is the same.
  • the tip type of the two Chinese characters "Spring" is a pencil tip.
  • FIG. 11 is a schematic block diagram of a handwriting processing device provided by at least one embodiment of the present disclosure.
  • the handwriting processing apparatus 1200 includes a memory 1220 and a processor 1230. It should be noted that the components of the handwriting processing device 1200 shown in FIG. 11 are only exemplary and not restrictive. According to actual application requirements, the handwriting processing device 1200 may also have other components.
  • the memory 1220 is used for non-transitory storage of computer readable instructions; the processor 1230 is used for running computer readable instructions, and the computer readable instructions are executed by the processor 1230 when they are executed in the handwriting processing method according to any of the above embodiments. One or more steps.
  • the handwriting processing device 1200 further includes a touch screen 1240.
  • the touch display screen 1240 is configured to obtain the original handwriting trajectory based on the user's touch operation.
  • the touch screen 1240 may include input devices such as an electronic pen, a touch screen, a mouse, and a touch pad.
  • the touch screen 1240 is also configured to display the handwriting for display.
  • the touch screen 1240 may also include a display device such as the projector described above.
  • the memory 1220 and the processor 1230 may be integrated in the touch display 1240.
  • the memory 1220 and the processor 1230 may also be integrated in a cloud server.
  • the handwriting processing device 1200 may also include a communication module, which is used to implement communication between the handwriting processing device 1200 and other electronic equipment.
  • a communication module may be used to implement communication between the handwriting processing device 1200 and other electronic equipment.
  • the communication module may The handwriting used for display is transmitted from the display screen of the airport to the user's mobile phone or tablet computer, so that the user's mobile phone or tablet computer can store the handwriting used for display.
  • the processor 1230 may control other components in the handwriting processing apparatus 1200 to perform desired functions.
  • the processor 1230 may be a central processing unit (CPU), a tensor processor (TPU), and other devices with data processing capabilities and/or program execution capabilities.
  • the central processing unit (CPU) can be an X86 or ARM architecture.
  • the memory 1220 may include any combination of one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • Volatile memory may include random access memory (RAM) and/or cache memory (cache), for example.
  • the non-volatile memory may include, for example, read only memory (ROM), hard disk, erasable programmable read only memory (EPROM), portable compact disk read only memory (CD-ROM), USB memory, flash memory, and the like.
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM portable compact disk read only memory
  • USB memory flash memory, and the like.
  • One or more computer-readable instructions may be stored on the computer-readable storage medium, and the processor 1230 may run the computer-readable instructions to implement various functions of the handwriting processing apparatus 1200.
  • the network may include a wireless network, a wired network, and/or any combination of a wireless network and a wired network.
  • the network may include a local area network, the Internet, a telecommunications network, the Internet of Things (Internet of Things) based on the Internet and/or a telecommunications network, and/or any combination of the above networks, and so on.
  • the wired network may, for example, use twisted pair, coaxial cable, or optical fiber transmission for communication, and the wireless network may use, for example, a 3G/4G/5G mobile communication network, Bluetooth, Zigbee, or WiFi.
  • the present disclosure does not limit the types and functions of the network here.
  • FIG. 12 is a schematic diagram of a storage medium provided by at least one embodiment of the present disclosure.
  • one or more computer-readable instructions 1301 may be non-transitory stored on the storage medium 1300.
  • the computer-readable instructions 1301 are executed by a computer, one or more steps in the handwriting processing method described above can be executed.
  • the storage medium 1300 may be applied to the handwriting processing device 1200 described above, for example, it may be the memory 1220 in the handwriting processing device 1200.
  • the description of the storage medium 1300 reference may be made to the description of the memory in the embodiment of the handwriting processing apparatus 1200, and repetitions are not repeated here.
  • FIG. 13 shows a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
  • the handwriting processing device 1200 provided in the present disclosure can be applied to the Internet system.
  • the handwriting processing device 1200 involved in the present disclosure can be realized by using the computer system provided in FIG. 13.
  • Such computer systems may include personal computers, laptops, tablet computers, mobile phones, personal digital assistants, smart glasses, smart watches, smart rings, smart helmets, and any smart portable devices or wearable devices.
  • the specific system in this embodiment uses a functional block diagram to explain a hardware platform including a user interface.
  • This kind of computer equipment can be a general purpose computer equipment or a special purpose computer equipment. Both types of computer equipment can be used to implement the handwriting processing apparatus 1200 in this embodiment.
  • the computer system can implement any of the currently described components of the information needed to achieve handwriting beautification.
  • a computer system can be realized by a computer device through its hardware device, software program, firmware, and their combination.
  • the related computer functions described in this embodiment to realize the information required for handwriting beautification can be implemented by a group of similar platforms in a distributed manner. Distribute the processing load of the computer system.
  • the computer system may include a communication port 250, which is connected to a network that realizes data communication.
  • a computer system may send and receive information and data through the communication port 250, that is, the communication port 250 may realize the communication between the computer system and the computer system.
  • Other electronic devices perform wireless or wired communication to exchange data.
  • the computer system may also include a processor group 220 (ie, the processor described above) for executing program instructions.
  • the processor group 220 may be composed of at least one processor (e.g., CPU).
  • the computer system may include an internal communication bus 210.
  • the computer system may include different forms of program storage units and data storage units (ie, the memory or storage medium described above), such as a hard disk 270, a read only memory (ROM) 230, and a random access memory (RAM) 240, which can be used for storage Various data files used for computer processing and/or communication, and possible program instructions executed by the processor group 220.
  • the computer system may also include an input/output component 260, which is used to implement input/output data flow between the computer system and other components (for example, the user interface 280, etc.).
  • the following devices can be connected to the input/output component 260: including input devices such as touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; including, for example, liquid crystal displays (LCD), speakers, vibrators, etc.
  • the output device including storage devices such as tapes, hard disks, etc.; and communication interfaces.
  • FIG. 13 shows a computer system with various devices, it should be understood that the computer system is not required to have all the devices shown, and instead, the computer system may have more or fewer devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • User Interface Of Digital Computer (AREA)
  • Image Generation (AREA)

Abstract

一种笔迹处理方法、笔迹处理装置、非瞬时性存储介质。笔迹处理方法包括:对在触控显示屏上的原始笔迹轨迹进行采样以得到多个采样点;基于多个采样点,计算得到至少一个轨迹点组,其中,至少一个轨迹点组中的每个轨迹点组包括N个轨迹点,N个轨迹点包括M个采样点,N为大于等于3的整数,M为大于等于3的整数,M≤N;基于在至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,其中,多个轨迹单元的每个轨迹单元为水滴状的水滴单元;依次连接多个轨迹单元,以得到用于在触控显示屏上显示的笔迹。

Description

笔迹处理方法、笔迹处理装置、存储介质
本申请要求于2020年4月30日递交的中国专利申请第202010365298.1号的优先权,在此全文引用上述中国专利申请公开的内容以作为本申请的一部分。
技术领域
本公开的实施例涉及一种笔迹处理方法、笔迹处理装置、非瞬时性存储介质。
背景技术
随着信息技术的迅速发展,书写输入的技术越来越成熟,用户对笔迹效果的要求也越来越高,用户不仅希望笔迹能被识别,更希望笔迹达到美观且具有逼真的笔锋效果。
发明内容
本公开的实施例提供一种笔迹处理方法,包括:对在触控显示屏上的原始笔迹轨迹进行采样以得到多个采样点;基于所述多个采样点,计算得到至少一个轨迹点组,其中,所述至少一个轨迹点组中的每个轨迹点组包括N个轨迹点,所述N个轨迹点包括M个采样点,N为大于等于3的整数,M为大于等于3的整数,M≤N;基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,其中,所述多个轨迹单元的每个轨迹单元为水滴状的水滴单元;依次连接所述多个轨迹单元,以得到用于在所述触控显示屏上显示的笔迹。
例如,在本公开一实施例提供的笔迹处理方法中,所述多个轨迹滴单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:确定在所述所有轨迹点中的动作类型为运笔的轨迹点,以得到T1个运笔轨迹点,其中,T1为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T1个运笔轨迹点一一对应的T1个运笔轨迹单元;获取第一平均参考速度;对于所述T1个运笔轨迹点中的第p个运笔轨迹点,根据所述第一参考平均速度和所述第p个运笔轨迹点对应的书写速度和位置,确定所述T1个运笔轨迹单元中与所述第p个运笔轨迹点对应的第p个运笔轨迹单元中的第一圆的半径和圆心,其中,p为正整数,且p小于等于T1;根据所述第p个运笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第p个运笔轨迹单元中的第二圆的半径和圆心;基于所述第p个运笔轨迹单元中的第一圆和第二圆,确定所述第p个运笔轨迹单元中的多边形,以确定所述第p个运笔轨迹单元,从而确定与所述T1个运笔轨迹点一一对应的所述T1个运笔轨迹单元,其中,所述第p个运笔轨迹单元的 第一圆的半径由所述第p个运笔轨迹点对应的书写速度和所述第一平均参考速度决定,且满足以下关系式:
dt=kt*dt-1,kt=2/(1+e [0.06*(vt-vavg)/vavg])
其中,dt为在所述第p个运笔轨迹单元中的所述第一圆的直径,dt-1为与所述第p个运笔轨迹单元在时间上相邻的前一个轨迹单元的第一圆的直径,kt为所述第p个运笔轨迹点对应的半径调整系数,vt为所述第p个运笔轨迹点对应的书写速度,vavg为所述第一平均参考速度,0.3*ds≤dt≤1.1*ds,ds为设定线宽,
所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
do/R=C1,
其中,R为所述第一圆的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和所述第二圆的半径满足以下关系式:
r/R=C2,
其中,r为所述第二圆的半径,C2为常数。
例如,在本公开一实施例提供的笔迹处理方法中,所述多个轨迹单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:确定在所述所有轨迹点中的动作类型为收笔的轨迹点,以得到T2个收笔轨迹点,其中,T2为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T2个收笔轨迹点一一对应的T2个收笔轨迹单元;获取第二平均参考速度,其中,所述第二平均参考速度小于第一平均参考速度,所述第一平均参考速度为运笔阶段对应的参考速度;对于所述T2个收笔轨迹点中的第i个收笔轨迹点,根据所述第二平均参考速度和所述第i个收笔轨迹点对应的书写速度和位置,确定所述T2个收笔轨迹单元中与所述第i个收笔轨迹点对应的第i个收笔轨迹单元中的第一圆的半径和圆心,其中,i为正整数,且i小于等于T2;根据所述第i个收笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第i个收笔轨迹单元的第二圆的半径和圆心;基于所述第i个收笔轨迹单元中的第一圆和第二圆,确定所述第i个收笔轨迹单元中的多边形,以确定所述第i个收笔轨迹单元,从而确定与所述T2个收笔轨迹点一一对应的所述T2个收笔轨迹单元,其中,所述第i个收笔轨迹单元的第一圆的半径由所述第i个收笔轨迹点对应的书写速度和所述第二平均参考速度决定,满足以下关系式:
dy=ki’*dy-1,ki’=6/(1+e [0.06*(vi-vavg’)/vavg’])
其中,dy为在所述第i个收笔轨迹单元中的第一圆的直径,dy-1为与所述第i个收笔轨迹单元在时间上相邻的前一个轨迹单元的第一圆的直径,ki’为所述第i个收笔轨迹单元对应的半径调整系数,vi为所述第i个收笔轨迹点对应的书写速度,vavg’为所述第二平均参考速度,
所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
do/R=C1,
其中,R为所述第一圆的调节后的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和所述第二圆的半径满足以下关系式:
r/R=C2,
其中,r为所述第二圆的半径,C2为常数。
例如,在本公开一实施例提供的笔迹处理方法中,所述多个轨迹单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元包括:确定在所述所有轨迹点中的动作类型为起笔的轨迹点,以得到T3个起笔轨迹点,其中,T3为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T3个起笔轨迹点一一对应的T3个起笔轨迹单元;设定所述T3个起笔轨迹单元的第一圆的直径为设定线宽;对于所述T3个起笔轨迹点中的第z个起笔轨迹点,根据所述第z个起笔轨迹点对应的位置,确定所述T3个起笔轨迹单元中与所述第z个起笔轨迹点对应的第z个起笔轨迹单元中的第一圆的圆心,其中,z为正整数,且z小于等于T3;根据所述第z个起笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第z个起笔轨迹单元中的第二圆的半径和圆心;基于所述第z个起笔轨迹单元中的第一圆和第二圆,确定所述第z个起笔轨迹单元中的多边形,以确定所述第z个起笔轨迹单元,从而确定所述T3个起笔轨迹点对应的所述T3个起笔轨迹单元,其中,所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
do/R=C1,
其中,R为所述第一圆的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和 所述第二圆的半径满足以下关系式:
r/R=C2,
其中,r为所述第二圆的半径,C2为常数。
例如,在本公开一实施例提供的笔迹处理方法中,依次连接所述多个轨迹单元,以得到用于在所述触控显示屏上显示的所述笔迹,包括:基于所述至少一个轨迹点组中的所有轨迹点在所述原始笔迹轨迹上对应的位置,对所述多个轨迹单元进行排序;对于排序后的所述多个轨迹单元中的任意相邻的第一轨迹单元和第二轨迹单元,响应于所述第一轨迹单元的第一圆和第二圆和所述第二轨迹单元的第一圆和第二圆中的任意两个圆均不是内含关系,确定所述第一轨迹单元的第一圆和所述第二轨迹单元的第一圆之间的两个第一公切点和两个第二公切点,确定所述第一轨迹单元的第二圆和所述第二轨迹单元的第二圆之间的两个第三公切点和两个第四公切点,其中,所述两个第一公切点位于所述第一轨迹单元的第一圆上,所述两个第二公切点位于所述第二轨迹单元的第一圆上,所述两个第三公切点位于所述第一轨迹单元的第二圆上,所述两个第四公切点位于所述第二轨迹单元的第二圆上;从所述两个第一公切点、所述两个第二公切点、所述两个第三公切点和所述两个第四公切点中选择得到四个目标公切点;依次连接所述四个目标公切点确定一个四边形,以使所述第一轨迹单元和所述第二轨迹单元连接,从而依次连接所述多个轨迹单元以得到所述笔迹。
例如,本公开一实施例提供的笔迹处理方法还包括:响应于所述第一轨迹单元的第一圆和第二圆和所述第二轨迹单元的第一圆和第二圆中的至少两个圆是内含关系,则确定所述第一轨迹单元和所述第二轨迹单元不需要连接。
例如,在本公开一实施例提供的笔迹处理方法中,从所述两个第一公切点、所述两个第二公切点、所述两个第三公切点和所述两个第四公切点中选择得到四个目标公切点,包括:确定所述第一轨迹单元的第一圆和第二圆之间的第一外公切线和第二外公切线,其中,所述第一外公切线的斜率小于所述第二外公切线的斜率;确定所述第一轨迹单元的第二圆和所述第二轨迹单元的第二圆之间的第三外公切线和第四外公切线;响应于所述第三外公切线的斜率大于所述第四公切线的斜率,且所述第三外公切线的斜率大于所述第一外公切线的斜率且小于所述第一轨迹单元的第一圆的圆心和第二圆的圆心之间的所述圆心连线的斜率,或者,响应于所述第三外公切线的斜率小于所述第四公切线的斜率,且所述第三外公切线的斜率小于所述第二外公切线的斜率且大于所述第一轨迹单元的第一圆的圆心和第二圆的圆心之间的所述连线的斜率,将所述两个第一公切点和所述两个第二公切点作为所述四个目标公切点;响应于所述第三外公切线的斜率大于所述第四公切线的斜率且小于所述第一外公切线的斜率,或者,响应于所述第三外公切线的斜率小于所述第四公切线的斜率且大于所述第二外公切线的斜率,将所述两个第一公切点中远离所述第一轨迹单元的第二圆的第一公切点、所述两个第三公切点中远离所述第一轨迹单元的第一圆的第三公切点、所述两个第二公切点中远离所述第二轨迹单元的第二圆的第二公切点和所述两个第四公切点中远离所述第二轨迹单元的第一圆的第四公切点作为所述四个目标公切点。
例如,在本公开一实施例提供的笔迹处理方法中,依次连接所述多个轨迹单元,以得到用于在所述触控显示屏上显示的所述笔迹,包括:对于所述至少一个轨迹点组中第k个轨迹点组,其中,所述第k个轨迹点组中的N个轨迹点在所述原始笔迹轨迹的延伸方向上依次排列,k为正整数,且小于等于所述至少一个轨迹点组的数量;确定在所述原始笔迹轨迹的延伸方向上所述第k个轨迹点组中的第一个轨迹点和第N个轨迹点;获取所述第一个轨迹点的第一个坐标和所述第N个轨迹点的第二个坐标;根据所述第一个坐标和所述第二个坐标,确定所述第k个轨迹点组对应的轨迹段的方向,根据所述第k个轨迹点组对应的所述轨迹段的方向,确定所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点;根据所述N个轨迹单元对应的N个第一连接点和N个第二连接点依次连接所述N个轨迹单元,从而依次连接所述多个轨迹单元,以得到所述笔迹。
例如,在本公开一实施例提供的笔迹处理方法中,根据所述第一个坐标和所述第二个坐标,确定所述第k个轨迹点组对应的轨迹段的方向,包括:根据所述第一个坐标和所述第二个坐标,确定第一坐标差和第二坐标差,其中,所述第一个坐标为(x1,y1),所述第二个坐标为(x2,y2),所述第一坐标差Δx表示为Δx=x2-x1,所述第二坐标差Δy表示为Δy=y2-y1;响应于所述第一坐标差为0和所述第二坐标差为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为其他方向,响应于所述第一坐标差不为0和所述第二坐标差为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为横方向,响应于所述第一坐标差为0和所述第二坐标差不为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为竖方向,
响应于所述第一坐标差不为0和所述第二坐标差不为0:
当Δx>0且
Figure PCTCN2021080463-appb-000001
确定所述第k个轨迹点组对应的所述轨迹段的方向为横方向,
当Δy>0且
Figure PCTCN2021080463-appb-000002
确定所述第k个轨迹点组对应的所述轨迹段的方向为竖方向,
当Δx<0,Δy>0且
Figure PCTCN2021080463-appb-000003
确定所述第k个轨迹点组对应的所述轨迹段的方向为撇方向,
当Δx>0,Δy>0且
Figure PCTCN2021080463-appb-000004
确定所述第k个轨迹点组对应的所述轨迹段的方向为捺方向,
当Δx>0,Δy<0且
Figure PCTCN2021080463-appb-000005
确定所述第k个轨迹点组对应的所述轨迹段的方向为提方向,
当Δx<0且Δy<0,确定所述第k个轨迹点组对应的所述轨迹段的方向为所述其他提方向。
例如,在本公开一实施例提供的笔迹处理方法中,根据所述第k个轨迹点组对应的所述轨迹段的方向,确定所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点,包括:当所述第k个轨迹点组对应的所述轨迹段的方向为横方向时:xsj=x1j,ysj=y1j-rj,xbj=x2j,ybj=y2j+Rj;当所述第k个轨迹点组对应的所述轨迹段的方向为竖方向时:xsj=x1j-rj,ysj=y1j,xbj=x2j+Rj,ybj=y2j;当所述第k个轨迹点组对应的所述轨迹段的方向为撇方向或提方向时:xsj=x1j-0.707*rj,ysj=y1j-0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j+0.707*Rj;当所述第k个轨迹点组对应的所述轨迹段的方向为捺方向或其他方向时:xsj=x1j-0.707*rj,ysj=y1j+0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j-0.707*Rj;其中,(xbj,ybj)为所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的第j个轨迹单元对应的第一连接点的坐标,(xsj,ysj)为所述第j个轨迹单元对应的第二连接点的坐标,(x2j,y2j)为所述第j个轨迹单元的第一圆的圆心的坐标,Rj为所述第j个轨迹单元的第一圆的半径,(x1j,y1j)为所述第j个轨迹单元的第二圆的圆心的坐标,rj为所述第j个轨迹单元的第二圆的半径。
例如,在本公开一实施例提供的笔迹处理方法中,所述C1的范围为1.2~2,所述C2的范围为0.2~0.4,所述预设圆心角度的范围为20°~40°,在基于所述触控显示屏的显示画面确定的像素坐标系中,所述第一圆的圆心的横坐标大于所述第二圆的圆心的横坐标,所述第一圆的圆心的纵坐标大于所述第二圆的圆心的纵坐标。
例如,在本公开一实施例提供的笔迹处理方法中,基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:基于所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个中间轨迹单元,对所述多个中间轨迹单元进行透明度处理,以得到所述多个轨迹单元。
例如,在本公开一实施例提供的笔迹处理方法中,对所述多个中间轨迹单元进行透明度处理,以得到所述多个轨迹单元,包括:根据所述多个中间轨迹单元,得到与所述多个中间轨迹单元一一对应的多个中间透明度轨迹单元,其中,每个所述透明度轨迹单元的形状和尺寸与每个所述透明度轨迹单元对应的中间轨迹单元的形状和尺寸均相同;对于所述多个中间透明度轨迹单元中的第h个中间透明度轨迹单元,在所述第h个中间透明度轨迹单元的边缘获取多个边缘透明度像素,从所述第h个中间透明度轨迹单元的中心向外延伸的方向上,将所述多个边缘透明度像素的透明度从100%逐渐变为0%,以得到所述第h个中间透明度轨迹单元对应的透明度轨迹单元,从而得到与所述多个中间透明度轨迹单元一一对应的多个透明度轨迹单元,其中,h为大于等于1且小于等于所述多个中间透明度轨迹单元的数量的正整数,所述多个边缘透明度像素中的至少部分边缘透明度像素位于对应的所述第h个中间透明度轨迹单元内,所述第h个中间透明度轨迹单元中除了所述多个边缘透明度像素之外的所有像素的透明度为100%;将所述多个中间轨迹单元和所述多个透明度轨迹单元 分别进行叠加,以得到所述多个轨迹单元。
例如,在本公开一实施例提供的笔迹处理方法中,基于所述多个采样点,计算得到至少一个轨迹点组,包括:基于所述多个采样点,将所述原始笔迹轨迹划分为至少一个轨迹段,其中,每个轨迹段包括M个采样点;对所述至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,从而得到所述至少一个轨迹点组。
例如,在本公开一实施例提供的笔迹处理方法中,对所述至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,包括:对于每个轨迹段,根据该轨迹段对应的M个采样点,拟合得到所述轨迹段对应的贝塞尔曲线,在所述贝塞尔曲线上进行取点,以得到与所述轨迹段对应的轨迹点组。
例如,在本公开一实施例提供的笔迹处理方法中,所述笔迹的笔锋类型为毛笔笔锋。
本公开一实施例还提供一种笔迹处理装置,包括:存储器,用于非暂时性存储计算机可读指令;以及处理器,用于运行所述计算机可读指令,其中,所述计算机可读指令被所述处理器运行时执行根据上述任一实施例所述的笔迹处理方法。
例如,本公开一实施例提供的笔迹处理装置还包括:触控显示屏,所述触控显示屏配置为基于用户的触控操作以获取所述原始笔迹轨迹。
例如,在本公开一实施例提供的笔迹处理装置中,所述触控显示屏还配置为显示所述笔迹。
本公开一实施例还提供一种非瞬时性存储介质,非暂时性地存储计算机可读指令,其中,当所述计算机可读指令由计算机执行时可以执行根据上述任一实施例所述的笔迹处理方法。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。
图1为本公开一实施例提供的一种笔迹处理方法的示意性流程图;
图2A为本公开一些实施例提供的一种轨迹点组的示意图;
图2B为本公开一些实施例提供的另一种轨迹点组的示意图;
图3A为本公开一实施例提供的一种轨迹单元的示意图;
图3B为本公开一实施例提供的一种轨迹点的书写速度和轨迹点对应的轨迹单元的第一圆的直径之间的关系示意图;
图4为本公开一实施例提供的一种用于显示的笔迹的示意图;
图5A为本公开一实施例提供的一种第一轨迹单元和第二轨迹单元的示意图;
图5B为本公开一实施例提供的另一种第一轨迹单元和第二轨迹单元的示意图;
图6A为本公开一实施例提供的又一种第一轨迹单元和第二轨迹单元的示意图;
图6B为本公开一实施例提供的再一种第一轨迹单元和第二轨迹单元的示意图;
图7为本公开一实施例提供的又一种第一轨迹单元和第二轨迹单元的示意图;
图8A为本公开一实施例提供的一种不带透明度的轨迹单元的示意图;
图8B为本公开一实施例提供的一种带透明度的轨迹单元的示意图;
图9为本公开一些实施例提供的一种模拟铅笔笔锋的过程示意图;
图10为本公开一些实施例提供的一种模拟铅笔笔锋的效果图;
图11为本公开至少一实施例提供的一种笔迹处理装置的示意性框图;
图12为本公开至少一个实施例提供的一种存储介质的示意图;
图13示出了为本公开至少一实施例提供的一种硬件环境的示意图。
具体实施方式
为了使得本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。为了保持本公开实施例的以下说明清楚且简明,本公开省略了部分已知功能和已知部件的详细说明。
在教育、办公、医疗等领域内,智能交互设备,如电子白板作为一种便捷的工具,对信息的交互与共享产生了极其重要的作用。但是,电子交互白板的处理速度、笔迹美化效果还有待提升。目前,实现无压感书写输入毛笔笔锋效果的方法通常比较复杂,需要花费时间进行大量的计算才能输出具有笔锋效果的笔画,对硬件的计算资源要求较高,实时性欠缺,用户很难获得畅快的书写输入体验。
并且,近年来,随着平板电脑、智能手机等智能设备的技术进步,用户对书写功能的要求越来越高。然而,由于在智能设备的屏幕上的书写感受与在实际纸张上的书写感受不同,以及用户本身对书法的不熟悉,在智能设备上的书写效果不佳。笔迹自动美化技术能够消除书写笔迹的锯齿状或台阶状外观,同时具有笔锋效果,为用户提供更加光滑、圆润、流畅、自然的书写体验。
本公开的实施例提供的一种笔迹处理方法、笔迹处理装置和计算机存储介质,该笔迹处理方法包括:对在触控显示屏上的原始笔迹轨迹进行采样以得到多个采样点;基于多个采样点,计算得到至少一个轨迹点组,其中,至少一个轨迹点组中的每个轨迹点组包括N个轨 迹点,N个轨迹点包括M个采样点,N为大于等于3的整数,M为大于等于3的整数,M≤N;基于在至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,其中,多个轨迹单元的每个轨迹单元为水滴状的水滴单元;依次连接多个轨迹单元,以得到用于在触控显示屏上显示的笔迹。
本公开的至少一实施例提供的笔迹处理方法中,用户通过手或者笔在电子设备上进行书写时,该无压感的书写轨迹还可以被美化为具有毛笔笔锋的展示效果,从而在电子设备上显示平滑且美化后的书写轨迹,在无压感情况下实时且有效地实现笔迹美化的效果。此外,该笔迹处理方法的计算速度快、实现原理简单、实时性好,从而笔迹处理方法可以应用于电子交互白板(例如,会议白板、教学白板等)、电子板报、机场数字签名墙、云本等需要书写输入的场景。
下面结合附图对本公开的几个实施例进行详细说明,但是本公开并不限于这些具体的实施例。
图1为本公开一实施例提供的一种笔迹处理方法的示意性流程图。
例如,如图1所示,本公开一实施例提供的笔迹处理方法适用于具有触控显示功能的触控显示屏,可以包括以下步骤S10-S13:
步骤S10:对在触控显示屏上的原始笔迹轨迹进行采样以得到多个采样点;
步骤S11:基于多个采样点,计算得到至少一个轨迹点组;
步骤S12:基于在至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元;
步骤S13:依次连接多个轨迹单元,以得到用于在触控显示屏上显示的笔迹。
本公开实施例提供的笔迹处理方法可以基于轨迹点的运笔速度确定轨迹点对应的轨迹单元,从而实现模拟毛笔笔锋的书写效果。例如,在一些实施例中,本公开这些实施例提供的笔迹处理方法能够为机场显示屏提供一种趣味交互方式。机场作为一个城市的地标性建筑,是吸引游客的重要方式。本公开提供的笔迹处理方法可以集成到机场的显示屏上,当游客到达某个城市的机场时,可以在显示屏上书写签名,并以美化后的毛笔笔迹形式展示在显示屏上。游客与签名合影,形成一种独特的旅游“打卡”方式,从而吸引游客,有助于促进城市旅游业的发展。在另一些实施例中,本公开这些实施例提供的笔迹处理方法能够为智慧教室提供一种新型板报方式,该笔迹处理方法可以对学生或老师的板书、板报字体做美化,给出更清晰的的呈现。此外,该笔迹处理方法也可以设计更多的笔迹风格,例如,铅笔笔锋、钢笔笔锋等,在不丧失原有字体的基础上,形成更美观的字体。
例如,笔迹处理方法可以应用于搭载有安卓(android)系统的电子设备上,电子设备可以包括应用层和算法层。应用层可以用于实现上述步骤S10,算法层可以用于实现上述步骤S11-S13。首先,应用层用于获取用户在触控显示屏上书写且由触控显示屏采集的原始笔迹轨迹(例如原始笔迹轨迹对应的初始数据,触控显示屏按照预定时序进行触控信号采集,得到初始数据,对初始数据进行处理得到相应的原始笔迹轨迹(例如,触控显示屏上被触摸点 (触控电容)的组合)),并对原始笔迹轨迹进行采样以得到的多个采样点的坐标、类型和书写时间等相关信息。然后,应用层可以将多个采样点的坐标和每个采样点对应的类型和书写时间等相关信息传输至算法层,从而使算法层执行计算、判断等以进行后续美化笔迹的操作,例如,算法层对多个采样点进行平滑处理,并计算在不同笔锋(例如,铅笔笔锋或毛笔笔锋)的情况下,原始笔迹轨迹的显示方案,使原始笔迹轨迹实现笔迹美化的效果。原始笔迹轨迹的显示方案通过应用层实现显示,原始笔迹轨迹的显示方案包括起笔阶段的显示方案、运笔阶段的显示方案和收笔阶段的显示方案。需要说明的是,在本公开的实施例中,算法层可以对应于应用程序本身(例如,书写程序等),应用层对应于底层的驱动程序,底层的驱动程序对于触控显示屏采集的初始数据进行处理以得到对应的原始笔迹轨迹的数据,例如,时间、位置等;算法层获取经底层的驱动程序反馈的原始笔迹轨迹的数据,然后进行进一步处理。
例如,在步骤S10中,原始笔迹轨迹可以为用户通过手或笔输入到触控显示屏上的笔迹,即用户书写的笔迹。应用层可以通过稀疏采点的方式对原始笔迹轨迹进行采样以到多个采样点。多个采样点的数量可以根据实际情况确定。
例如,多个采样点沿着原始笔迹轨迹彼此间隔,即多个采样点彼此不重叠。
例如,原始笔迹轨迹可以具有任何形状。原始笔迹轨迹可以为中文字的轨迹,也可以为外文字(例如,英文、日文等)的轨迹。
需要说明的是,在一些实施例中,原始笔迹轨迹不在触控显示屏上进行显示;在另一实施例中,原始笔迹轨迹也可以在触控显示屏上进行显示,从而使用户可以同时观看到原始笔迹轨迹和美化后的笔迹。
图2A为本公开一些实施例提供的一种轨迹点组的示意图;图2B为本公开一些实施例提供的另一种轨迹点组的示意图。
例如,在步骤S11中,至少一个轨迹点组中的每个轨迹点组包括N个轨迹点,N个轨迹点包括M个采样点,N为大于等于3的整数,M为大于等于3的整数,M小于等于N。例如,在一些实施例中,N为9,M为3。本公开包括但不限于此,N和M的数量可以根据实际情况确定,在另一些实施例中,M可以为4,N可以为13。
例如,在一些实施例中,步骤S11可以包括:基于多个采样点,将原始笔迹轨迹划分为至少一个轨迹段,其中,每个轨迹段包括M个采样点;对至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,从而得到至少一个轨迹点组。
例如,如图2A所示,在一些实施例中,应用层可以在原始笔迹轨迹110上等时间间隔进行采样取点,以得到9个采样点C1-C9(黑空心点)。在原始笔迹轨迹110上,9个采样点C1-C9依次排列,例如,采样点C1和采样点C2相邻,采样点C2和采样点C3相邻,依次类推。
例如,在一些实施例中,在用户书写原始笔迹轨迹110的过程中,实时对原始笔迹轨迹110进行采样,以得到采样点,例如,每当应用层采样到三个采样点,应用层可以将采样到 三个采样点输入至算法层,然后,算法层可以对该采样到的三个采样点进行处理,从而可以节省时间。例如,如图2A所示,在用户书写原始笔迹轨迹110的过程中,应用层即可对原始笔迹轨迹110进行采样,当应用层采样到采样点C1-C3之后,应用层即可将采样点C1-C3输入至算法层,以供算法层进行后续处理;同时,应用层继续进行采样,当应用层采样到采样点C4和C5之后,应用层即可将采样点C3-C5输入至算法层,依次类推。需要说明的是,例如,当算法层对采样点C1-C3进行处理之后,即可在触控显示屏上显示该用于显示的笔迹的与采样点C1-C3对应的部分,从而实现实时显示。又例如,也可以在算法层对所有采样点(例如采样点C1-C9)进行处理之后,然后,在触控显示屏上显示该完整的用于显示的笔迹。
又例如,在另一些实施例中,在用户书写完原始笔迹轨迹110之后,应用层再对原始笔迹轨迹110进行采样,以得到采样点。
例如,9个采样点C1-C9可以将原始笔迹轨迹划分为四个轨迹段,四个轨迹段分别为采样点C1-C3之间的第一轨迹段、采样点C3-C5之间的第二轨迹段、采样点C5-C7之间的第三轨迹段和采样点C7-C9之间的第四轨迹段。第一轨迹段、第二轨迹段、第三轨迹段和第四轨迹段在原始笔迹轨迹110的延伸方向(即从采样点C1到采样点C9的方向)上依次排列,第一轨迹段和第二轨迹段相邻且均与同一个采样点C3对应,第二轨迹段和第三轨迹段相邻且均与同一个采样点C5对应,第三轨迹段和第四轨迹段相邻且均与同一个采样点C7对应。
例如,原始笔迹轨迹110包括对应于起笔阶段的部分、对应于运笔阶段的部分和对应于收笔阶段的部分。对应于起笔阶段的部分、对应于运笔阶段的部分和对应于收笔阶段的部分可以根据安卓系统的事件驱动的规则确定,例如,落笔事件对应于起笔阶段,抬笔事件对应于收笔阶段等。例如,如图2A所示,在一些实施例中,第一轨迹段可以表示原始笔迹轨迹110的对应于起笔阶段的部分,第二轨迹段和第三轨迹段可以表示原始笔迹轨迹110的对应于运笔阶段的部分,第四轨迹段可以表示原始笔迹轨迹110的对应于收笔阶段的部分。需要说明的是,在时间上,起笔阶段的部分位于运笔阶段的部分之前,运笔阶段的部分位于收笔阶段的部分之前。
例如,对至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,包括:对于每个轨迹段,根据该轨迹段中的M个采样点,拟合得到该轨迹段对应的贝塞尔曲线,在贝塞尔曲线上进行取点,以得到与轨迹段对应的轨迹点组。
例如,对于第一轨迹段,可以对第一轨迹段对应的三个采样点C1-C3进行二阶贝塞尔曲线拟合以得到与第一轨迹段对应的贝塞尔曲线100。类似地,对于第二轨迹段,可以对第二轨迹段对应的三个采样点C3-C5进行二阶贝塞尔曲线拟合以得到与第二轨迹段对应的贝塞尔曲线;对于第三轨迹段,可以对第三轨迹段对应的三个采样点C5-C7进行二阶贝塞尔曲线拟合以得到与第三轨迹段对应的贝塞尔曲线;对于第四轨迹段,可以对第四轨迹段对应的三个采样点C7-C9进行二阶贝塞尔曲线拟合以得到与第四轨迹段对应的贝塞尔曲线。
例如,以第一轨迹段为例,如图2A所示,与第一轨迹段对应的贝塞尔曲线100上进行插值取点,以得到与第一轨迹段对应的轨迹点组。例如,在采样点C1和采样点C2之间采样3个轨迹点,在采样点C2和采样点C3之间也采样3个轨迹点,由此,与第一轨迹段对应的轨迹点组包括9个轨迹点,该9个轨迹点为与第一轨迹段对应的三个采样点C1-C3和图2A所示的在贝塞尔曲线100上的其余6个轨迹点(黑实心点,即插值得到的点)。对所有轨迹段分别进行插值取点,从而得到与至少一个轨迹段一一对应的至少一个轨迹点组。
例如,如图2B所示,在另一些实施例中,应用层可以在原始笔迹轨迹上例如等时间间隔进行采样取点,以得到5个采样点A1-A5。在原始笔迹轨迹上,5个采样点A1-A5依次排列,例如,采样点A1和采样点A2相邻,采样点A2和采样点A3相邻,依次类推。
例如,5个采样点A1-A5也可以将原始笔迹轨迹划分为四个轨迹段,四个轨迹段分别为采样点A1-A2之间的第一轨迹段、采样点A2-A3之间的第二轨迹段、采样点A3-A4之间的第三轨迹段和采样点A4-A5之间的第四轨迹段。第一轨迹段、第二轨迹段、第三轨迹段和第四轨迹段在原始笔迹轨迹的延伸方向(即从采样点A1到采样点A5的方向)上依次排列。
例如,对于第一轨迹段,首先,应用层将与第一轨迹段对应的两个采样点A1和A2传输至算法层,然后,算法层计算出采样点A1和A2的中点B1,对采样点A1和A2、中点B1进行二阶贝塞尔曲线拟合以得到与第一轨迹段对应的贝塞尔曲线100。类似地,对于第二轨迹段,应用层将对第二轨迹段对应的两个采样点A2和A3传输至算法层,算法层计算出采样点A2和A3的中点B2,对采样点A2和A3、中点B2进行二阶贝塞尔曲线拟合以得到与第二轨迹段对应的贝塞尔曲线;对于第三轨迹段,应用层将对第三轨迹段对应的两个采样点A3和A4传输至算法层,算法层计算出采样点A3和A4的中点B3,对采样点A3和A4、中点B3进行二阶贝塞尔曲线拟合以得到与第三轨迹段对应的贝塞尔曲线;对于第四轨迹段,应用层将对第四轨迹段对应的两个采样点A4和A5传输至算法层,算法层计算出采样点A4和A5的中点B4,对采样点A4和A5、中点B4进行二阶贝塞尔曲线拟合以得到与第四轨迹段对应的贝塞尔曲线。
例如,以第一轨迹段为例,如图2B所示,与第一轨迹段对应的贝塞尔曲线100上进行插值取点,以得到与第一轨迹段对应的轨迹点组,例如,在采样点A1和采样点B1之间采样3个轨迹点,在采样点B1和采样点A2之间也采样3个轨迹点。对所有轨迹段分别进行插值取点,从而得到与至少一个轨迹段一一对应的至少一个轨迹点组。
例如,可以采用等曲线间隔的方式采样轨迹点,例如,如图2A所示,对于采样点C1、采样点C2、在采样点C1和采样点C2之间的3个轨迹点,这五个轨迹点中任意相邻的两个轨迹点之间的曲线段的长度为采样点C1和采样点C2之间的曲线段的长度的四分之一,对于采样点C2、采样点C3、在采样点C2和采样点C3之间的3个轨迹点,这五个轨迹点中任意相邻的两个轨迹点之间的曲线段的长度为采样点C2和采样点C3之间的曲线段的长度的四分之一。值得注意的是,如图2A所示,在采样点C1和采样点C2之间的两个相邻轨 迹点之间的曲线段的长度和在采样点C2和采样点C3之间的两个相邻轨迹点之间的曲线段的长度不相等。
又例如,也可以采样等时间间隔的方式采样轨迹点,也就是说,每个轨迹段组中的九个轨迹点中任意相邻的两个轨迹点之间的时间差是固定的。需要说明的是,本公开对采样轨迹点的方式不作具体限制。
需要说明的是,与第一轨迹段对应的轨迹点组中的所有轨迹点均位于与第一轨迹段对应的贝塞尔曲线100上,与第一轨迹段对应的轨迹点组中的一个或多个轨迹点可能并不位于第一轨迹段上。
例如,将原始笔迹轨迹划分为至少一个轨迹段,然后分别对至少一个轨迹段进行采样轨迹点,从而可以在整体性和实时性之间实现平衡,同时,有助于后续步骤(例如,收笔处理)的操作。
需要说明的是,在一些实施例中,可以将采样得到的多个采样点直接作为轨迹点组中的轨迹点,而不需要对采样点进行插值处理。如图2A所示,对于第一轨迹段,可以直接对第一轨迹段进行采样以得到九个采样点,该九个采样点即可作为第一轨迹段对应的轨迹点组中的轨迹点。
例如,在一些实施例中,至少一个轨迹点组中的所有轨迹点可以均为运笔轨迹点;在另一些实施例中,至少一个轨迹点组中的所有轨迹点可以均为起笔轨迹点;在又一些实施例中,至少一个轨迹点组中的所有轨迹点可以均为收笔轨迹点。又例如,在一些实施例中,至少一个轨迹点组中的所有轨迹点可以包括起笔轨迹点、运笔轨迹点和收笔轨迹点中的至少两种。
图3A为本公开一实施例提供的一种轨迹单元的示意图;图3B为本公开一实施例提供的一种轨迹点的书写速度和轨迹点对应的轨迹单元的第一圆的直径之间的关系示意图。
例如,如图3A所示,每个轨迹单元至少包括多边形220、第一圆200和第二圆210,例如,在一些实施例中,多边形220为四边形,这里,第一圆200的半径大于第二圆210的半径,多边形220的四个顶点为第一圆200和第二圆210之间的四个外公切点q1-q4。需要说明的是,在本公开的实施例中,水滴状的水滴单元表示一个水滴状的闭合轨迹。
例如,在另一些实施例中,每个轨迹单元可以包括两条线段、第一圆和第二圆,两条线段即为第一圆和第二圆的两条外公切线的在外公切点q1-q4之间的线段,即图3A所示的,两条线段即为线段q1q3和线段q2q4。又例如,在另一些实施例中,也可以将每个轨迹单元中的第二圆替换为三角形。本公开对此不作具体限制。
例如,应用层可以将采样得到的所有轨迹点和所有轨迹点的相关信息传输至算法层。轨迹点的相关信息可以包括每个轨迹点的坐标、每个轨迹点的书写时间、每个轨迹点的书写速度和笔锋运动过程中的动作类型(下面简称轨迹点的动作类型)等。
例如,如图3A所示,以触控显示屏的显示画面的左上角为坐标原点确定一个像素坐标系OXY,X轴向右延伸,Y轴向下延伸。例如,在图中,X轴可以与水平方向平行,Y轴 可以与竖直方向平行。例如,轨迹点的坐标可以为轨迹点对应的多个像素点中任意一个像素点的坐标;或者,轨迹点的坐标可以为轨迹点对应的多个像素点的中间像素点的坐标。
例如,轨迹点的动作类型可以包括起笔、运笔(也称为行笔)和收笔。当某个轨迹点的动作类型为起笔,则表示该轨迹点位于原始笔迹轨迹的起笔阶段的部分,当某个轨迹点的动作类型为运笔,则表示该轨迹点位于原始笔迹轨迹的运笔阶段的部分,当某个轨迹点的动作类型为收笔,则表示该轨迹点位于原始笔迹轨迹的收笔阶段的部分。例如,如图2A所示,在一些实施例中,第一轨迹段对应的所有轨迹点的动作类型均为起笔,第二轨迹段和第三轨迹段对应的所有轨迹点的动作类型均为运笔,第四轨迹段对应的所有轨迹点的动作类型均为收笔。
例如,采样点的书写速度可以根据相邻采样点的坐标和时间确定,插值得到的点(例如,图2A所示的在贝塞尔曲线100上C1和C2之间的黑实心点)的速度和类型是根据用于插值的两个真实的采样点(即采样点C1和C2)确定的。
例如,对于图2A所示的采样点C2,采样点C3的书写速度可以根据采样点C2的坐标和时间以及采样点C3的坐标和时间确定,即根据采样点C2和采样点C3之间的时间差和位置差确定,例如,采样点C3的书写速度可以为采样点C2和采样点C3之间的位置差除以采样点C2和采样点C3之间的时间差得到。插值得到的点速度均是模拟出的,插值得到的点的书写速度可以基于采样点的书写速度确定,例如,对于采样点C2、采样点C3、采样点C2和采样点C3之间的3个插值得到的点,这五个轨迹点中任意相邻的两个轨迹点的书写速度之差为采样点C2的书写速度和采样点C3的书写速度的差值的四分之一,即这五个轨迹点的书写速度呈等差数列。又例如,在另一种实施中,对于采样点C2和采样点C3之间的3个插值得到的点,该3个插值得到的点的书写速度为采样点C2的书写速度和采样点C3的书写速度的平均值。
例如,原始笔迹轨迹对应的第一个采样点(例如,对于图2A所示的原始笔迹轨迹110,第一个采样点为采样点C1)的速度为0,对于与该第一采样点相邻的第二采样点(例如,对于图2A所示的原始笔迹轨迹110,第二个采样点为采样点C2),该第二采样点的书写速度则可以根据第一采样点(即采样点C1)和第二个采样点(即采样点C2)之间的时间差和位置差确定。此外,在又一些实施例中,在获取采样点时,也可以直接获取该采样点对应的书写速度,即应用层可以获取采样点的书写速度,并将该书写速度传输至算法层。
例如,插值得到的点(例如,图2A所示的在贝塞尔曲线100上C1和C2之间的黑实心点)的类型和用于插值的两个真实的采样点(即采样点C1和C2)的类型相同。
例如,笔迹的宽度与轨迹点的书写速度相关,当轨迹点的书写速度快,则笔迹的宽度小,当轨迹点的书写速度慢,则笔迹的宽度大。
例如,在步骤S12中,针对原始笔迹轨迹上每一个轨迹点,应用层在轨迹点对应的位置设置一个水滴的形状来模拟毛笔书写的效果,实现模拟毛笔笔锋。
例如,在一些实施例中,步骤S12包括:确定在所有轨迹点中的动作类型为运笔的轨迹 点,以得到T1个运笔轨迹点,其中,T1为小于等于所有轨迹点的数量的正整数,多个轨迹单元包括与所述T1个运笔轨迹点一一对应的T1个运笔轨迹单元;获取第一平均参考速度;对于T1个运笔轨迹点中的第p个运笔轨迹点,根据第一参考平均速度和第p个运笔轨迹点对应的书写速度和位置,确定T1个运笔轨迹单元中与第p个运笔轨迹点对应的第p个运笔轨迹单元中的第一圆的半径和圆心,其中,p为正整数,且p小于等于T1;根据第p个运笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定第p个运笔轨迹单元中的第二圆的半径和圆心;基于第p个运笔轨迹单元中的第一圆和第二圆,确定第p个运笔轨迹单元中的多边形,以确定第p个运笔轨迹单元,分别对T1个运笔轨迹点进行上述处理,从而确定与T1个运笔轨迹点一一对应的T1个运笔轨迹单元。
例如,当第p个运笔轨迹点实际上为采样得到的采样点,则第p个运笔轨迹点的书写速度可以通过第p个运笔轨迹点对应的时间和位置和与该第p个运笔轨迹点相邻的上一个采样点对应的时间和位置确定。当第p个运笔轨迹点实际上为通过对两个相邻的采样点进行插值得到轨迹点,则该第p个运笔轨迹点的书写速度可以通过该两个相邻的采样点的书写速度确定。
例如,如图2A所示,T1个运笔轨迹点为采样点C3至采样点C7、采样点C3和采样点C7之间的所有轨迹点;如图2B所示,T1个运笔轨迹点为采样点A2至采样点A4、采样点A2和采样点A4之间的所有轨迹点。
例如,对于多个轨迹单元中的每个轨迹单元,如图3A所示,第一圆200的圆心O1为第一圆200所在的轨迹单元对应的轨迹点。例如,在一些实施例中,对于第p个运笔轨迹单元,第p个运笔轨迹单元的第一圆的圆心为第p个运笔轨迹点的坐标;在另一些实施例中,可以按照预定规则,根据第p个运笔轨迹点的坐标确定第p个运笔轨迹单元的第一圆的圆心。例如,预定规则可以为:原始笔迹轨迹位于触控显示屏的第一区域,用于显示的笔迹位于触控显示屏的第二区域(第二区域位于第一区域的右侧),第一圆位于对应的轨迹点的右侧预设距离的位置等,第一区域的尺寸、第二区域的尺寸、预定规则和预设距离可以由用户根据实际情况设定。
例如,第p个运笔轨迹单元的第一圆200的半径由第p个运笔轨迹点对应的书写速度和第一平均参考速度决定,且满足以下关系式:
dt=kt*dt-1,kt=2/(1+e [0.06*(vt-vavg)/vavg])
其中,dt为在第p个运笔轨迹单元中的第一圆的直径,dt-1为与第p个运笔轨迹单元在时间上相邻的前一个轨迹单元(例如,前一个轨迹单元可能为运笔轨迹单元,也可能为后面将要描述的起笔轨迹单元)的第一圆的直径,kt为第p个运笔轨迹点对应的半径调整系数,vt为第p个运笔轨迹点对应的书写速度,vavg为第一平均参考速度,例如,vavg可以为500像素点/秒。例如,如图2A所示,在时间上,与采样点C3相邻的前一个轨迹点为轨迹点C30,采样点C3对应的轨迹单元在时间上相邻的前一个轨迹单元为轨迹点C30对应的轨迹 单元。
需要说明的是,在另一些实施例中,第p个运笔轨迹单元的第二圆的圆心为第p个运笔轨迹点,然后,根据第一圆的圆心和第二圆的圆心之间的圆心,基于第p个运笔轨迹单元的第二圆的圆心确定第p个运笔轨迹单元的第一圆的圆心。
例如,算法层预先设定书写过程的第一平均参考速度vavg,如果当前轨迹点的书写速度小于等于第一平均参考速度,调整当前轨迹点对应的轨迹单元中的第一圆的直径变大,使当前轨迹点对应的笔画变粗;如果当前轨迹点的书写速度大于第一平均参考速度,调整当前轨迹点对应的轨迹单元中的第一圆的直径变小,使当前轨迹点对应的笔画变细。
例如,第一圆200的直径的调整范围设置有限制,第一圆200的直径的最大值不得超过设定线宽的1.1倍,第一圆200的直径的最小值不得低于设定线宽的0.3倍,也就是说,0.3*ds≤dt≤1.1*ds,其中,ds为设定线宽,从而防止由于用户手抖或用户不适应带来的笔画过粗过细。例如,ds为常数,且可以由用户设定。
例如,第一圆200的直径实际上对应于轨迹点的书写速度,如图3B所示,第一圆200的直径的最大值对应于轨迹点的书写速度的截断低速,第一圆200的直径的最小值对应于轨迹点的书写速度的截断高速,在平均速度附近,第一圆200的直径的变化较平缓,从而抑制笔画宽度抖动。
例如,圆心位置关系表示:第一圆200的圆心O1和第二圆210的圆心O2之间的圆心连线O1O2沿逆时针方向旋转预设圆心角度θ到对应方向VD,第一圆200的圆心O1和第二圆210的圆心O2满足以下关系式:
do/R=C1,
其中,R为第一圆200的半径,do为第一圆200的圆心O1和第二圆210的圆心O2之间的圆心连线O1O2的距离,C1为常数。
例如,半径关系表示:第一圆200的半径大于第二圆210的半径,且第一圆200的半径和第二圆210的半径满足以下关系式:
r/R=C2,
其中,r为第二圆210的半径,C2为常数。
例如,在一些实施例中,C1的范围为1.2~2,例如,C1为1.8;C2的范围为0.2~0.4,例如,C2为0.3;预设圆心角度θ的范围为20°~40°,例如,预设圆心角度θ为30度。C1和C2的取值需要满足使得第一圆200和第二圆210不相交。
例如,对应方向VD可以为X轴的反方向,在基于触控显示屏的显示画面确定的像素坐标系OXY中,第一圆200的圆心的横坐标大于第二圆210的圆心的横坐标,第一圆200的圆心的纵坐标大于第二圆210的圆心的纵坐标,由此,如图3A所示,第二圆210位于第一圆200的左上方。
例如,在另一些实施例中,在步骤S12中,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元包括:确定在所有轨迹点中的动作类型为起笔的轨迹点,以得到T3 个起笔轨迹点,其中,T3为小于等于所有轨迹点的数量的正整数,多个轨迹单元包括与所述T3个起笔轨迹点一一对应的T3个起笔轨迹单元;设定T3个起笔轨迹单元的第一圆的直径为设定线宽;对于T3个起笔轨迹点中的第z个起笔轨迹点,根据第z个起笔轨迹点对应的位置,确定T3个起笔轨迹单元中与第z个起笔轨迹点对应的第z个起笔轨迹单元中的第一圆的圆心,其中,z为正整数,且z小于等于T3;根据第z个起笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定第z个起笔轨迹单元中的第二圆的半径和圆心;基于第z个起笔轨迹单元中的第一圆和第二圆,确定第z个起笔轨迹单元中的多边形,以确定第z个起笔轨迹单元,分别对T3个起笔轨迹点进行上述处理,从而确定T3个起笔轨迹点对应的所述T3个起笔轨迹单元。
例如,在一些实施例中,第z个起笔轨迹单元的第一圆的圆心为第z个起笔轨迹点的坐标。在另一些实施例中,可以按照预定规则,根据第z个起笔轨迹点的坐标确定第z个起笔轨迹单元的第一圆的圆心。圆心位置关系和半径位置关系可以参考上面的相关描述,重复之处不再赘述。
例如,在模拟毛笔笔锋的过程中,用户可以指定使用设定线宽进行书写,此时,在起笔阶段,可以设置与起笔轨迹点对应的轨迹单元中的第一圆的直径与设定线宽相同。
例如,在一些实施例中,所有轨迹点仅包括一个起笔轨迹点,即T3为1,如图2A所示,起笔轨迹点可以为采样点C1,此时,采样点C1对应的起笔轨迹单元的第一圆的直径为设定线宽;在另一些实施例中,所有轨迹点包括多个起笔轨迹点,即T3大于1,例如T3为9,此时,多个起笔轨迹点可以为采样点C1、采样点C2、采样点C3、采样点C1和采样点C3之间的所有轨迹点,多个起笔轨迹点对应的多个起笔轨迹单元的第一圆的直径均相同且均为设定线宽。
图4为本公开一实施例提供的一种用于显示的笔迹的示意图。
例如,在另一些实施例中,在步骤S12中,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元包括:确定在所有轨迹点中的动作类型为收笔的轨迹点,以得到T2个收笔轨迹点,其中,T2为小于等于所有轨迹点的数量的正整数,多个轨迹单元包括与T2个收笔轨迹点一一对应的T2个收笔轨迹单元;获取第二平均参考速度;对于T2个收笔轨迹点中的第i个收笔轨迹点,根据第二平均参考速度和第i个收笔轨迹点对应的书写速度和位置,确定T2个收笔轨迹单元中与所述第i个收笔轨迹点对应的第i个收笔轨迹单元中的第一圆的半径和圆心,其中,i为正整数,且i小于等于T2;根据第i个收笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定第i个收笔轨迹单元的第二圆的半径和圆心;基于第i个收笔轨迹单元中的第一圆和第二圆,确定第i个收笔轨迹单元中的多边形,以确定所述第i个收笔轨迹单元,分别对T2个收笔轨迹点进行上述处理,从而确定与T2个收笔轨迹点一一对应的T2个收笔轨迹单元。
例如,在收笔阶段,由于轨迹单元的第一圆的直径的截断处理,在不做附加处理时无法产生“尖”的效果。在收笔阶段,可以设置第二平均参考速度,如果收笔阶段的轨迹点的书写速度大于第二平均参考速度,则对该收笔阶段的轨迹点执行收笔尖处理,即减小收笔阶段的轨迹点对应的轨迹单元的第一圆的直径,使得收笔阶段的轨迹点的宽度可以小于设定线宽。如图4所示,当对收笔阶段对应的轨迹点执行收笔尖处理时,收笔部分(图4中圆圈圈出来的部分)的线宽较小,与毛笔笔锋类似;当不对收笔阶段对应的轨迹点执行收笔尖处理时,收笔部分的线宽较大。
例如,在一些实施例中,第i个收笔轨迹单元的第一圆的圆心为第i个收笔轨迹点的坐标,在另一些实施例中,可以按照预定规则,根据第i个收笔轨迹点的坐标确定第i个收笔轨迹单元的第一圆的圆心。
例如,第i个收笔轨迹单元的第一圆的半径由第i个收笔轨迹点对应的书写速度和第二平均参考速度决定,满足以下关系式:
dy=ki’*dy-1,ki’=6/(1+e [0.06*(vi-vavg’)/vavg’])
其中,dy为在第i个收笔轨迹单元中的第一圆的直径,dy-1为与第i个收笔轨迹单元在时间上相邻的前一个轨迹单元的第一圆的直径,ki’为第i个收笔轨迹单元对应的半径调整系数,vi为第i个收笔轨迹点对应的书写速度,vavg’为第二平均参考速度。
需要说明的是,圆心位置关系和半径位置关系可以参考上面的相关描述,重复之处不再赘述。
例如,第一平均参考速度为运笔阶段对应的参考速度,第二平均参考速度为收笔阶段对应的参考速度。第二平均参考速度vavg’小于第一平均参考速度vavg,在一些实施例中,第二平均参考速度可以为vavg’=100.0像素点/s。
例如,基于至少一个轨迹点组在原始笔迹轨迹上对应的位置,对至少一个轨迹点组进行排序,将排序后的至少一个轨迹点组中的最后一个轨迹点组中的N个轨迹点的动作类型为收笔,即将最后一个轨迹点组中的N个轨迹点作为收笔轨迹点,例如,如图2A所示,T2个收笔轨迹点可以为采样点C8、采样点C9、采样点C7和采样点C9之间的所有轨迹点;如图2B所示,T2个收笔轨迹点为采样点A5、采样点A4和采样点A5之间的所有轨迹点。需要说明的是,本公开的实施例包括但不限于此,T2个收笔轨迹点的数量可以根据实际情况确定。
例如,在上面的描述中,以触控和显示在同一个触控显示屏中实现为例进行说明,然而,本公开不限于此,在另一些实施例中,原始笔迹轨迹可以通过触控装置采集,用于显示的笔迹可以通过显示装置进行显示,也就是说,触控装置和显示装置分离设置,此时,可以将触控装置的触控区域(即可供用户书写的区域)的左上角作为原点、向右延伸的方向作为x轴(x的值越来越大),向下延伸的方向作为y轴(y的值越来越大),以构建第一坐标系,每个轨迹点的坐标为每个轨迹点在第一坐标系中的坐标。例如,类似地,可以将显示装置的显示区域的左上角作为原点、向右延伸的方向作为x轴(x的值越来越大),向下延伸的方 向作为y轴(y的值越来越大),以构建第二坐标系,此时,需要将每个轨迹点的坐标(每个轨迹点在第一坐标系中的坐标)映射到第二坐标系中,以确定在第二坐标系中每个轨迹点对应的轨迹单元的第一圆的圆心。也就是说,轨迹点位于第一坐标系,第一圆的圆心位于第二坐标系。
图5A为本公开一实施例提供的一种第一轨迹单元和第二轨迹单元的示意图;图5B为本公开一实施例提供的另一种第一轨迹单元和第二轨迹单元的示意图。
例如,在一些实施例中,对于相邻的第一轨迹单元和第二轨迹单元,可以基于第一轨迹单元的第一圆和第二圆和第二轨迹单元的第一圆和第二圆的公切点连接第一轨迹单元和第二轨迹单元,从而准确地连接多个轨迹单元,使得显示的笔迹更加平滑。
例如,步骤S13包括:基于至少一个轨迹点组中的所有轨迹点在原始笔迹轨迹上对应的位置,对多个轨迹单元进行排序;对于排序后的多个轨迹单元中的任意相邻的第一轨迹单元和第二轨迹单元,响应于第一轨迹单元的第一圆和第二圆和第二轨迹单元的第一圆和第二圆中的任意两个圆均不是内含关系,确定第一轨迹单元的第一圆和第二轨迹单元的第一圆之间的两个第一公切点和两个第二公切点,确定第一轨迹单元的第二圆和第二轨迹单元的第二圆之间的两个第三公切点和两个第四公切点;从两个第一公切点、两个第二公切点、两个第三公切点和两个第四公切点中选择得到四个目标公切点;依次连接四个目标公切点确定一个四边形,以使第一轨迹单元和第二轨迹单元连接,分别对多个轨迹单元进行上述处理,从而依次连接多个轨迹单元以得到笔迹。
例如,如图2A所示,沿采样点C1至采样点C9的方向,对所有轨迹点对应的多个轨迹单元进行排序。
例如,如图5A所示,对于多个轨迹单元中的任意相邻的第一轨迹单元300和第二轨迹单元310,如果第一轨迹单元300的第一圆和第二圆和第二轨迹单元310的第一圆和第二圆中的任意两个圆均不是内含关系,此时,计算第一轨迹单元300的第一圆和第二轨迹单元310的第一圆之间的两个第一公切点w11和w12和两个第二公切点w21和w22,计算第一轨迹单元300的第二圆和第二轨迹单元310的第二圆之间的两个第三公切点w31和w32和两个第四公切点w41和w42;例如,两个第一公切点w11和w12位于第一轨迹单元300的第一圆上,两个第二公切点w21和w22位于第二轨迹单元310的第一圆上,两个第三公切点w31和w32位于第一轨迹单元300的第二圆上,两个第四公切点w41和w42位于第二轨迹单元310的第二圆上。
图5B示出了第一轨迹单元300和第二轨迹单元310之间的各种位置关系。在图5A和图5B中,有阴影的圆表示第一轨迹单元300,没有阴影的圆表示第二轨迹单元310。如图5B所示,以第一轨迹单元300为中心确定九宫格,九宫格包括区域1-9,第一轨迹单元300位于九宫格的第二行第二列,即第一轨迹单元300位于区域5;第二轨迹单元310可以位于九宫格的任意位置,例如,当第二轨迹单元310位于区域5时,第一轨迹单元300和第二轨迹单元310中的两个圆可能具有相交或内含关系;当第二轨迹单元310位于区域1、2、 3、4、6、7、8、9时,第一轨迹单元300和第二轨迹单元310中的任意两个圆均不是内含关系。
需要说明的是,为了清楚示出各个公切点,图5A和图5B中没有画出轨迹单元的多边形,仅示出了轨迹单元的第一圆和第二圆。
下面简单介绍计算任意两个圆之间的精确外公切点的方式。
如图5A所示,以两个圆分别为第一轨迹单元300的第一圆和第二轨迹单元310的第一圆为例,假设两个圆的方程分别如下所示:
Figure PCTCN2021080463-appb-000006
Figure PCTCN2021080463-appb-000007
其中,r 1表示第一轨迹单元300的第一圆的半径,r 2表示第二轨迹单元310的第一圆的半径,a 1表示第一轨迹单元300的第一圆的圆心的横坐标,a 2表示第二轨迹单元310的第一圆的圆心的横坐标,b 1表示第一轨迹单元300的第一圆的圆心的纵坐标,b 2表示第二轨迹单元310的第一圆的圆心的纵坐标。
假设两个圆的两条公切线L的方程表示为:
L:y=kx+b
两条公切线L与第一轨迹单元300的第一圆相切的条件表示为:
Figure PCTCN2021080463-appb-000008
两条公切线L与第二轨迹单元310的第一圆相切的条件表示为:
Figure PCTCN2021080463-appb-000009
从而可以根据上述公式(1)和(2)可以计算得到两组(k,b)。将两组(k,b)代入下式(3)和(4)可得第一轨迹单元300的第一圆和第二轨迹单元310的第一圆之间的两个第一公切点w11和w12和两个第二公切点w21和w22。
Figure PCTCN2021080463-appb-000010
Figure PCTCN2021080463-appb-000011
两组(x 1,y 1)表示两个第一公切点w11和w12,两组(x 2,y 2)表示两个第二公切点w21和w22。
例如,从两个第一公切点、两个第二公切点、两个第三公切点和两个第四公切点中选择得到四个目标公切点,包括:
确定第一轨迹单元的第一圆和第二圆之间的第一外公切线和第二外公切线,其中,第一外公切线的斜率小于第二外公切线的斜率;
确定第一轨迹单元的第二圆和第二轨迹单元的第二圆之间的第三外公切线和第四外公切线;
响应于第三外公切线的斜率大于第四公切线的斜率,且第三外公切线的斜率大于第一外公切线的斜率且小于第一轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心连线的斜率,或者,响应于第三外公切线的斜率小于第四公切线的斜率,且第三外公切线的斜率小于第二外公切线的斜率且大于第一轨迹单元的第一圆的圆心和第二圆的圆心之间的连线的斜率,将两个第一公切点和两个第二公切点作为四个目标公切点;
响应于第三外公切线的斜率大于第四公切线的斜率且小于第一外公切线的斜率,或者,响应于第三外公切线的斜率小于第四公切线的斜率且大于第二外公切线的斜率,将两个第一公切点中远离第一轨迹单元的第二圆的第一公切点、两个第三公切点中远离第一轨迹单元的第一圆的第三公切点、两个第二公切点中远离第二轨迹单元的第二圆的第二公切点和两个第四公切点中远离第二轨迹单元的第一圆的第四公切点作为四个目标公切点。
图6A为本公开一实施例提供的又一种第一轨迹单元和第二轨迹单元的示意图;图6B为本公开一实施例提供的再一种第一轨迹单元和第二轨迹单元的示意图。
例如,如图6A和图6B所示,第一轨迹单元的第一圆和第二圆之间的第一外公切线的斜率为k1,第一轨迹单元的第一圆和第二圆之间的第二外公切线的斜率为k2,第一轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心连线的斜率表示为k0,当第一轨迹单元的第一圆和第二圆之间的预设圆心角度θ固定时,k1、k0和k2均为常数,且k1小于k0,k0小于k2。第一轨迹单元的第二圆和第二轨迹单元的第二圆之间的第三外公切线的斜率为k3,第一轨迹单元的第二圆和第二轨迹单元的第二圆之间的第四外公切线的斜率为k4,在图6A所示的示例中,k3大于k4,在图6B所示的示例中,k3小于k4。k3和k4由第一轨迹单元和第二轨迹单元之间的位置关系决定。
例如,响应于第三外公切线的斜率k3大于第四公切线的斜率k4,即在图6A所示的示例中,第三外公切线的斜率k3大于第一外公切线的斜率k1且小于第一轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心连线的斜率k0,或者,响应于第三外公切线的斜率k3小于第四公切线的斜率k4,即在图6B所示的示例中,第三外公切线的斜率k3小于第二外公切线的斜率k2且大于第一轨迹单元的第一圆的圆心和第二圆的圆心之间的连线的斜率k0,可以将两个第一公切点w11和w12和两个第二公切点w21和w22作为四个目标公切点。此时,如图5B所示,第二轨迹单元310可以位于九宫格的第一行第一列的区域1或第三行第三列的区域9。
例如,响应于第三外公切线的斜率k3大于第四公切线的斜率k4且小于第一外公切线的斜率k1,或者,响应于第三外公切线的斜率k3小于第四公切线的斜率k4且大于第二外公切线的斜率k2,此时,如图5B所示,第二轨迹单元310可以位于九宫格的第一行第二列的区域2或第一行第三列的区域3或第二行第一列的区域4或第二行第三列的区域6或第三行第一列的区域7或第三行第二列的区域8。在此情况下,可以将两个第一公切点w11和w12中远离第一轨迹单元的第二圆的第一公切点、两个第三公切点w31和w32中远离第一轨迹单元的第一圆的第三公切点、两个第二公切点w21和w22中远离第二轨迹单元的第二 圆的第二公切点和两个第四公切点w41和w42中远离第二轨迹单元的第一圆的第四公切点作为四个目标公切点。
图7为本公开一实施例提供的又一种第一轨迹单元和第二轨迹单元的示意图。
例如,如图7所示,对于第一轨迹单元310的第一圆的两个第一公切点w11和w12,第一公切点w11和第一轨迹单元310的第二圆的圆心的距离为d1,第一公切点w12和第一轨迹单元310的第二圆的圆心的距离为d2,由于d1大于d2,因此,可以选择第一公切点w11作为目标公切点。
例如,笔迹处理方法还包括:响应于第一轨迹单元的第一圆和第二圆以及第二轨迹单元的第一圆和第二圆中,四个圆的至少两个圆是内含关系,则确定第一轨迹单元和第二轨迹单元不需要连接。
例如,如图5B所示,第二轨迹单元310位于九宫格的区域5中,且第一轨迹单元300的第一圆和第二轨迹单元310的第一圆是内含关系,在此种情况下,可以确定第一轨迹单元和第二轨迹单元不需要连接。
例如,在另一些实施例中,在运笔阶段,为了提高算法速度,可以不通过公切点连接多个轨迹单元,而获取轨迹单元对应的近似连接点以连接多个轨迹单元。例如,步骤S13包括:对于至少一个轨迹点组中第k个轨迹点组,其中,第k个轨迹点组中的N个轨迹点在原始笔迹轨迹的延伸方向上依次排列,k为正整数,且小于等于至少一个轨迹点组的数量;确定在原始笔迹轨迹的延伸方向上第k个轨迹点组中的第一个轨迹点和第N个轨迹点;获取第一个轨迹点的第一个坐标和第N个轨迹点的第二个坐标;根据第一个坐标和第二个坐标,确定第k个轨迹点组对应的轨迹段的方向;根据第k个轨迹点组对应的轨迹段的方向,确定第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点;根据N个轨迹单元对应的N个第一连接点和N个第二连接点依次连接N个轨迹单元,对所有轨迹点对应的多个轨迹单元均按照上述方式确定连接点,然后根据连接点依次连接多个轨迹单元,以得到用于在触控显示屏上显示的笔迹。
例如,可以设定轨迹段的方向包括6个方向,6个方向分别为横方向、竖方向、撇方向、捺方向、提方向、其他方向。
例如,根据第一个坐标和第二个坐标,确定第k个轨迹点组对应的轨迹段的方向,包括:根据第一个坐标和第二个坐标,确定第一坐标差和第二坐标差,其中,第一个坐标为(x1,y1),第二个坐标为(x2,y2),第一坐标差Δx表示为Δx=x2-x1,第二坐标差Δy表示为Δy=y2-y1;响应于第一坐标差为0和第二坐标差为0,确定第k个轨迹点组对应的轨迹段的方向为其他方向,响应于第一坐标差不为0和第二坐标差为0,确定第k个轨迹点组对应的轨迹段的方向为横方向,响应于第一坐标差为0和第二坐标差不为0,确定第k个轨迹点组对应的轨迹段的方向为竖方向,响应于第一坐标差不为0和第二坐标差不为0:
当Δx>0且
Figure PCTCN2021080463-appb-000012
确定第k个轨迹点组对应的轨迹段的方向为横方向,
当Δy>0且
Figure PCTCN2021080463-appb-000013
确定第k个轨迹点组对应的所述轨迹段的方向为竖方向,
当Δx<0,Δy>0且
Figure PCTCN2021080463-appb-000014
确定第k个轨迹点组对应的轨迹段的方向为撇方向,
当Δx>0,Δy>0且
Figure PCTCN2021080463-appb-000015
确定第k个轨迹点组对应的轨迹段的方向为捺方向,
当Δx>0,Δy<0且
Figure PCTCN2021080463-appb-000016
确定第k个轨迹点组对应的轨迹段的方向为提方向,
当Δx<0且Δy<0,确定第k个轨迹点组对应的轨迹段的方向为其他提方向。
例如,根据第k个轨迹点组对应的轨迹段的方向,确定第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点,包括:
当第k个轨迹点组对应的轨迹段的方向为横方向时:xsj=x1j,ysj=y1j-rj,xbj=x2j,ybj=y2j+Rj;
当第k个轨迹点组对应的轨迹段的方向为竖方向时:xsj=x1j-rj,ysj=y1j,xbj=x2j+Rj,ybj=y2j;
当第k个轨迹点组对应的轨迹段的方向为撇方向或提方向时:xsj=x1j-0.707*rj,ysj=y1j-0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j+0.707*Rj;
当第k个轨迹点组对应的轨迹段的方向为捺方向或其他方向时:xsj=x1j-0.707*rj,ysj=y1j+0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j-0.707*Rj;
其中,(xbj,ybj)为第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的第j个轨迹单元对应的第一连接点的坐标,(xsj,ysj)为第j个轨迹单元对应的第二连接点的坐标,(x2j,y2j)为第j个轨迹单元的第一圆的圆心的坐标,Rj为第j个轨迹单元的第一圆的半径,(x1j,y1j)为第j个轨迹单元的第二圆的圆心的坐标,rj为第j个轨迹单元的第二圆的半径。
例如,在一些实施例中,第k个轨迹点组中的N个轨迹点对应的N个轨迹单元包括第三轨迹单元和第四轨迹单元,且第三轨迹单元和第四轨迹单元彼此相邻。根据N个轨迹单元对应的N个第一连接点和N个第二连接点依次连接N个轨迹单元,包括:对于第三轨迹单元和第四轨迹单元,连接第三轨迹单元对应的第一连接点和第二连接点和第四轨迹单元对应的第一连接点和第二连接点以确定一个四边形,从而连接第三轨迹单元和第四轨迹单元。例如,在一些实施例中,首先,连接第三轨迹单元对应的第一连接点和第二连接点,连接第四轨迹单元对应的第一连接点和第二连接点,然后,连接第三轨迹单元对应的第一连接点和第四轨迹单元对应的第一连接点,连接第三轨迹单元对应的第二连接点和第四轨迹单元对应的第二连接点,从而确定一个四边形,以使得第三轨迹单元和第四轨迹单元连接。
图8A为本公开一实施例提供的一种不带透明度的轨迹单元的示意图,图8B为本公开一实施例提供的一种带透明度的轨迹单元的示意图。
例如,为了去除应用层所显示的笔迹的边缘的毛刺,提高边缘平滑度,可以将原始的轨迹单元改进为带透明度的轨迹单元。例如,步骤S12包括:基于至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与至少一个轨迹点组中的所有轨迹点一一对应的多个中间轨迹单元,对多个中间轨迹单元进行处理,以得到多个轨迹单元。
例如,对多个中间轨迹单元进行处理,以得到多个轨迹单元,包括:根据多个中间轨迹单元,得到与多个中间轨迹单元一一对应的多个中间透明度轨迹单元,其中,每个透明度轨迹单元的形状和尺寸与每个透明度轨迹单元对应的中间轨迹单元的形状和尺寸均相同;对于多个中间透明度轨迹单元中的第h个中间透明度轨迹单元,在第h个中间透明度轨迹单元的边缘获取多个边缘透明度像素,从第h个中间透明度轨迹单元的中心向外延伸的方向上,将多个边缘透明度像素的透明度从100%逐渐变为0%,以得到第h个中间透明度轨迹单元对应的透明度轨迹单元,从而得到与多个中间透明度轨迹单元一一对应的多个透明度轨迹单元,其中,h为大于等于1且小于等于多个中间透明度轨迹单元的数量的正整数,多个边缘透明度像素中的至少部分边缘透明度像素位于对应的第h个中间透明度轨迹单元内,第h个中间透明度轨迹单元中除了多个边缘透明度像素之外的所有像素的透明度为100%;将多个中间轨迹单元和多个透明度轨迹单元分别进行叠加,以得到多个轨迹单元。
图8A示出了不带透明度的中间轨迹单元,图8B示出了带透明度的中间透明度轨迹单元,假设可以通过像素矩阵表示不带透明度的中间轨迹单元和带透明度的中间透明度轨迹单元,中间轨迹单元的形状和中间透明度轨迹单元的形状相同,中间轨迹单元的尺寸和中间透明度轨迹单元的尺寸也相同。如图8A所示,在中间轨迹单元对应的像素矩阵中,中间轨迹单元的内部的像素的灰阶值为1,中间轨迹单元的外部的像素的灰阶值为0。灰阶值为1表示像素点不透明,灰阶值为0表示像素透明。如图8B所示,在中间透明度轨迹单元对应的像素矩阵中,从中间透明度轨迹单元的中心向外延伸的方向上,将中间透明度轨迹单元的边缘的多个边缘透明度像素的透明度从100%(即灰度值为1)逐渐变为0%(即灰度值为0),以得到中间轨迹单元对应的透明度轨迹单元。
例如,对于某个轨迹点,可以将该轨迹点对应的中间轨迹单元和透明度轨迹单元进行叠加,以得到该轨迹点对应的轨迹单元。当某个像素的透明度超过100%,将该某个像素的透明度设置为100%。最后,像素的透明度与像素的RGB值相乘,从而确定像素的真实颜色,综合各个像素的真实颜色最终确定用于显示的笔迹的颜色。
需要说明的是,为了减少计算时间,也可以不设置透明轨迹单元。
图9为本公开一些实施例提供的一种模拟铅笔笔锋的过程示意图,图10为本公开一些实施例提供的一种模拟铅笔笔锋的效果图。
例如,用于在触控显示屏上显示的笔迹的笔锋类型为毛笔笔锋。本公开的实施例包括但不限于此,在另一些实施例中,用于在触控显示屏上显示的笔迹的笔锋类型也可以为铅笔笔 锋。例如,在铅笔笔锋的模拟过程中,可以设置应用层显示的线宽为恒定值。
如图9所示,在起笔阶段,应用层以设定的线宽为直径、以初始采样点(例如,图2A所示的采样点C1)为圆心确定初始采样点对应的圆,使起笔部分变得圆润。在运笔阶段,维持线宽不变,确定运笔阶段的各个轨迹点对应的圆,然后,计算各个轨迹点对应的圆的连接点,最后,基于各个轨迹点对应的圆的连接点依次连接各个轨迹点对应的圆。在收笔阶段,以设定的线宽为短轴、以最后的采样点(例如,图2A所示的采样点C9)为圆心确定最后的采样点对应的椭圆,椭圆的长轴大小与最后的采样点对应的书写速度成线性正相关,椭圆的长轴的方向与应用层采集到的最后两采样点(例如,图2A所示的采样点C8和采样点C9)对应的两个圆的圆心之间的连线方向一致。如图10所示,“春天”两个中文字的笔锋类型为铅笔笔锋。
本公开至少一个实施例还提供一种笔迹处理装置,图11为本公开至少一实施例提供的一种笔迹处理装置的示意性框图。
例如,如图11所示,笔迹处理装置1200包括存储器1220和处理器1230。应当注意,图11所示的笔迹处理装置1200的组件只是示例性的,而非限制性的,根据实际应用需要,该笔迹处理装置1200还可以具有其他组件。
例如,存储器1220用于非暂时性存储计算机可读指令;处理器1230用于运行计算机可读指令,计算机可读指令被处理器1230运行时执行根据上述任一实施例所述的笔迹处理方法中的一个或多个步骤。
例如,如图11所示,笔迹处理装置1200还包括触控显示屏1240。触控显示屏1240配置为基于用户的触控操作以获取原始笔迹轨迹。例如,触控显示屏1240可以包括电子笔、触摸屏、鼠标、触摸板等输入装置。
例如,触控显示屏1240还配置为显示该用于显示的笔迹。例如,触控显示屏1240还可以包括上面描述的投影仪等显示装置。
需要说明的是,存储器1220和处理器1230可以集成在触控显示屏1240中,又例如,存储器1220和处理器1230也可以集成在云端服务器中。
例如,笔迹处理装置1200还可以包括通信模块,通信模块用于实现笔迹处理装置1200与其他电子设备之间的通信,例如,当笔迹处理装置1200应用于机场的显示屏中时,通信模块可以将用于显示的笔迹从机场的显示屏传输至用户的手机或平板电脑内,从而用户的手机或平板电脑可以存储该用于显示的笔迹。
例如,处理器1230可以控制笔迹处理装置1200中的其它组件以执行期望的功能。处理器1230可以是中央处理单元(CPU)、张量处理器(TPU)等具有数据处理能力和/或程序执行能力的器件。中央处理元(CPU)可以为X86或ARM架构等。
例如,存储器1220可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失 性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机可读指令,处理器1230可以运行所述计算机可读指令,以实现笔迹处理装置1200的各种功能。
例如,存储器1220、存储器1230和触控显示屏1240等组件之间可以通过网络进行通信。网络可以包括无线网络、有线网络、和/或无线网络和有线网络的任意组合。网络可以包括局域网、互联网、电信网、基于互联网和/或电信网的物联网(Internet of Things)、和/或以上网络的任意组合等。有线网络例如可以采用双绞线、同轴电缆或光纤传输等方式进行通信,无线网络例如可以采用3G/4G/5G移动通信网络、蓝牙、Zigbee或者WiFi等通信方式。本公开对网络的类型和功能在此不作限制。
例如,关于笔迹处理装置1200执行笔迹美化的过程的详细说明可以参考文本识别方法的实施例中的相关描述,重复之处不再赘述。
本公开至少一实施例还提供一种存储介质。图12为本公开至少一个实施例提供的一种存储介质的示意图。例如,如图12所示,在存储介质1300上可以非暂时性地存储一个或多个计算机可读指令1301。例如,当所述计算机可读指令1301由计算机执行时可以执行根据上文所述的笔迹处理方法中的一个或多个步骤。
例如,该存储介质1300可以应用于上述笔迹处理装置1200中,例如,其可以为笔迹处理装置1200中的存储器1220。关于存储介质1300的说明可以参考笔迹处理装置1200的实施例中对于存储器的描述,重复之处不再赘述。
图13示出了为本公开至少一实施例提供的一种硬件环境的示意图。本公开提供的笔迹处理装置1200可以应用在互联网系统。
利用图13中提供的计算机系统可以实现本公开中涉及的笔迹处理装置1200。这类计算机系统可以包括个人电脑、笔记本电脑、平板电脑、手机、个人数码助理、智能眼镜、智能手表、智能指环、智能头盔及任何智能便携设备或可穿戴设备。本实施例中的特定系统利用功能框图解释了一个包含用户界面的硬件平台。这种计算机设备可以是一个通用目的的计算机设备,或一个有特定目的的计算机设备。两种计算机设备都可以被用于实现本实施例中的笔迹处理装置1200。计算机系统可以实施当前描述的实现笔迹美化所需要的信息的任何组件。例如,计算机系统能够被计算机设备通过其硬件设备、软件程序、固件以及它们的组合所实现。为了方便起见,图13中只绘制了一台计算机设备,但是本实施例所描述的实现笔迹美化所需要的信息的相关计算机功能是可以以分布的方式、由一组相似的平台所实施的,分散计算机系统的处理负荷。
如图13所示,计算机系统可以包括通信端口250,与之相连的是实现数据通信的网络,例如,计算机系统可以通过通信端口250发送和接收信息及数据,即通信端口250可以实现计算机系统与其他电子设备进行无线或有线通信以交换数据。计算机系统还可以包括一个处理器组220(即上面描述的处理器),用于执行程序指令。处理器组220可以由至少一 个处理器(例如,CPU)组成。计算机系统可以包括一个内部通信总线210。计算机系统可以包括不同形式的程序储存单元以及数据储存单元(即上面描述的存储器或存储介质),例如硬盘270、只读存储器(ROM)230、随机存取存储器(RAM)240,能够用于存储计算机处理和/或通信使用的各种数据文件,以及处理器组220所执行的可能的程序指令。计算机系统还可以包括一个输入/输出组件260,输入/输出组件260用于实现计算机系统与其他组件(例如,用户界面280等)之间的输入/输出数据流。
通常,以下装置可以连接输入/输出组件260:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置;包括例如磁带、硬盘等的存储装置;以及通信接口。
虽然图13示出了具有各种装置的计算机系统,但应理解的是,并不要求计算机系统具备所有示出的装置,可以替代地,计算机系统可以具备更多或更少的装置。
对于本公开,还有以下几点需要说明:
(1)本公开实施例附图只涉及到与本公开实施例涉及到的结构,其他结构可参考通常设计。
(2)为了清晰起见,在用于描述本发明的实施例的附图中,层或结构的厚度和尺寸被放大。可以理解,当诸如层、膜、区域或基板之类的元件被称作位于另一元件“上”或“下”时,该元件可以“直接”位于另一元件“上”或“下”,或者可以存在中间元件。
(3)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。
以上所述仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。

Claims (20)

  1. 一种笔迹处理方法,包括:
    对在触控显示屏上的原始笔迹轨迹进行采样以得到多个采样点;
    基于所述多个采样点,计算得到至少一个轨迹点组,其中,所述至少一个轨迹点组中的每个轨迹点组包括N个轨迹点,所述N个轨迹点包括M个采样点,N为大于等于3的整数,M为大于等于3的整数,M≤N;
    基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,其中,所述多个轨迹单元的每个轨迹单元为水滴状的水滴单元;
    依次连接所述多个轨迹单元,得到用于在所述触控显示屏上显示的笔迹。
  2. 根据权利要求1所述笔迹处理方法,其中,所述多个轨迹单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,
    基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:
    确定在所述所有轨迹点中的动作类型为运笔的轨迹点,以得到T1个运笔轨迹点,其中,T1为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T1个运笔轨迹点一一对应的T1个运笔轨迹单元;
    获取第一平均参考速度;
    对于所述T1个运笔轨迹点中的第p个运笔轨迹点,根据所述第一参考平均速度和所述第p个运笔轨迹点对应的书写速度和位置,确定所述T1个运笔轨迹单元中与所述第p个运笔轨迹点对应的第p个运笔轨迹单元中的第一圆的半径和圆心,其中,p为正整数,且p小于等于T1;
    根据所述第p个运笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第p个运笔轨迹单元中的第二圆的半径和圆心;
    基于所述第p个运笔轨迹单元中的第一圆和第二圆,确定所述第p个运笔轨迹单元中的多边形,以确定所述第p个运笔轨迹单元,从而确定与所述T1个运笔轨迹点一一对应的所述T1个运笔轨迹单元,
    其中,所述第p个运笔轨迹单元的第一圆的半径由所述第p个运笔轨迹点对应的书写速度和所述第一平均参考速度决定,且满足以下关系式:
    dt=kt*dt-1,kt=2/(1+e [0.06*(vt-vavg)/vavg])
    其中,dt为在所述第p个运笔轨迹单元中的所述第一圆的直径,dt-1为与所述第p个运笔轨迹单元在时间上相邻的前一个轨迹单元的第一圆的直径,kt为所述第p个 运笔轨迹点对应的半径调整系数,vt为所述第p个运笔轨迹点对应的书写速度,vavg为所述第一平均参考速度,0.3*ds≤dt≤1.1*ds,ds为设定线宽,
    所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
    do/R=C1,
    其中,R为所述第一圆的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
    所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和所述第二圆的半径满足以下关系式:
    r/R=C2,
    其中,r为所述第二圆的半径,C2为常数。
  3. 根据权利要求1所述笔迹处理方法,其中,所述多个轨迹单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,
    基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:
    确定在所述所有轨迹点中的动作类型为收笔的轨迹点,以得到T2个收笔轨迹点,其中,T2为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T2个收笔轨迹点一一对应的T2个收笔轨迹单元;
    获取第二平均参考速度,其中,所述第二平均参考速度小于第一平均参考速度,所述第一平均参考速度为运笔阶段对应的参考速度;
    对于所述T2个收笔轨迹点中的第i个收笔轨迹点,根据所述第二平均参考速度和所述第i个收笔轨迹点对应的书写速度和位置,确定所述T2个收笔轨迹单元中与所述第i个收笔轨迹点对应的第i个收笔轨迹单元中的第一圆的半径和圆心,其中,i为正整数,且i小于等于T2;
    根据所述第i个收笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第i个收笔轨迹单元的第二圆的半径和圆心;
    基于所述第i个收笔轨迹单元中的第一圆和第二圆,确定所述第i个收笔轨迹单元中的多边形,以确定所述第i个收笔轨迹单元,从而确定与所述T2个收笔轨迹点一一对应的所述T2个收笔轨迹单元,
    其中,所述第i个收笔轨迹单元的第一圆的半径由所述第i个收笔轨迹点对应的书写速度和所述第二平均参考速度决定,满足以下关系式:
    dy=ki’*dy-1,ki’=6/(1+e [0.06*(vi-vavg’)/vavg’])
    其中,dy为在所述第i个收笔轨迹单元中的第一圆的直径,dy-1为与所述第i个收笔轨迹单元在时间上相邻的前一个轨迹单元的第一圆的直径,ki’为所述第i个收笔轨迹单元对应的半径调整系数,vi为所述第i个收笔轨迹点对应的书写速度,vavg’为所述第二平均参考速度,
    所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
    do/R=C1,
    其中,R为所述第一圆的调节后的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
    所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和所述第二圆的半径满足以下关系式:
    r/R=C2,
    其中,r为所述第二圆的半径,C2为常数。
  4. 根据权利要求1所述笔迹处理方法,其中,所述多个轨迹单元中的每个轨迹单元至少包括多边形、第一圆和第二圆,所述多边形的四个顶点为所述第一圆和所述第二圆之间的四个外公切点,
    确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元包括:
    确定在所述所有轨迹点中的动作类型为起笔的轨迹点,以得到T3个起笔轨迹点,其中,T3为小于等于所述所有轨迹点的数量的正整数,所述多个轨迹单元包括与所述T3个起笔轨迹点一一对应的T3个起笔轨迹单元;
    设定所述T3个起笔轨迹单元的第一圆的直径为设定线宽;
    对于所述T3个起笔轨迹点中的第z个起笔轨迹点,根据所述第z个起笔轨迹点对应的位置,确定所述T3个起笔轨迹单元中与所述第z个起笔轨迹点对应的第z个起笔轨迹单元中的第一圆的圆心,其中,z为正整数,且z小于等于T3;
    根据所述第z个起笔轨迹单元中的第一圆的半径和圆心、每个轨迹单元的第一圆的半径和第二圆的半径之间的半径关系和每个轨迹单元的第一圆的圆心和第二圆的圆心之间的圆心位置关系,确定所述第z个起笔轨迹单元中的第二圆的半径和圆心;
    基于所述第z个起笔轨迹单元中的第一圆和第二圆,确定所述第z个起笔轨迹单元中的多边形,以确定所述第z个起笔轨迹单元,从而确定所述T3个起笔轨迹点对应的所述T3个起笔轨迹单元,
    其中,所述圆心位置关系表示:所述第一圆的圆心和所述第二圆的圆心之间的圆心连线沿逆时针方向旋转预设圆心角度到对应方向,所述第一圆的圆心和所述第二圆的圆心满足以下关系式:
    do/R=C1,
    其中,R为所述第一圆的半径,do为所述第一圆的圆心和所述第二圆的圆心之间的所述圆心连线的距离,C1为常数;
    所述半径关系表示:所述第一圆的半径大于所述第二圆的半径,且所述第一圆的半径和所述第二圆的半径满足以下关系式:
    r/R=C2,
    其中,r为所述第二圆的半径,C2为常数。
  5. 根据权利要求2-4任一项所述笔迹处理方法,其中,依次连接所述多个轨迹单元,以得到用于在所述触控显示屏上显示的所述笔迹,包括:
    基于所述至少一个轨迹点组中的所有轨迹点在所述原始笔迹轨迹上对应的位置,对所述多个轨迹单元进行排序;
    对于排序后的所述多个轨迹单元中的任意相邻的第一轨迹单元和第二轨迹单元,
    响应于所述第一轨迹单元的第一圆和第二圆和所述第二轨迹单元的第一圆和第二圆中的任意两个圆均不是内含关系,确定所述第一轨迹单元的第一圆和所述第二轨迹单元的第一圆之间的两个第一公切点和两个第二公切点,确定所述第一轨迹单元的第二圆和所述第二轨迹单元的第二圆之间的两个第三公切点和两个第四公切点,其中,所述两个第一公切点位于所述第一轨迹单元的第一圆上,所述两个第二公切点位于所述第二轨迹单元的第一圆上,所述两个第三公切点位于所述第一轨迹单元的第二圆上,所述两个第四公切点位于所述第二轨迹单元的第二圆上;
    从所述两个第一公切点、所述两个第二公切点、所述两个第三公切点和所述两个第四公切点中选择得到四个目标公切点;
    依次连接所述四个目标公切点确定一个四边形,以使所述第一轨迹单元和所述第二轨迹单元连接,从而依次连接所述多个轨迹单元以得到所述笔迹。
  6. 根据权利要求5所述笔迹处理方法,还包括:
    响应于所述第一轨迹单元的第一圆和第二圆和所述第二轨迹单元的第一圆和第二圆中的至少两个圆是内含关系,则确定所述第一轨迹单元和所述第二轨迹单元不需要连接。
  7. 根据权利要求5所述笔迹处理方法,其中,从所述两个第一公切点、所述两个第二公切点、所述两个第三公切点和所述两个第四公切点中选择得到四个目标公切点,包括:
    确定所述第一轨迹单元的第一圆和第二圆之间的第一外公切线和第二外公切线,其中,所述第一外公切线的斜率小于所述第二外公切线的斜率;
    确定所述第一轨迹单元的第二圆和所述第二轨迹单元的第二圆之间的第三外公切线和第四外公切线;
    响应于所述第三外公切线的斜率大于所述第四公切线的斜率,且所述第三外公切线的斜率大于所述第一外公切线的斜率且小于所述第一轨迹单元的第一圆的圆心和第二圆的圆心之间的所述圆心连线的斜率,或者,响应于所述第三外公切线的斜率小于所述第四公切线的斜率,且所述第三外公切线的斜率小于所述第二外公切线的斜率且大于所述第一轨迹单 元的第一圆的圆心和第二圆的圆心之间的所述连线的斜率,将所述两个第一公切点和所述两个第二公切点作为所述四个目标公切点;
    响应于所述第三外公切线的斜率大于所述第四公切线的斜率且小于所述第一外公切线的斜率,或者,响应于所述第三外公切线的斜率小于所述第四公切线的斜率且大于所述第二外公切线的斜率,将所述两个第一公切点中远离所述第一轨迹单元的第二圆的第一公切点、所述两个第三公切点中远离所述第一轨迹单元的第一圆的第三公切点、所述两个第二公切点中远离所述第二轨迹单元的第二圆的第二公切点和所述两个第四公切点中远离所述第二轨迹单元的第一圆的第四公切点作为所述四个目标公切点。
  8. 根据权利要求2-4任一项所述笔迹处理方法,其中,依次连接所述多个轨迹单元,以得到用于在所述触控显示屏上显示的所述笔迹,包括:
    对于所述至少一个轨迹点组中第k个轨迹点组,其中,所述第k个轨迹点组中的N个轨迹点在所述原始笔迹轨迹的延伸方向上依次排列,k为正整数,且小于等于所述至少一个轨迹点组的数量;
    确定在所述原始笔迹轨迹的延伸方向上所述第k个轨迹点组中的第一个轨迹点和第N个轨迹点;
    获取所述第一个轨迹点的第一个坐标和所述第N个轨迹点的第二个坐标;
    根据所述第一个坐标和所述第二个坐标,确定所述第k个轨迹点组对应的轨迹段的方向,
    根据所述第k个轨迹点组对应的所述轨迹段的方向,确定所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点;
    根据所述N个轨迹单元对应的N个第一连接点和N个第二连接点依次连接所述N个轨迹单元,从而依次连接所述多个轨迹单元,以得到所述笔迹。
  9. 根据权利要求8所述笔迹处理方法,其中,根据所述第一个坐标和所述第二个坐标,确定所述第k个轨迹点组对应的轨迹段的方向,包括:
    根据所述第一个坐标和所述第二个坐标,确定第一坐标差和第二坐标差,其中,所述第一个坐标为(x1,y1),所述第二个坐标为(x2,y2),所述第一坐标差Δx表示为Δx=x2-x1,所述第二坐标差Δy表示为Δy=y2-y1;
    响应于所述第一坐标差为0和所述第二坐标差为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为其他方向,
    响应于所述第一坐标差不为0和所述第二坐标差为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为横方向,
    响应于所述第一坐标差为0和所述第二坐标差不为0,确定所述第k个轨迹点组对应的所述轨迹段的方向为竖方向,
    响应于所述第一坐标差不为0和所述第二坐标差不为0:
    当Δx>0且
    Figure PCTCN2021080463-appb-100001
    确定所述第k个轨迹点组对应的所述轨迹段的方向为横方向,
    当Δy>0且
    Figure PCTCN2021080463-appb-100002
    确定所述第k个轨迹点组对应的所述轨迹段的方向为竖方向,
    当Δx<0,Δy>0且
    Figure PCTCN2021080463-appb-100003
    确定所述第k个轨迹点组对应的所述轨迹段的方向为撇方向,
    当Δx>0,Δy>0且
    Figure PCTCN2021080463-appb-100004
    确定所述第k个轨迹点组对应的所述轨迹段的方向为捺方向,
    当Δx>0,Δy<0且
    Figure PCTCN2021080463-appb-100005
    确定所述第k个轨迹点组对应的所述轨迹段的方向为提方向,
    当Δx<0且Δy<0,确定所述第k个轨迹点组对应的所述轨迹段的方向为所述其他提方向。
  10. 根据权利要求9所述笔迹处理方法,其中,根据所述第k个轨迹点组对应的所述轨迹段的方向,确定所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的每个轨迹单元的第一圆上的第一连接点和第二圆上的第二连接点,包括:
    当所述第k个轨迹点组对应的所述轨迹段的方向为横方向时:xsj=x1j,ysj=y1j-rj,xbj=x2j,ybj=y2j+Rj;
    当所述第k个轨迹点组对应的所述轨迹段的方向为竖方向时:xsj=x1j-rj,ysj=y1j,xbj=x2j+Rj,ybj=y2j;
    当所述第k个轨迹点组对应的所述轨迹段的方向为撇方向或提方向时:xsj=x1j-0.707*rj,ysj=y1j-0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j+0.707*Rj;
    当所述第k个轨迹点组对应的所述轨迹段的方向为捺方向或其他方向时:xsj=x1j-0.707*rj,ysj=y1j+0.707*rj,xbj=x2j+0.707*Rj,ybj=y2j-0.707*Rj;
    其中,(xbj,ybj)为所述第k个轨迹点组中的N个轨迹点对应的N个轨迹单元中的第j个轨迹单元对应的第一连接点的坐标,(xsj,ysj)为所述第j个轨迹单元对应的第二连接点的坐标,(x2j,y2j)为所述第j个轨迹单元的第一圆的圆心的坐标,Rj为所述第j个轨迹单元的第一圆的半径,(x1j,y1j)为所述第j个轨迹单元的第二圆的圆心的坐标,rj为所述第j个轨迹单元的第二圆的半径。
  11. 根据权利要求2-10任一项所述笔迹处理方法,其中,所述C1的范围为1.2~2,所述C2的范围为0.2~0.4,所述预设圆心角度的范围为20°~40°,
    在基于所述触控显示屏的显示画面确定的像素坐标系中,所述第一圆的圆心的横坐标大于所述第二圆的圆心的横坐标,所述第一圆的圆心的纵坐标大于所述第二圆的圆心的纵坐标。
  12. 根据权利要求1-11任一项所述笔迹处理方法,其中,基于在所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个轨迹单元,包括:
    基于所述至少一个轨迹点组中的至少部分轨迹点的书写速度,确定与所述至少一个轨迹点组中的所有轨迹点一一对应的多个中间轨迹单元,
    对所述多个中间轨迹单元进行透明度处理,以得到所述多个轨迹单元。
  13. 根据权利要求12所述笔迹处理方法,其中,对所述多个中间轨迹单元进行透明度处理,以得到所述多个轨迹单元,包括:
    根据所述多个中间轨迹单元,得到与所述多个中间轨迹单元一一对应的多个中间透明度轨迹单元,其中,每个所述透明度轨迹单元的形状和尺寸与每个所述透明度轨迹单元对应的中间轨迹单元的形状和尺寸均相同;
    对于所述多个中间透明度轨迹单元中的第h个中间透明度轨迹单元,在所述第h个中间透明度轨迹单元的边缘获取多个边缘透明度像素,从所述第h个中间透明度轨迹单元的中心向外延伸的方向上,将所述多个边缘透明度像素的透明度从100%逐渐变为0%,以得到所述第h个中间透明度轨迹单元对应的透明度轨迹单元,从而得到与所述多个中间透明度轨迹单元一一对应的多个透明度轨迹单元,其中,h为大于等于1且小于等于所述多个中间透明度轨迹单元的数量的正整数,所述多个边缘透明度像素中的至少部分边缘透明度像素位于对应的所述第h个中间透明度轨迹单元内,所述第h个中间透明度轨迹单元中除了所述多个边缘透明度像素之外的所有像素的透明度为100%;
    将所述多个中间轨迹单元和所述多个透明度轨迹单元分别进行叠加,以得到所述多个轨迹单元。
  14. 根据权利要求1-13任一项所述笔迹处理方法,其中,基于所述多个采样点,计算得到至少一个轨迹点组,包括:
    基于所述多个采样点,将所述原始笔迹轨迹划分为至少一个轨迹段,其中,所述至少一个轨迹段中的每个轨迹段包括M个采样点;
    对所述至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,从而得到所述至少一个轨迹点组。
  15. 根据权利要求14所述笔迹处理方法,其中,对所述至少一个轨迹段中的每个轨迹段进行插值处理以得到与每个轨迹段对应的轨迹点组,包括:
    对于每个轨迹段,根据该轨迹段对应的M个采样点,拟合得到所述轨迹段对应的贝塞尔曲线,在所述贝塞尔曲线上进行取点,以得到与所述轨迹段对应的轨迹点组。
  16. 根据权利要求1-15任一项所述笔迹处理方法,其中,所述笔迹的笔锋类型为毛笔笔锋。
  17. 一种笔迹处理装置,包括:
    存储器,用于非暂时性存储计算机可读指令;以及
    处理器,用于运行所述计算机可读指令,其中,所述计算机可读指令被所述处理器运行时执行根据权利要求1-16任一项所述的笔迹处理方法。
  18. 根据权利要求17所述的笔迹处理装置,还包括:触控显示屏,
    其中,所述触控显示屏配置为基于用户的触控操作以获取所述原始笔迹轨迹。
  19. 根据权利要求18所述的笔迹处理装置,其中,所述触控显示屏还配置为显示所述笔迹。
  20. 一种非瞬时性存储介质,非暂时性地存储计算机可读指令,其中,当所述计算机可读指令由计算机执行时可以执行根据权利要求1-16任一项所述的笔迹处理方法。
PCT/CN2021/080463 2020-04-30 2021-03-12 笔迹处理方法、笔迹处理装置、存储介质 WO2021218445A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010365298.1 2020-04-30
CN202010365298.1A CN113590000B (zh) 2020-04-30 2020-04-30 笔迹处理方法、笔迹处理装置、存储介质

Publications (1)

Publication Number Publication Date
WO2021218445A1 true WO2021218445A1 (zh) 2021-11-04

Family

ID=78237463

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080463 WO2021218445A1 (zh) 2020-04-30 2021-03-12 笔迹处理方法、笔迹处理装置、存储介质

Country Status (2)

Country Link
CN (1) CN113590000B (zh)
WO (1) WO2021218445A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114510158A (zh) * 2021-12-08 2022-05-17 深圳市康冠商用科技有限公司 电子笔画纠错方法、装置、触摸屏设备及存储介质
CN115098014A (zh) * 2021-12-29 2022-09-23 山东蓝贝思特教装集团股份有限公司 书写笔迹显示方法、控制器及tft液晶书写装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114115673B (zh) * 2021-11-25 2023-10-27 海信集团控股股份有限公司 车载屏幕的控制方法

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521858A (zh) * 2011-11-28 2012-06-27 北京盛世宣合信息科技有限公司 电子毛笔书写笔迹生成方法
CN102937848A (zh) * 2012-12-04 2013-02-20 上海合合信息科技发展有限公司 对手写笔迹进行编辑处理的方法及电子设备
CN107292936A (zh) * 2017-05-18 2017-10-24 湖南大学 一种汉字字体矢量化方法
CN110321054A (zh) * 2019-06-20 2019-10-11 广州视源电子科技股份有限公司 毛笔笔迹绘制方法、装置、设备及可读存储介质
CN110531875A (zh) * 2019-08-21 2019-12-03 深圳市威屏科技有限公司 书写笔锋的生成方法、终端设备及存储介质
US20200042109A1 (en) * 2017-06-22 2020-02-06 Tencent Technology (Shenzhen) Company Limited Method and apparatus for dynamically displaying interface content and device thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521858A (zh) * 2011-11-28 2012-06-27 北京盛世宣合信息科技有限公司 电子毛笔书写笔迹生成方法
CN102937848A (zh) * 2012-12-04 2013-02-20 上海合合信息科技发展有限公司 对手写笔迹进行编辑处理的方法及电子设备
CN107292936A (zh) * 2017-05-18 2017-10-24 湖南大学 一种汉字字体矢量化方法
US20200042109A1 (en) * 2017-06-22 2020-02-06 Tencent Technology (Shenzhen) Company Limited Method and apparatus for dynamically displaying interface content and device thereof
CN110321054A (zh) * 2019-06-20 2019-10-11 广州视源电子科技股份有限公司 毛笔笔迹绘制方法、装置、设备及可读存储介质
CN110531875A (zh) * 2019-08-21 2019-12-03 深圳市威屏科技有限公司 书写笔锋的生成方法、终端设备及存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114510158A (zh) * 2021-12-08 2022-05-17 深圳市康冠商用科技有限公司 电子笔画纠错方法、装置、触摸屏设备及存储介质
CN114510158B (zh) * 2021-12-08 2022-12-30 深圳市康冠商用科技有限公司 电子笔画纠错方法、装置、触摸屏设备及存储介质
CN115098014A (zh) * 2021-12-29 2022-09-23 山东蓝贝思特教装集团股份有限公司 书写笔迹显示方法、控制器及tft液晶书写装置
CN115098014B (zh) * 2021-12-29 2024-05-14 山东蓝贝思特教装集团股份有限公司 书写笔迹显示方法、控制器及tft液晶书写装置

Also Published As

Publication number Publication date
CN113590000B (zh) 2023-01-17
CN113590000A (zh) 2021-11-02

Similar Documents

Publication Publication Date Title
WO2021218445A1 (zh) 笔迹处理方法、笔迹处理装置、存储介质
US11687233B2 (en) Handwriting processing method, touch display device, computer device and storage medium
CN103310474B (zh) 一种手写原笔迹的实现方法及系统
CN109284059B (zh) 笔迹绘制方法、装置、交互智能平板和存储介质
US11460988B2 (en) Method of styling content and touch screen device for styling content
KR20210038446A (ko) 제스처를 기반으로 전자기기를 제어하는 방법 및 장치
WO2013010027A1 (en) Drawing aid system for multi-touch devices
US20130215045A1 (en) Stroke display method of handwriting input and electronic device
CN112463012B (zh) 纸屏同步中手写笔迹一致性显示的方法
US10664072B2 (en) Multi-stroke smart ink gesture language
US11475617B2 (en) Path-constrained drawing with visual properties based on drawing tool
WO2023093458A1 (zh) 确定墨水屏的刷新模式的方法、电子设备和存储介质
CN104517302A (zh) 显示设备和用于提供该显示设备的字体效果的方法
WO2021218446A1 (zh) 笔迹处理方法、笔迹处理装置、非瞬时性存储介质
WO2021218448A1 (zh) 笔迹形成方法、笔迹形成装置及电子设备
US20240020893A1 (en) Handwriting Forming Method and Apparatus, and Electronic Device
CN113238710B (zh) 一种智能交互平板、其显示方法及可读存储介质
WO2023206257A1 (zh) 手写笔迹生成方法、装置、计算机设备和可读介质
US11900568B2 (en) Writing trajectory processing method, touch control device, writing system and storage medium
WO2023070334A1 (zh) 手写输入显示方法及装置、计算机可读存储介质
CN107730571A (zh) 用于绘制图像的方法和装置
CN116027954A (zh) 一种笔迹的生成方法及相关装置
CN115509431A (zh) 笔迹绘制方法、装置、设备及存储介质
CN114201075A (zh) 一种触屏设备及其相同的触摸输入功能冲突的解决方法
CN116136721A (zh) 无延迟线条绘制显示方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21797276

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21797276

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07.07.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21797276

Country of ref document: EP

Kind code of ref document: A1