CN116168402A - Handwriting corner determination method and device, storage medium and terminal - Google Patents

Handwriting corner determination method and device, storage medium and terminal Download PDF

Info

Publication number
CN116168402A
CN116168402A CN202111409952.5A CN202111409952A CN116168402A CN 116168402 A CN116168402 A CN 116168402A CN 202111409952 A CN202111409952 A CN 202111409952A CN 116168402 A CN116168402 A CN 116168402A
Authority
CN
China
Prior art keywords
corner
target
point
points
handwriting
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202111409952.5A
Other languages
Chinese (zh)
Inventor
佘爽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shiyuan Artificial Intelligence Innovation Research Institute Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Guangzhou Shiyuan Artificial Intelligence Innovation Research Institute Co Ltd
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 Guangzhou Shiyuan Electronics Thecnology Co Ltd, Guangzhou Shiyuan Artificial Intelligence Innovation Research Institute Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN202111409952.5A priority Critical patent/CN116168402A/en
Publication of CN116168402A publication Critical patent/CN116168402A/en
Pending legal-status Critical Current

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/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • G06F3/04883Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures for inputting data by handwriting, e.g. gesture or text

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Character Discrimination (AREA)

Abstract

The application discloses a method and a device for determining angular points of handwriting, a storage medium and a terminal, and relates to the technical field of computer image recognition. Firstly, calculating the writing speed of each track point in handwriting and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of the track points and other track points in a preset range to form a vector; then selecting the track points meeting the conditions as first corner points; and finally removing the pseudo corner points in the first corner points. As the average value of all curvatures of the track points in the preset range is used as the final curvature of the track points, namely the average value of the accumulated curvature of the sliding window is calculated to be used as the curvature of the track points at the center of the window, misguidance of curvature mutation on angle point selection is reduced, curvature mutation can be effectively smoothed, more accurate corner points are selected, line segment fitting is carried out on handwriting, false corner points are removed from the first corner points, so that the false corner points in the corner points can be effectively removed, and the correct corner points in the handwriting are finally determined.

Description

Handwriting corner determination method and device, storage medium and terminal
Technical Field
The present disclosure relates to the field of computer image recognition technologies, and in particular, to a method and an apparatus for determining a corner point of handwriting, a storage medium, and a terminal.
Background
With the rapid development of internet technology and mobile terminal devices, handwriting input and drawing on a display screen has become popular, and when image information of the handwriting is analyzed by a computer, image corner points are usually detected to extract image features, the corner points are usually defined as intersection points of two sides, more strictly speaking, local neighborhoods of the corner points should have boundaries of two different areas in different directions, but in practical application, the corner point detection method generally detects image points with specific features.
In the prior art, when a user writes, handwriting suddenly shakes, and the track points at the positions are incorrectly identified as corner points possibly caused by the difference between the shaked track points and normal track points, so that the identified corner points are inaccurate, and the number of false corner points is more.
Disclosure of Invention
The application provides a method, a device, a storage medium and a terminal for determining the corner points of handwriting, which can solve the technical problems of inaccurate corner points and more false corner points when the corner points of the handwriting are determined.
In a first aspect, an embodiment of the present application provides a method for determining a corner point of handwriting, where the method includes:
acquiring all track points in the target handwriting, and calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point;
Selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting;
removing the pseudo corner points in the first corner points of the target handwriting to obtain the second corner points of the target handwriting
Optionally, after calculating the writing speed of each track point and the final curvature of each track point, the method further includes: calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point; wherein the preset condition is a condition set according to the average speed and the average curvature.
Optionally, after the corresponding track point with the writing speed and the final curvature meeting the preset conditions is the first angle point of the target handwriting, the method further includes: according to the writing sequence of each first corner point in the target handwriting, the distance between each first corner point and the next corresponding first corner point is calculated in sequence, and the first corner point with the distance smaller than the preset length is removed.
Optionally, the removing the pseudo corner point in the first corner point of the target handwriting to obtain the second corner point of the target handwriting includes: performing line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, wherein the stroke segment is a track segment corresponding to each two adjacent first corner points in the target handwriting; determining a pseudo corner point in the first corner point according to the fitting result and preset fitting conditions; and removing the pseudo corner points in the first corner points, and determining the rest corner points in the first corner points as second corner points of the target handwriting.
Optionally, the performing line segment fitting on the stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment includes: calculating the length of each stroke segment, and calculating the average length of all the stroke segments in the target handwriting according to the length of each stroke segment; selecting a stroke segment with the length shorter than the average length as a target stroke segment, and performing line segment fitting on the target stroke segment to obtain self fitting errors corresponding to all the target stroke segments; according to the writing sequence of each target stroke segment in the target handwriting, performing line segment fitting on the left adjacent stroke segment of each target stroke segment to obtain a left fitting error of the left adjacent stroke segment, and performing line segment fitting on the right adjacent stroke segment of each target stroke segment to obtain a right fitting error of the right adjacent stroke segment; merging each target stroke segment and the corresponding left adjacent stroke segment to obtain left merged stroke segments, and performing line segment fitting on each left merged stroke segment to obtain left merged fitting errors of each left merged stroke segment; and merging each target stroke segment and the corresponding right adjacent stroke segment to obtain right merged stroke segments, and performing line segment fitting on each right merged stroke segment to obtain right merged fitting errors of each right merged stroke segment.
Optionally, the determining the pseudo corner in the first corner according to the fitting result and a preset fitting condition includes: if the left merging fitting error in the target stroke section is smaller than the right merging fitting error and the left merging fitting error in the target stroke section is smaller than the sum of the left fitting error of the first preset multiple and the self fitting error of the second preset multiple, determining that a first corner point at the left end in the target stroke section is a pseudo corner point; if the right merging fitting error in the target stroke section is smaller than the left merging fitting error and the right merging fitting error in the target stroke section is smaller than the sum of the right fitting error of the third preset multiple and the self fitting error of the fourth preset multiple, determining that the first corner point of the right end in the target stroke section is a pseudo corner point.
Optionally, after the removing the dummy corner point in the first corner point, the method further includes: and re-performing line segment fitting on the stroke segments in the target handwriting, and removing the pseudo corner points in the first corner points again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
Optionally, the preset range is a circular range with the corresponding track point as a center point and a radius being a preset radius, and the circular range includes the corresponding track point and at least three other track points in the target handwriting.
Optionally, the writing speeds and final curvatures of the start track point and the end track point in the target handwriting are zero, and the start track point and the end track point are first corner points.
In a second aspect, an embodiment of the present application provides a device for determining a corner point of handwriting, where the device includes:
the speed curvature calculation module is used for acquiring all track points in the target handwriting, calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of the accumulated curvature of vectors formed by the track points and other track points in the preset range of the track points;
the angular point determining module is used for selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first angular point of the target handwriting;
and the pseudo corner removing module is used for removing the pseudo corner in the first corner of the target handwriting to obtain a second corner of the target handwriting.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the steps of the method described above.
In a fourth aspect, embodiments of the present application provide a terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being adapted to be loaded by the processor and to perform the steps of the method described above.
The technical scheme provided by some embodiments of the present application has the beneficial effects that at least includes:
the application provides a method and device for determining angular points of handwriting, a storage medium and a terminal. Firstly, all track points in a target handwriting are obtained, the writing speed of each track point and the final curvature of each track point are calculated, and the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point; then selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting; and finally, removing the pseudo corner point in the first corner point of the target handwriting to obtain a second corner point of the target handwriting. When the curvature of the track point is calculated, the average value of all curvatures of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvature of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter is reduced, curvature mutation caused by smooth jitter can be effectively performed, more accurate corner points are selected, line segment fitting, loop iteration and other calculation operations are performed on the handwriting according to the first corner point, and the false corner points are removed from the first corner points, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is an exemplary system architecture diagram of a method for determining a corner point of handwriting according to an embodiment of the present application;
FIG. 2 is a system interaction diagram of a method for determining a corner point of handwriting provided in an embodiment of the present application;
fig. 3 is a flow chart of a method for determining a corner point of handwriting according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a target handwriting according to an embodiment of the present application;
fig. 5 is a flowchart of a method for determining a corner point of handwriting according to another embodiment of the present application;
FIG. 6 is a flowchart of a method for determining a corner point of handwriting according to another embodiment of the present application;
FIG. 7 is a block diagram of a device for determining a corner point of handwriting according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
In order to make the features and advantages of the present application more comprehensible, the following description will be given in detail with reference to the accompanying drawings in which embodiments of the present application are shown, and it is apparent that the described embodiments are merely some but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
Referring to fig. 1, fig. 1 is an exemplary system architecture diagram of a method for determining a corner point of handwriting according to an embodiment of the present application.
As shown in fig. 1, the system architecture may include a terminal 101, a network 102, and a server 103. Network 102 is the medium used to provide communication links between terminals 101 and servers 103. Network 102 may include various types of wired or wireless communication links, such as: the wired communication link includes an optical fiber, a twisted pair wire, or a coaxial cable, and the Wireless communication link includes a bluetooth communication link, a Wireless-Fidelity (Wi-Fi) communication link, a microwave communication link, or the like.
Terminal 101 may interact with server 103 via network 102 to receive messages from server 103 or to send messages to server 103, or terminal 101 may interact with server 103 via network 102 to receive messages or data sent by other users to server 103. The terminal 101 may be hardware or software. When the terminal 101 is hardware, it may be various electronic devices including, but not limited to, a smart watch, a smart phone, a tablet computer, a laptop portable computer, a desktop computer, and the like. When the terminal 101 is software, it may be installed in the above-listed electronic device, and it may be implemented as a plurality of software or software modules (for example, to provide distributed services), or may be implemented as a single software or software module, which is not specifically limited herein.
The server 103 may be a business server providing various services. The server 103 may be hardware or software. When the server 103 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 103 is software, it may be implemented as a plurality of software or software modules (for example, to provide a distributed service), or may be implemented as a single software or software module, which is not specifically limited herein.
It should be understood that the number of terminals, networks, and servers in fig. 1 is merely illustrative, and any number of terminals, networks, and servers may be used as desired for implementation.
Referring to fig. 2, fig. 2 is a system interaction diagram of a method for determining a corner of handwriting according to an embodiment of the present application, and a system interaction process in the method for determining a corner of handwriting will be described below with reference to fig. 1 and fig. 2.
S201, receiving target handwriting input from the outside through a display screen.
Alternatively, when the user needs to input the hand-drawn handwriting, the hand-drawn handwriting may be input on the display by touching with a finger, using a touch pen or other modes, and the display screen may receive the hand-drawn handwriting input from the outside through a sensor in the device as the target handwriting, where the sensor in the device may be various, for example, a pressure sensor, a current sensor, a voltage sensor, etc., which is not limited in the embodiment of the present application.
S202, the processor acquires target handwriting through the display screen, acquires all track points in the target handwriting, calculates writing speed of each track point and final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in a preset range of the corresponding track point.
Optionally, the preset range is a circular range with the corresponding track point as a center point and the radius as the preset radius, and the circular range includes the corresponding track point and other track points in at least three target scripts.
Optionally, after calculating the writing speed of each track point and the final curvature of each track point, the method further includes: calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point; wherein the preset condition is a condition set according to the average speed and the average curvature.
S203, the processor selects a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first corner point of the target handwriting.
Optionally, the writing speeds and the final curvatures of the start track point and the end track point in the target handwriting are zero, and the start track point and the end track point are the first corner points.
Optionally, after selecting the corresponding track point with the writing speed and the final curvature meeting the preset conditions as the first angle point of the target handwriting, the method further includes: according to the writing sequence of each first corner in the target handwriting, the distance between each first corner and the corresponding next first corner is calculated in sequence, and the first corner with the distance smaller than the preset length is removed.
S204, the processor removes the pseudo corner points in the first corner points of the target handwriting to obtain second corner points of the target handwriting.
Optionally, removing the pseudo corner point in the first corner point of the target handwriting to obtain a second corner point of the target handwriting, including: performing line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, wherein the stroke segment is a track segment corresponding to each two adjacent first corner points in the target handwriting; determining a pseudo corner point in the first corner point according to a fitting result and preset fitting conditions; removing the pseudo corner points in the first corner points, and determining the remaining corner points in the first corner points as second corner points of the target handwriting.
Optionally, performing line segment fitting on the stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, including: calculating the length of each stroke segment, and calculating the average length of all the stroke segments in the target handwriting according to the length of each stroke segment; selecting a stroke segment with the length shorter than the average length as a target stroke segment, and performing line segment fitting on the target stroke segment to obtain self fitting errors corresponding to each target stroke segment; according to the writing sequence of each target stroke in the target handwriting, performing line segment fitting on the left adjacent stroke segment of each target stroke segment to obtain a left fitting error of the left adjacent stroke segment, and performing line segment fitting on the right adjacent stroke segment of each target stroke segment to obtain a right fitting error of the right adjacent stroke segment; merging each target stroke segment and the corresponding left adjacent stroke segment to obtain left merged stroke segments, and performing line segment fitting on each left merged stroke segment to obtain left merged fitting errors of each left merged stroke segment; and merging each target stroke segment and the corresponding right adjacent stroke segment to obtain right merged stroke segments, and performing line segment fitting on each right merged stroke segment to obtain right merged fitting errors of each right merged stroke segment.
Optionally, determining the pseudo corner point in the first corner point according to the fitting result and a preset fitting condition includes: if the left merging fitting error in the target stroke section is smaller than the right merging fitting error and the left merging fitting error in the target stroke section is smaller than the sum of the left fitting error of the first preset multiple and the self fitting error of the second preset multiple, determining that a first corner point at the left end in the target stroke section is a pseudo corner point; if the right merging fitting error in the target stroke section is smaller than the left merging fitting error and the right merging fitting error in the target stroke section is smaller than the sum of the right fitting error of the third preset multiple and the self fitting error of the fourth preset multiple, determining that the first corner point at the right end in the target stroke section is a pseudo corner point.
Optionally, after removing the dummy corner point in the first corner point, the method further includes: and re-performing line segment fitting on the stroke segments in the target handwriting, and removing the pseudo corner points in the first corner points again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
The embodiment of the application provides a method for determining the corner points of handwriting. Firstly, all track points in a target handwriting are obtained, the writing speed of each track point and the final curvature of each track point are calculated, and the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point; then calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point; and finally, selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first corner point of the target handwriting, wherein the preset conditions are conditions set according to the average speed and the average curvature. When the curvature of the track point is calculated, the average value of all curvatures of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvature of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter is reduced, curvature mutation caused by smooth jitter can be effectively performed, more accurate corner points are selected, line segment fitting, loop iteration and other calculation operations are performed on the handwriting according to the first corner point, and the false corner points are removed from the first corner points, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
In the current technical scheme, in the process of determining the angular point of the handwriting, the method of performing preprocessing on the handwriting, such as Gaussian smoothing of the track point, resampling of the track point and the like is generally adopted, so that the situation of misidentification of the angular point caused by curvature mutation and the like is reduced, and in the curvature calculation part of the track point, the curvature of the track point is obtained only by calculating the vector between the track point and two adjacent track points, but suddenly dithered when a user writes, the current track point is more prominent than the two adjacent track points, at the moment, the curvature of the track point determined according to the vector between the adjacent track point and the track point is possibly quite large, the track point is wrongly identified as the angular point, and the false angular point screening is not performed after the angular point is calculated, so that the finally determined angular point is inaccurate, and a plurality of false angular points are included.
Therefore, the embodiment of the application provides a method for determining the corner points of handwriting so as to solve the technical problems.
Referring to fig. 3, fig. 3 is a flowchart of a method for determining a corner point of handwriting according to an embodiment of the present application. The execution subject of the embodiment of the application may be a terminal or a server, or may be a processor in the terminal or the server, or may be a system for determining the angular point of the handwriting in the terminal or the server, or a service for determining the angular point of the handwriting. For convenience of description, a specific implementation procedure of the method for determining the corner point of the handwriting will be described below by taking a processor in the terminal as an implementation subject.
The method for determining the corner point of the handwriting shown in fig. 3 at least comprises the following steps:
s301, acquiring all track points in the target handwriting, and calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point.
Optionally, with development of modern technologies, handwriting input information on a display screen has become popular, when a user wants to learn corresponding image information of handwriting by handwriting input handwriting on a terminal, the drawing handwriting input by the user needs to be identified, then the corresponding handwriting image information is generated, and during the process of inputting the drawing handwriting by the user or after the user inputs a complete drawing image (which may include multiple handwriting), when the image information of the hand drawing handwriting is analyzed by a computer, angular points of the handwriting are usually detected to extract image features, the angular points are trace points with specific features in the handwriting, for example, the angular points may be trace points with a larger bending degree, and then the hand drawing handwriting or the drawing image may be analyzed by angular point distribution after determining the angular points. Therefore, the hand-drawn handwriting input by the user can be obtained as the target handwriting, points in the target handwriting are collected as all track points in the target handwriting, and further, the corner points capable of representing handwriting characteristics are determined from all track points.
Alternatively, the target handwriting may be the corresponding handwriting during the process of inputting the drawing handwriting by the user, or may be the corresponding handwriting after the user inputs the complete drawing image (may include a plurality of handwriting). The following description will be made by taking an example that the target handwriting may be a corresponding handwriting in the process of inputting the drawing handwriting by the user, and a method for determining corner points of other types of target handwriting is similar to the following method.
Optionally, when the target handwriting may be the handwriting corresponding to the drawing handwriting input process by the user, in order to achieve a uniform and stable acquisition effect when the track points in the target handwriting are acquired, so as to determine that the determined corner points cannot accurately represent the handwriting characteristics due to unstable acquisition frequency, the points in the target handwriting may be acquired as all track points of the target handwriting according to the preset frequency. When the track point acquisition is performed on the target handwriting according to the preset frequency, the setting of the preset frequency can have various bases, for example, the fixed track point acquisition frequency can be set according to the most common writing speed of most users; the track point acquisition frequency corresponding to each user can be set in a personalized way according to the personal writing speed of each user; the track points can be acquired according to the user-defined acquisition frequency. The acquisition function according to the preset frequency can be realized by hardware equipment or a corresponding program in the hardware equipment, and the preset frequency setting basis of the acquisition track points and the mode of acquiring the track points are not limited in the embodiment of the application.
Optionally, when the corner point is selected, the track points with obvious characteristics in all track points are selected as the corner point, and for convenience of description, the track points corresponding to the target handwriting when the target handwriting is bent and the bending angle is larger than the preset angle are taken as the corner point for introduction.
On the one hand, in most cases, the writing speed of a user when drawing the image features in the writing process is correspondingly changed, the state when writing the track point can be determined according to the speed of the track point, and the slower the speed of the track point, the more likely the target handwriting is bent at the track point; on the other hand, the curvature of the track point is the rotation rate of the tangential direction angle of the track point to the arc length, which indicates the degree of the track point deviating from the target handwriting, so that the state when the track point is written can be determined according to the curvature of the track point, and the larger the curvature of the track point is likely to represent the target handwriting to be bent at the track point, so that the speed and the curvature of the corresponding track point can show the characteristics of the target handwriting when the target handwriting is bent.
Therefore, after the track points in the target handwriting are acquired, the writing speed of each track point and the curvature of each track point can be calculated, and meanwhile, the writing speed and the curvature are used as judging conditions for selecting the track points, so that compared with the condition that only the curvature of the track points is considered, all the track points can be compared more comprehensively. When the writing speed of the current track point is calculated, the calculation can be performed according to the distance between the current track point and the left and right adjacent track points and the corresponding time, wherein the speed of the current track point can be obtained by dividing the distance between the two adjacent track points of the current track point by the time difference between the two adjacent track points, and the specific calculation mode is exemplified as follows:
v=pathLength(i-1,i+1)/(t i+1 -t i-1 );
The writing speed of the current track point is represented as v, the time corresponding to the current track point is represented as t, the identification number of the current track point is i, and the sum of the distances between the current track point and the left and right adjacent track points is represented by path length.
Further, in order to more accurately select corner points from the trace points, the curvature of each trace point needs to be calculated. It can be understood that when calculating the curvature of the track point, the vector formed by the track point and other track points on the left side and the vector formed by the track point and other track points on the right side can be obtained first, the curvature of the track point is calculated by the included angle between the two vectors, and in general, some schemes can calculate the curvature of the track point directly according to the vector formed by the track point and two track points adjacent to each other on the left and right.
Optionally, because the pseudo corner points have a relatively obvious bending degree to the adjacent track points, but only a relatively slight bending degree is shown in a section of handwriting where the pseudo corner points are located, in order to remove the pseudo corner points in the track points, when calculating the curvature of the track points, a plurality of vectors formed by the track points and a plurality of other track points in a preset range can be calculated, a plurality of curvatures corresponding to the track points can be calculated according to the plurality of vectors, and finally, the final curvature of the track points can be determined according to the plurality of curvatures, so that the curvature mutation of the track points caused by artificial jitter can be effectively smoothed, and the pseudo corner points can be effectively removed.
Referring to fig. 4, fig. 4 is a schematic diagram of a target handwriting according to an embodiment of the present application. As shown in fig. 4, in one piece of handwriting 410 in the display screen 400, there are a plurality of track points 420, and there are track points a, B, C, D, E in writing order, when calculating the curvature of C, not only the first curvature of C is calculated according to the vector formed by B and C, D and C, but also the second curvature of C is calculated according to the vector formed by a and C, E and C, the third curvature of C is calculated according to the vector formed by B and C, E and C, and the fourth curvature of C is calculated according to the vector formed by a and C, D and C, at this time, the most accurate final curvature of C can be determined according to the first, second, third and fourth curvatures of C.
Optionally, in order to collect other track points on the left and right sides of the current track point relatively uniformly, a preset range may be set to a circular range (represented by a circular window 430 in fig. 4) with the track point as a center point and a radius as a preset radius, and in order to ensure that the final curvature of each track point can be calculated based on at least two curvatures, a circular range with the preset radius may be set to include at least three track points on the same target handwriting as the current track point in addition to the current track point, and a specific radius of the circular range may be set based on the rule and the track point collection frequency. After the radius R of the circular range is set, calculating the curvature curvatus of the track point according to a curvature solving formula f, wherein the curvature curvatus is as follows:
curvature[i]=f(vector[i-r],vector[i+r]),r=[0,R];
the identification number of the current track point is i, r is the linear distance between other track points in the target handwriting and the current track point, and vector [ i-r ] is the vector representation formed by the two track points. It will be readily appreciated that a circular range of preset radii can also be considered as a window, within which all curvatures of the center locus point, i.e. the cumulative curvature of the window.
Alternatively, after obtaining a plurality of curvatures of the track points, in order to uniformly calculate the final curvatures of all the track points, a curvature average value may be obtained based on all the curvatures in the window of the preset range as the final curvature of the track points. In practical situations, in order to ensure the integrity of the acquired image information, the acquisition frequency of the track points is generally faster, the track points are generally denser, and more track points can exist in the range of the preset radius, so in a preferred embodiment, in order to preserve the curvature characteristics of the current track point to the greatest extent, all curvatures in the window of the preset range can be arranged from large to small, and the first 50% of curvature value is taken to obtain the average value c as the final curvature of the current track point.
S302, selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first corner point of the target handwriting.
Optionally, after the writing speed of each track point and the final curvature of each track point are calculated, all track points can be screened according to the preset writing speed condition and the final curvature condition, and the track points meeting the preset condition are selected as the corner points of the target handwriting. When preset conditions are set, a fixed value can be directly set as the preset threshold conditions of the writing speed and the final curvature of the track points, so that the calculation steps of the conditions can be reduced; different preset conditions can be set according to different target handwriting, so that corresponding preset conditions can be set more accurately for the target handwriting.
S303, removing the pseudo corner points in the first corner points of the target handwriting to obtain second corner points of the target handwriting.
Optionally, since the corner points are selected only from the level of each trace point when the corner points are determined according to the curvature of the trace point, the false corner points are inevitably generated, and when the first corner points are determined according to the writing speed and the final curvature of the trace point, the false corner points in the first corner points can be removed under ideal conditions, but there may be some false corner points which meet the selection conditions of the first corner points, and thus the first corner points are considered. Then after the first corner is determined, the first corner is further detected, the pseudo corner in the first corner is determined, the corresponding pseudo corner is removed, and the second corner of the target handwriting is obtained.
The embodiment of the application provides a method for determining the corner points of handwriting. Firstly, all track points in a target handwriting are obtained, the writing speed of each track point and the final curvature of each track point are calculated, and the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point; then selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting; and finally, removing the pseudo corner point in the first corner point of the target handwriting to obtain a second corner point of the target handwriting. When the curvature of the track point is calculated, the average value of all curvatures of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvatures of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter on corner point selection is reduced, curvature mutation caused by smooth jitter can be effectively performed, more accurate corner points are selected, and then the false corner points are continuously removed from the first corner point through calculation, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
Referring to fig. 5, fig. 5 is a flowchart illustrating a method for determining a corner point of handwriting according to another embodiment of the present application.
As shown in fig. 5, the method for determining the corner point of the handwriting at least may include:
s501, obtaining all track points in the target handwriting, and calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point.
For step S501, please refer to the detailed description in step S301, and the detailed description is omitted here.
S502, calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point, wherein the preset condition is a condition set according to the average speed and the average curvature.
It can be understood that when processing data, the average value can reflect the overall characteristic of the data, so in the embodiment of the present application, when the preset condition is set, the preset condition can be set according to the average speed of all the track points and the average curvature of all the track points, so that the average speed v of the track points in the target handwriting needs to be calculated according to the writing speed of each track point avg Calculating the average curvature c of the track points in the target handwriting according to the final curvature of each track point avg
S503, selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first corner point of the target handwriting.
Alternatively, by the description of the above embodiment, after calculating the writing speed and the final curvature of each track point, and the average speed and the average curvature of all track points, the preset condition may be set according to the average speed and the average curvature of all track points. Further, when the writing speed of the track point is greater than the average speed of the preset multiple and the final curvature is greater than the average curvature of the preset multiple, the current track point is selected as the first corner point of the target handwriting, preferably, the preset multiple of the average speed is set to be 0.75, the preset multiple of the average speed is set to be 1, and at this time, if the writing speed or the final curvature of the track point meets the following conditions:
v>0.75v avg and c>c avg
Then the locus point is selected as the first corner of the target handwriting. When preset conditions are set, the multiple parameters used can be obtained according to multiple sample tests, and can also be set directly according to experience, and when first angular points are selected for different handwriting, the parameters can be adjusted adaptively.
Optionally, when the writing speed and the final curvature of the track points in the target handwriting are calculated, the starting track points and the ending track points of the target handwriting are used as the end points at the two ends of the target handwriting, the writing speed and the final curvature of the starting track points and the ending track points are zero, but the starting track points and the ending track points have important significance for reflecting the characteristics of the image, so that the starting track points and the ending track points are defaulted to be the first corner points.
S504, according to the writing sequence of each first corner point in the target handwriting, sequentially calculating the distance between each first corner point and the next corresponding first corner point, and removing the first corner points with the distance smaller than the preset length.
Alternatively, since in most cases the user does not always draw two image features continuously in a short distance, e.g. two handwriting bends occur within a distance, when drawing, in hand-drawn handwriting, usually the two correct corner points do not occur in very close positions. Then, based on this, when two first corner points are closer, it is indicated that there may be a false corner point, so that a screening condition may be set based on the distance between the current first corner point and the corresponding next first corner point, each first corner point is traversed according to the handwriting writing sequence, and the first corner points are screened according to the screening condition, so as to remove the possible false corner points.
Further, when the screening condition is set, the distance from the current first corner point to the next first corner point corresponding to the current first corner point can be compared with the total length of the target handwriting of the preset multiple, and when the distance from the first corner point to the next first corner point corresponding to the first corner point is smaller than the total length of the target handwriting of the preset multiple, the first corner point with smaller curvature in the two first corner points is removed. The preset multiple may be set according to actual situations, and the preset multiple parameter is not specifically limited in the embodiment of the present application. Preferably, if the total length of the target handwriting between the current first corner and the next corresponding first corner is smaller than 0.1 times, comparing the curvature of the current first corner and the next corresponding first corner, removing the first corner with smaller curvature from the two first corners, traversing all the first corners according to the condition, and finally selecting the rest first corners. It should be noted that, in order to complete the traversal, when the pseudo corner points to be removed are screened out, the pseudo corner points can be marked first, so as to avoid the screening process of directly removing the next corner points which affect the pseudo corner points after the calculation result, after all the first corner points are traversed, all the marked first corner points are taken as the pseudo corner points and removed, and the remaining first corner points are selected as the first corner points of the target handwriting.
S505, removing the pseudo corner points in the first corner points of the target handwriting to obtain second corner points of the target handwriting.
For step S505, please refer to the detailed description in step S303, and the detailed description is omitted here.
The embodiment of the application provides a method for determining the corner points of handwriting. Firstly, all track points in a target handwriting are obtained, the writing speed of each track point and the final curvature of each track point are calculated, and the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point; then selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting; and finally, removing the pseudo corner point in the first corner point of the target handwriting to obtain a second corner point of the target handwriting. When the curvature of the track point is calculated, the average value of all curvatures of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvatures of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter on corner point selection is reduced, curvature mutation caused by smooth jitter can be effectively performed, more accurate corner points are selected, and then the false corner points are continuously removed from the first corner point through calculation, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
Referring to fig. 6, fig. 6 is a flowchart illustrating a method for determining a corner point of handwriting according to another embodiment of the present application.
As shown in fig. 6, the method for determining the corner point of the handwriting at least includes:
s601, obtaining all track points in the target handwriting, and calculating writing speed of each track point and final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in a preset range of the corresponding track point.
S602, selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first corner point of the target handwriting.
For steps S601-S602, please refer to the detailed description in steps S301-S302, and the detailed description is omitted here.
S603, performing line segment fitting on the stroke segments in the target handwriting to obtain a fitting result corresponding to the stroke segments, wherein the stroke segments are track segments corresponding to every two adjacent first corner points in the target handwriting.
Optionally, as can be seen from the description of the foregoing embodiment, in a practical situation, after determining the first corner point in the target handwriting, in order to determine whether a pseudo corner point exists in the first corner point, and remove the pseudo corner point when the pseudo corner point exists in the first corner point, in consideration of the overall level of the target handwriting, line segment fitting may be performed on a stroke segment in the target handwriting, so as to determine whether the track point is the pseudo corner point according to the stroke segment information before and after the track point. The line segment fitting is to fit a line segment formed by connecting a stroke segment in a target handwriting with two track points at the head and the tail of the stroke segment, so that the fitting error between the stroke segment and the corresponding line segment can be finally obtained, the smaller the fitting error is, the more fit between the stroke segment and the corresponding line segment is shown, namely, the stroke segment is possibly a complete stroke segment without characteristic points, namely, the corner point in the stroke segment is proved to be a pseudo corner point, at the moment, the preset fitting condition can be set, the preset fitting condition is compared with the fitting result of the stroke segment, and the pseudo corner point in the first corner point can be determined and the pseudo corner point is removed.
Specifically, before line segment fitting is performed on the stroke segments, the target handwriting needs to be segmented according to first corner points in the target handwriting, the target handwriting is segmented into stroke segments according to each pair of adjacent first corner points, and line segment fitting is performed on all the stroke segments in the target handwriting according to a preset fitting rule. In consideration of practical situations, since a user usually cannot draw two image bending feature points at a position closer to the user, when the distance between two corner points is closer, the probability of having a false corner point in the two corner points is larger, that is, the false corner point is easier to appear in a shorter stroke segment, and when the target handwriting is longer and the stroke segments in the target handwriting are more, if line segment fitting is performed on each stroke segment, excessive calculation amount is caused and the detection result of the false corner point is not significantly improved.
Optionally, the length of each stroke segment can be calculated, the average length of all the stroke segments in the target handwriting can be calculated according to the length of each stroke segment, the stroke segment with the length shorter than the average length is selected as the target stroke segment, and the segment fitting is only carried out on the target stroke segment, so that the fitting result of the target stroke segment is determined, and the false corner point in the target handwriting can still be detected on the basis of reducing the calculation pressure. For ease of description, the Stroke segments may be denoted as Segment strokes, the Length of each Stroke Segment is denoted as Path Length, and the average Length of all the Stroke segments is denoted as Seg ave_len
Optionally, after the target stroke segments are selected, all the target stroke segments can be ordered from small to large according to the length, and line segment fitting is performed from the shortest target stroke segment, so that each target stroke segment can be traversed conveniently subsequently, and line segment fitting is performed according to a preset fitting rule. Further, a fitting result of the target stroke segment is obtained. First, for a target Stroke Segment Stroke s Line segment fitting is carried out to obtain self fitting error FitError corresponding to the target stroke segment s The method comprises the steps of carrying out a first treatment on the surface of the Then according to the writing sequence of each target Stroke Segment in the target handwriting, the Segment Stroke of the left adjacent Stroke Segment of each target Stroke Segment is compared s-1 Performing line segment fitting to obtain left fitting error FitError of left adjacent stroke segments s-1 And for each of the target Stroke segments, right adjacent Stroke Segment strokes s+1 Performing line segment fitting to obtain right fitting error FitError of right adjacent stroke segments s+1 The method comprises the steps of carrying out a first treatment on the surface of the Merging each target stroke segment and its correspondingThe left adjacent Stroke Segment obtains the left merged Stroke Segment Stroke left Performing line segment fitting on each left merging stroke segment to obtain a left merging fitting error FitError of each left merging stroke segment left Combining each target Stroke Segment and the corresponding right adjacent Stroke Segment to obtain a right combined Stroke Segment Stroke right Line segment fitting is carried out on each right merged stroke segment, and a right merged fitting error FitError of each right merged stroke segment is obtained right And fitting error FitError of the corresponding self of the target stroke segment s FitError left fitting error s-1 Fit error FitError s+1 Left merge fitting error FitError left Right merge fitting error FitError right And taking the result as a fitting result corresponding to the target stroke segment.
It can be appreciated that when there is no adjacent stroke segment to the left or right of the target stroke segment in the target handwriting, the target stroke segment is directly taken as a combined stroke segment when the stroke segments are combined, for example, if the target stroke segment is the first stroke segment in the target handwriting and there is no adjacent stroke segment to the left of the target stroke segment, the target stroke segment is taken as a left combined stroke segment when the stroke segments are combined to the left, and the fitting error of the target stroke segment is taken as a left combined fitting error, so that subsequent calculation can be performed.
S604, determining a pseudo corner point in the first corner point according to a fitting result and preset fitting conditions.
Optionally, it may be known from the description of the foregoing embodiment that after determining the fitting result of the target stroke segment according to the preset fitting rule, the pseudo corner point in the first corner point may be determined by setting a preset fitting condition, and comparing the preset fitting condition with the fitting result of the stroke segment, so as to further remove the pseudo corner point in the first corner point. Because only the first and the last track points in the target stroke section are the first corner points, the two corner points can be detected respectively according to the fitting result, wherein if the left merging fitting error in the target stroke section is smaller than the right merging fitting error, the left merging stroke section is more attached to the line section than the right merging stroke section, the probability of the occurrence of the real corner point in the left merging stroke section is lower than that of the right merging stroke section, namely the first corner point at the left end of the target stroke section is possibly a pseudo corner point, and on the basis, the fitting error of the target stroke section is compared with the left fitting error, so that whether the first corner point at the left end of the target stroke section is the pseudo corner point is further determined.
Specifically, the setting of the preset fitting condition may be that if the fitting result of the target stroke segment is left combined with the fitting error FitError left Less than the right merge fitting error FitError right And the left merging fitting error FitError in the target stroke segment left Left fitting error FitError less than a first preset multiple s-1 Fitting error FitError with itself of a second preset multiple s If the first corner is equal to the second corner, determining that the first corner at the left end in the target stroke section is a pseudo corner; if the right merge fitting error FitError in the target stroke segment right Less than the left merge fitting error FitError left And the right merge fitting error FitError in the target stroke segment right Right fitting error FitError less than a third preset multiple s+1 Fitting error FitError with itself of fourth preset multiple s And (2) determining the first corner at the right end in the target stroke segment as a pseudo corner. The first preset multiple, the second preset multiple, the third preset multiple and the fourth preset multiple can be set according to actual conditions, and the four preset multiples can be the same or different.
In the embodiment of the application, in order to detect the pseudo-corner in the target handwriting with the same standard and facilitate the calculation of the pseudo-corner, the first preset multiple and the third preset multiple in the preset fitting condition are set to be 1.5, the second preset multiple and the fourth preset multiple are set to be 1, that is, if the fitting result of the target stroke segment meets the following conditions:
FitError left <FitError right And FitError left <1.5×FitError s-1 +FitError s
And determining the first corner at the left end of the target stroke segment as a pseudo corner.
If the fitting result of the target stroke segment meets the following conditions:
FitError right <FitError left and FitError right <1.5×FitError s+1 +FitError s
And determining the first corner at the right end of the target stroke segment as a pseudo corner.
S605, removing the pseudo corner points in the first corner points.
Optionally, traversing all target stroke segments in the target handwriting, comparing the target stroke segments with fitting results of all the stroke segments according to preset fitting conditions, determining pseudo corner points, and directly removing the pseudo corner points in the first corner points to filter the pseudo corner points in the target handwriting.
S606, carrying out line segment fitting on the stroke segments in the target handwriting again, and removing the pseudo corner points in the first corner points again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
Optionally, after all the target stroke segments in the target handwriting are detected by the pseudo-corner points, in order to more comprehensively detect the first corner points in the target handwriting, iteration can be performed on all the stroke segments in the target handwriting, so that after each traversal is finished, whether the pseudo-corner points are contained or not can be further continuously determined from the remaining first corner points, and finally, when the stroke segments in the target handwriting meet the iteration finishing condition, the corner points in the target handwriting can be determined to be real corner points.
Specifically, after removing the pseudo corner point in the first corner point each time, re-segmenting the stroke segment of the target handwriting according to the rest corner points in the first corner point, performing line segment fitting on the re-segmented stroke segment according to a preset fitting condition, and removing the pseudo corner point in the first corner point again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths Seg of all the stroke segments in the target handwriting ave_len . It should be noted that each time the iteration is run, the calculated average length Seg of the stroke segment ave_len Can be directly multiplied by the number of loop iterations, thus the calculation efficiency can be quickened and the calculation junction is not caused compared with the calculation of the average length of the stroke segment every timeThe effect is affected.
S607, determining the remaining corner points in the first corner points as second corner points of the target handwriting.
Optionally, by continuously performing iterative loop on the stroke segments in the target handwriting, when all the stroke segments finally meet the iteration end condition, the pseudo corner points in the first corner points are removed and ended, at this time, the remaining corner points in the first corner points can be determined to be the second corner points of the target handwriting, and the second corner points are the most accurate real corner points in the final target handwriting.
The application provides a method for determining a corner point of handwriting. Firstly, all track points in a target handwriting are obtained, the writing speed of each track point and the final curvature of each track point are calculated, and the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point; then selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting; and finally, removing the pseudo corner point in the first corner point of the target handwriting to obtain a second corner point of the target handwriting. When the curvature of the track point is calculated, the average value of all curvatures of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvature of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter is reduced, curvature mutation caused by smooth jitter can be effectively performed, more accurate corner points are selected, line segment fitting, loop iteration and other calculation operations are performed on the handwriting according to the first corner point, and the false corner points are removed from the first corner points, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
Referring to fig. 7, fig. 7 is a block diagram of a device for determining a corner point of handwriting according to an embodiment of the present application. As shown in fig. 7, the apparatus 700 for determining a corner point of handwriting includes:
the speed curvature calculation module 710 is configured to obtain all the track points in the target handwriting, calculate the writing speed of each track point and the final curvature of each track point, where the final curvature is the average value of the cumulative curvatures of the track points and the vectors formed by other track points in the preset range of the track points;
the corner determining module 720 is configured to select a corresponding track point with a writing speed and a final curvature meeting a preset condition as a first corner of the target handwriting;
and the pseudo corner removing module 730 is configured to remove the pseudo corner in the first corner of the target handwriting, and obtain a second corner of the target handwriting.
Optionally, the handwriting corner determining apparatus 700 further includes: the average value calculation module is used for calculating the average speed of the track points in the target handwriting according to the writing speed of each track point and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point; wherein the preset condition is a condition set according to the average speed and the average curvature.
Optionally, the handwriting corner determining apparatus 700 further includes: the pseudo corner determining module is used for sequentially calculating the distance between each first corner and the next corresponding first corner according to the writing sequence of each first corner in the target handwriting, and removing the first corners with the distance smaller than the preset length.
Optionally, the pseudo-corner removing module 730 is further configured to perform line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, where the stroke segment is a track segment corresponding to each two adjacent first corners in the target handwriting; determining a pseudo corner point in the first corner point according to a fitting result and preset fitting conditions; removing the pseudo corner points in the first corner points, and determining the remaining corner points in the first corner points as second corner points of the target handwriting.
Optionally, the pseudo-corner removing module 730 is further configured to calculate a length of each stroke segment, and calculate an average length of all the stroke segments in the target handwriting according to the length of each stroke segment; selecting a stroke segment with the length shorter than the average length as a target stroke segment, and performing line segment fitting on the target stroke segment to obtain self fitting errors corresponding to each target stroke segment; according to the writing sequence of each target stroke in the target handwriting, performing line segment fitting on the left adjacent stroke segment of each target stroke segment to obtain a left fitting error of the left adjacent stroke segment, and performing line segment fitting on the right adjacent stroke segment of each target stroke segment to obtain a right fitting error of the right adjacent stroke segment; merging each target stroke segment and the corresponding left adjacent stroke segment to obtain left merged stroke segments, and performing line segment fitting on each left merged stroke segment to obtain left merged fitting errors of each left merged stroke segment; and merging each target stroke segment and the corresponding right adjacent stroke segment to obtain right merged stroke segments, and performing line segment fitting on each right merged stroke segment to obtain right merged fitting errors of each right merged stroke segment.
Optionally, the pseudo-corner removing module 730 is further configured to determine that the first corner at the left end in the target stroke segment is the pseudo-corner if the left merged fitting error in the target stroke segment is smaller than the right merged fitting error and the left merged fitting error in the target stroke segment is smaller than the sum of the left fitting error of the first preset multiple and the self fitting error of the second preset multiple; if the right merging fitting error in the target stroke section is smaller than the left merging fitting error and the right merging fitting error in the target stroke section is smaller than the sum of the right fitting error of the third preset multiple and the self fitting error of the fourth preset multiple, determining that the first corner point at the right end in the target stroke section is a pseudo corner point.
Optionally, the spurious corner removing module 730 is further configured to re-perform line segment fitting on the stroke segments in the target handwriting, and remove the spurious corner in the first corner again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
In an embodiment of the present application, a device for determining a corner point of a handwriting is provided, where a velocity curvature calculation module is configured to obtain all track points in a target handwriting, calculate a writing velocity of each track point and a final curvature of each track point, where the final curvature is a mean value of accumulated curvatures of vectors formed by the track points and other track points in a preset range of the track points; the angular point determining module is used for selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first angular point of the target handwriting; and the pseudo corner removing module is used for removing the pseudo corner in the first corner of the target handwriting to obtain a second corner of the target handwriting. When the curvature of the track point is calculated, the average value of the track point in a preset range is used as the final curvature of the track point, namely, the average value of the accumulated curvature of the sliding window is calculated to be used as the curvature of the track point at the center of the window, so that the first corner point in the handwriting is determined, misguidance of curvature mutation caused by normal jitter is reduced, curvature mutation caused by jitter can be effectively smoothed, more accurate corner points are selected, line segment fitting, loop iteration and other calculation operations are performed on the handwriting according to the first corner point, and the false corner points are removed from the first corner points, so that the false corner points in the corner points can be further effectively removed, and the correct corner points in the handwriting are finally determined.
Embodiments of the present application also provide a computer storage medium having stored thereon a plurality of instructions adapted to be loaded by a processor and to perform the steps of the method according to any of the embodiments described above.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present application. As shown in fig. 8, the terminal 800 may include: at least one terminal processor 801, at least one network interface 804, a user interface 803, memory 805, at least one communication bus 802.
Wherein a communication bus 802 is used to enable connected communication between these components.
The user interface 803 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 803 may further include a standard wired interface and a wireless interface.
The network interface 804 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), among others.
Wherein the terminal processor 801 may comprise one or more processing cores. The terminal processor 801 connects various parts within the entire terminal 800 using various interfaces and lines, performs various functions of the terminal 800 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 805, and invoking data stored in the memory 805. Alternatively, the terminal processor 801 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The terminal processor 801 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), an image processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the terminal processor 801 and may be implemented by a single chip.
The Memory 805 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (ROM). Optionally, the memory 805 includes a non-transitory computer readable medium (non-transitory computer-readable storage medium). Memory 805 may be used to store instructions, programs, code, sets of codes, or instruction sets. The memory 805 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the above-described respective method embodiments, etc.; the storage data area may store data or the like referred to in the above respective method embodiments. The memory 805 may also optionally be at least one storage device located remotely from the aforementioned terminal processor 801. As shown in fig. 8, an operating system, a network communication module, a user interface module, and a handwriting corner determination program may be included in the memory 805 as a computer storage medium.
In the terminal 800 shown in fig. 8, the user interface 803 is mainly used for providing an input interface for a user, and acquiring data input by the user; and the terminal processor 801 may be configured to call the handwriting corner determining program stored in the memory 805, and specifically perform the following operations:
Acquiring all track points in the target handwriting, calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point;
selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting;
removing the pseudo corner points in the first corner points of the target handwriting to obtain second corner points of the target handwriting.
Optionally, the preset range is a circular range with the corresponding track point as a center point and the radius as the preset radius, and the circular range includes the corresponding track point and other track points in at least three target scripts.
Optionally, the writing speeds and the final curvatures of the start track point and the end track point in the target handwriting are zero, and the start track point and the end track point are the first corner points.
In some embodiments, after performing the calculation of the writing speed of each trace point and the final curvature of each trace point, the terminal processor 801 further specifically performs the following steps: calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point; wherein the preset condition is a condition set according to the average speed and the average curvature.
In some embodiments, after performing selecting, as the first angle point of the target handwriting, a corresponding trajectory point whose writing speed and final curvature satisfy the preset condition, the terminal processor 801 further specifically performs the following steps: according to the writing sequence of each first corner in the target handwriting, the distance between each first corner and the corresponding next first corner is calculated in sequence, and the first corner with the distance smaller than the preset length is removed.
In some embodiments, when performing removing the pseudo corner point in the first corner point of the target handwriting to obtain the second corner point of the target handwriting, the terminal processor 801 specifically performs the following steps: performing line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, wherein the stroke segment is a track segment corresponding to each two adjacent first corner points in the target handwriting; determining a pseudo corner point in the first corner point according to a fitting result and preset fitting conditions; removing the pseudo corner points in the first corner points, and determining the remaining corner points in the first corner points as second corner points of the target handwriting.
In some embodiments, when executing line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, the terminal processor 801 specifically executes the following steps: calculating the length of each stroke segment, and calculating the average length of all the stroke segments in the target handwriting according to the length of each stroke segment; selecting a stroke segment with the length shorter than the average length as a target stroke segment, and performing line segment fitting on the target stroke segment to obtain self fitting errors corresponding to each target stroke segment; according to the writing sequence of each target stroke in the target handwriting, performing line segment fitting on the left adjacent stroke segment of each target stroke segment to obtain a left fitting error of the left adjacent stroke segment, and performing line segment fitting on the right adjacent stroke segment of each target stroke segment to obtain a right fitting error of the right adjacent stroke segment; merging each target stroke segment and the corresponding left adjacent stroke segment to obtain left merged stroke segments, and performing line segment fitting on each left merged stroke segment to obtain left merged fitting errors of each left merged stroke segment; and merging each target stroke segment and the corresponding right adjacent stroke segment to obtain right merged stroke segments, and performing line segment fitting on each right merged stroke segment to obtain right merged fitting errors of each right merged stroke segment.
In some embodiments, when the terminal processor 801 determines the pseudo corner in the first corner according to the fitting result and the preset fitting condition, the following steps are specifically performed: if the left merging fitting error in the target stroke section is smaller than the right merging fitting error and the left merging fitting error in the target stroke section is smaller than the sum of the left fitting error of the first preset multiple and the self fitting error of the second preset multiple, determining that a first corner point at the left end in the target stroke section is a pseudo corner point; if the right merging fitting error in the target stroke section is smaller than the left merging fitting error and the right merging fitting error in the target stroke section is smaller than the sum of the right fitting error of the third preset multiple and the self fitting error of the fourth preset multiple, determining that the first corner point at the right end in the target stroke section is a pseudo corner point.
In some embodiments, after performing removing the pseudo corner in the first corner, the terminal processor 801 specifically performs the following steps: and re-performing line segment fitting on the stroke segments in the target handwriting, and removing the pseudo corner points in the first corner points again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The integrated modules, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that, for the sake of simplicity of description, the foregoing method embodiments are all expressed as a series of combinations of actions, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily all necessary for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to the related descriptions of other embodiments.
The foregoing describes a method, apparatus, storage medium and terminal for determining a corner point of handwriting provided in the present application, and those skilled in the art should not understand the present application to limit the present application in summary, where the specific embodiments and application ranges are changed according to the concepts of the embodiments of the present application.

Claims (12)

1. A method for determining a corner point of handwriting, the method comprising:
Acquiring all track points in the target handwriting, and calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of all curvatures of vectors formed by the corresponding track point and other track points in the preset range of the corresponding track point;
selecting a corresponding track point with writing speed and final curvature meeting preset conditions as a first corner point of the target handwriting;
and removing the pseudo corner points in the first corner points of the target handwriting to obtain the second corner points of the target handwriting.
2. The method of claim 1, wherein after calculating the writing speed of each trace point and the final curvature of each trace point, further comprising:
calculating the average speed of the track points in the target handwriting according to the writing speed of each track point, and calculating the average curvature of the track points in the target handwriting according to the final curvature of each track point;
wherein the preset condition is a condition set according to the average speed and the average curvature.
3. The method of claim 1, wherein after the selecting the corresponding trajectory point where the writing speed and the final curvature satisfy the preset condition as the first angle point of the target handwriting, further comprises:
According to the writing sequence of each first corner point in the target handwriting, the distance between each first corner point and the next corresponding first corner point is calculated in sequence, and the first corner point with the distance smaller than the preset length is removed.
4. A method according to any one of claims 1 to 3, wherein said removing the pseudo-corner of the first corner of the target writing to obtain the second corner of the target writing comprises:
performing line segment fitting on a stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment, wherein the stroke segment is a track segment corresponding to each two adjacent first corner points in the target handwriting;
determining a pseudo corner point in the first corner point according to the fitting result and preset fitting conditions;
and removing the pseudo corner points in the first corner points, and determining the rest corner points in the first corner points as second corner points of the target handwriting.
5. The method of claim 4, wherein the performing line segment fitting on the stroke segment in the target handwriting to obtain a fitting result corresponding to the stroke segment comprises:
calculating the length of each stroke segment, and calculating the average length of all the stroke segments in the target handwriting according to the length of each stroke segment;
Selecting a stroke segment with the length shorter than the average length as a target stroke segment, and performing line segment fitting on the target stroke segment to obtain self fitting errors corresponding to all the target stroke segments;
according to the writing sequence of each target stroke segment in the target handwriting, performing line segment fitting on the left adjacent stroke segment of each target stroke segment to obtain a left fitting error of the left adjacent stroke segment, and performing line segment fitting on the right adjacent stroke segment of each target stroke segment to obtain a right fitting error of the right adjacent stroke segment;
merging each target stroke segment and the corresponding left adjacent stroke segment to obtain left merged stroke segments, and performing line segment fitting on each left merged stroke segment to obtain left merged fitting errors of each left merged stroke segment;
and merging each target stroke segment and the corresponding right adjacent stroke segment to obtain right merged stroke segments, and performing line segment fitting on each right merged stroke segment to obtain right merged fitting errors of each right merged stroke segment.
6. The method of claim 5, wherein the determining the pseudo corner in the first corner according to the fitting result and a preset fitting condition comprises:
If the left merging fitting error in the target stroke section is smaller than the right merging fitting error and the left merging fitting error in the target stroke section is smaller than the sum of the left fitting error of the first preset multiple and the self fitting error of the second preset multiple, determining that a first corner point at the left end in the target stroke section is a pseudo corner point;
if the right merging fitting error in the target stroke section is smaller than the left merging fitting error and the right merging fitting error in the target stroke section is smaller than the sum of the right fitting error of the third preset multiple and the self fitting error of the fourth preset multiple, determining that the first corner point of the right end in the target stroke section is a pseudo corner point.
7. The method of claim 4, wherein after removing the dummy corner points in the first corner points, further comprising:
and re-performing line segment fitting on the stroke segments in the target handwriting, and removing the pseudo corner points in the first corner points again until the lengths of the stroke segments in the target handwriting are smaller than the average lengths of all the stroke segments in the target handwriting.
8. A method according to any one of claims 1 to 3, wherein the predetermined range is a circular range having the corresponding track point as a centre point and a radius of a predetermined radius, the circular range including the corresponding track point and at least three other track points in the target writing.
9. A method according to any one of claims 1 to 3, wherein the writing speed and final curvature of the start and end track points in the target writing are both zero and the start and end track points are both first corner points.
10. A device for finding a corner point of handwriting, the device comprising:
the speed curvature calculation module is used for acquiring all track points in the target handwriting, calculating the writing speed of each track point and the final curvature of each track point, wherein the final curvature is the average value of the accumulated curvature of vectors formed by the track points and other track points in the preset range of the track points;
the angular point determining module is used for selecting a corresponding track point with the writing speed and the final curvature meeting preset conditions as a first angular point of the target handwriting;
and the pseudo corner removing module is used for removing the pseudo corner in the first corner of the target handwriting to obtain a second corner of the target handwriting.
11. A computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the steps of the method according to any one of claims 1 to 9.
12. A terminal comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method according to any one of claims 1 to 9 when the program is executed.
CN202111409952.5A 2021-11-24 2021-11-24 Handwriting corner determination method and device, storage medium and terminal Pending CN116168402A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111409952.5A CN116168402A (en) 2021-11-24 2021-11-24 Handwriting corner determination method and device, storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111409952.5A CN116168402A (en) 2021-11-24 2021-11-24 Handwriting corner determination method and device, storage medium and terminal

Publications (1)

Publication Number Publication Date
CN116168402A true CN116168402A (en) 2023-05-26

Family

ID=86410122

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111409952.5A Pending CN116168402A (en) 2021-11-24 2021-11-24 Handwriting corner determination method and device, storage medium and terminal

Country Status (1)

Country Link
CN (1) CN116168402A (en)

Similar Documents

Publication Publication Date Title
EP3680757B1 (en) Wet ink predictor
CN110765891B (en) Engineering drawing identification method, electronic equipment and related product
CN109800730B (en) Method and device for generating head portrait generation model
CN111125529A (en) Product matching method and device, computer equipment and storage medium
CN113313083A (en) Text detection method and device
CN114898177B (en) Defect image generation method, model training method, device, medium and product
CN114063858A (en) Image processing method, image processing device, electronic equipment and storage medium
US20230096921A1 (en) Image recognition method and apparatus, electronic device and readable storage medium
US10733710B2 (en) System and method for drawing beautification
CN114049674A (en) Three-dimensional face reconstruction method, device and storage medium
CN116168402A (en) Handwriting corner determination method and device, storage medium and terminal
CN110197459B (en) Image stylization generation method and device and electronic equipment
CN111803956A (en) Method and device for determining game plug-in behavior, electronic equipment and storage medium
CN111815748A (en) Animation processing method and device, storage medium and electronic equipment
CN114356201B (en) Writing beautifying method, device, equipment and readable storage medium
CN115797726A (en) Model obtaining method and device, electronic equipment and storage medium
EP3905240A1 (en) Speech recognition of overlapping segments
CN113658581A (en) Acoustic model training method, acoustic model training device, acoustic model speech processing method, acoustic model speech processing device, acoustic model speech processing equipment and storage medium
CN113313049A (en) Method, device, equipment, storage medium and computer program product for determining hyper-parameters
CN114860111B (en) Touch track updating method and device, electronic equipment and storage medium
CN112639713A (en) Local note selection method and device, electronic terminal and readable storage medium
CN115439894B (en) Method, electronic device, program product, and medium for training fingerprint matching model
WO2024098742A1 (en) Image processing method, apparatus, electronic device, and storage medium
CN115223028A (en) Scene reconstruction and model training method, device, equipment, medium and program product
CN114299612A (en) Gesture detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination