Movatterモバイル変換


[0]ホーム

URL:


CN115100321B - Shape recognition and correction method, device and storage medium based on hand-drawn track - Google Patents

Shape recognition and correction method, device and storage medium based on hand-drawn track
Download PDF

Info

Publication number
CN115100321B
CN115100321BCN202210868235.7ACN202210868235ACN115100321BCN 115100321 BCN115100321 BCN 115100321BCN 202210868235 ACN202210868235 ACN 202210868235ACN 115100321 BCN115100321 BCN 115100321B
Authority
CN
China
Prior art keywords
hand
drawn
drawn track
track
point
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.)
Active
Application number
CN202210868235.7A
Other languages
Chinese (zh)
Other versions
CN115100321A (en
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.)
Hong Yuxing Private LLC
Original Assignee
Hong Yuxing Private LLC
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 Hong Yuxing Private LLCfiledCriticalHong Yuxing Private LLC
Priority to CN202210868235.7ApriorityCriticalpatent/CN115100321B/en
Publication of CN115100321ApublicationCriticalpatent/CN115100321A/en
Application grantedgrantedCritical
Publication of CN115100321BpublicationCriticalpatent/CN115100321B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The invention discloses a shape recognition and correction method, a device, equipment and a storage medium based on a hand-drawn track, which comprises the following steps: based on a pre-trained neural network model, carrying out large-classification recognition on the obtained hand-drawn track so as to divide the hand-drawn track into one of a closed graph and a non-closed graph; when the hand-drawn track is a closed graph, calculating inflection points existing in the hand-drawn track to determine the specific shape of the hand-drawn track; when the hand-drawn track is a non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of the characteristic points; and correcting the hand-drawn track according to different specific shapes of the obtained hand-drawn track and according to inflection points or/and characteristic points so as to fit the hand-drawn track with a standard graph. The method and the device can improve the accuracy of identifying the geometric figure of the hand painting, and can identify the category of the figure drawn by the user rapidly and accurately and correct the figure.

Description

Shape recognition and correction method, device and storage medium based on hand-drawn track
Technical Field
The present invention relates to the field of pattern recognition technologies, and in particular, to a method, an apparatus, and a storage medium for shape recognition and correction based on a hand-drawn track.
Background
Currently, many drawing tools directly employ regular primitive inputs, such as Microsoft Office, visio, and most CAD systems, and the manner in which a user is required to select a predefined standard graphic from a large number of menus and buttons while drawing also suffers from the following disadvantages:
1) The input is inconvenient. When a user finds that the user draws the required graph, the user often clicks a mouse for selection for multiple times, and particularly when a plurality of predefined graphs or objects exist, the user can hardly remember where to select the required graph. For example microsoft has a predefined combination of graphics for the user to choose from, and a complex interface is difficult for the user to feel comfortable.
2) The input is unnatural. Some applications, such as solution design, require users to quickly record their design ideas at any time and place, rather than being constrained by a certain detail, as opposed to traditional applications that target the final design. In these systems, the process of selecting the predefined standard object tends to interrupt the user's mind, thereby impeding the user from smoothly and fluently embodying his design concept.
3) Is not suitable for small-screen palm devices. This type of input is not practical for small screen palm devices that have only a pen input interface. Because a large number of menus and buttons can put the otherwise crowded screen more tension, squeezing the area of use for the user.
With the continuous update of hardware devices, such as handwriting boards, the interactive sketch design based on the hardware devices is gradually becoming a new way for designers to perform the sketch design. However, the freeness of inputting the hand sketch is large, the input intention is related to various characteristics such as field background, thinking mode, hand sketch habit, preference and the like, the hand sketch process is also influenced by various environmental factors such as graphic structures, equipment characteristics and the like, and the structure and the internal association of the hand sketch of a user have strong subjectivity. This presents great difficulty for hand-drawn recognition.
It follows that there is still much room for improvement in recognition and correction of hand-drawn based geometries.
Disclosure of Invention
In view of the above technical problems, the invention provides a shape recognition and correction method, device and storage medium based on a hand-drawn track, so as to provide a scheme capable of rapidly and accurately recognizing an input hand-drawn sketch.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to an aspect of the present invention, a shape recognition and correction method based on a hand-drawn track is provided, which is characterized in that the method includes: based on a pre-trained neural network model, performing large-classification recognition on the obtained hand-drawn track, so that the hand-drawn track is divided into one of a closed graph and a non-closed graph; calculating inflection points existing in the hand-drawn track when the hand-drawn track is the closed graph so as to determine the specific shape of the hand-drawn track; when the hand-drawn track is the non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of characteristic points; and correcting the hand-drawn track according to the obtained specific shapes of the hand-drawn tracks and the inflection points or/and the characteristic points so as to fit the hand-drawn track with a standard graph.
Further, the closed graph at least comprises one of a circle, a polygon, a five-pointed star, a heart and a cloud, and the non-closed graph at least comprises one of a straight line, a parabola, a straight line with an arrow and a curve with an arrow.
Further, when the hand-drawn track is one of a circle, a polygon, a five-pointed star, a heart, and a cloud, the calculating the inflection point existing in the hand-drawn track to determine the specific shape of the hand-drawn track specifically includes the following steps S201 to S204:
Step S201: connecting a first straight line segment between the head point and the tail point of any selected line of the hand-drawn track, wherein the first straight line segment is a string of the selected line;
Step S202: obtaining a point with the largest distance from the first straight line segment on the selected line, and calculating the distance between the point and the first straight line segment;
Step S203: comparing the distance with a preset first threshold value, if the distance is smaller than the first threshold value, the first straight line segment is used as an approximate segment of the selected line, connection points of a plurality of approximate segments are inflection points, and the specific shape of the hand-drawn track is determined according to the number of the inflection points;
Step S204: if the distance is greater than the first threshold, selecting a point with the largest distance from the first straight line section on the selected line as a splitting point, splitting the selected line into two sections, and executing steps S201-S203 on the two sections of selected line respectively.
Further, when the hand-drawn track is one of a straight line, a parabolic line, a straight line with an arrow, and a curve with an arrow, the calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of feature points, and determining the specific shape of the hand-drawn track according to the number of feature points specifically includes:
Setting the coordinates of each point on the hand-drawn track as (x1,y1),(x2,y2),(x3,y3),...,(xn,yn);
By calculation formulaObtaining the curvature as cur, wherein:
temp=(a*a+b*b-c*c)/(2*a*b);
a. b and c are three adjacent points, x1 to x3 are x-axis coordinates of a, b and c, and y1 to y3 are y-axis coordinates of a, b and c;
Calculating the difference in curvature: dcur [ n ] = cur [ n+1] -cur [ n ];
Since dcur [ n ] dcur [ n+1] <0and cur [ n ] threshold;
n is the position of the feature point, and threshold is an adjustable second threshold;
And obtaining the specific shape of the hand-drawn track according to the number of the characteristic points.
Further, the correcting the hand-drawn track to fit the hand-drawn track to a standard graph specifically includes: when the specific shape of the hand-drawn track is a straight line, connecting the head point and the tail point of the hand-drawn track to generate a new straight line; when the specific shape of the hand-drawn track is parabolic, connecting the first point and the last point of the hand-drawn track into a second straight line segment, setting the point farthest from the second straight line segment in the hand-drawn track as the vertex of the parabola, splitting the hand-drawn track into two segments from the vertex, and smoothly connecting the two segments of the hand-drawn track by using a three-time Bezier curve respectively to generate a new parabola; when a specific track of the hand-drawn track is a circle, selecting a center point of the hand-drawn track as a circle center, calculating to obtain average distances between each point of the hand-drawn track and the center point, and generating a new circle by taking the average distances as a radius; when the specific shape of the hand-drawn track is elliptical, calculating a major axis and a minor axis according to the auxiliary circumscribed rectangle of the hand-drawn track, and generating a new ellipse according to an ellipse formula; when the specific shape of the hand-drawn track is a polygon, calculating an included angle between connecting lines connected with the same inflection point, determining that the hand-drawn track is one of a triangle, a quadrilateral, a pentagon and a five-pointed star according to the included angle and the quantity of the inflection points, and generating a new shape to replace the original hand-drawn track; when the specific shape of the hand-drawn track is a heart shape or a cloud shape, drawing the heart shape or the cloud shape which is adjacent to each side of the auxiliary external rectangle and is symmetrically arranged in the auxiliary external rectangle of the hand-drawn track.
Further, when the specific shape of the hand-drawn track is a straight line or a parabola and is provided with an arrow, calculating the length of a line segment between a plurality of characteristic points, taking the line segment between two characteristic points with the longest length as a main part of the hand-drawn track, correcting the main part, and replacing the rest part of the hand-drawn track with a preset arrow shape.
Further, when the number of inflection points is three, connecting the three inflection points to an initial triangle, and calculating the included angle of the initial triangle, wherein: if the three included angles are equal to 60 degrees in the first error range, correcting the initial triangle into an equilateral triangle, and calculating the position of a third point of the equilateral triangle according to the positions of two inflection points; if two included angles are equal in a second set error range and the degree difference of the two included angles from the rest included angles exceeds a third threshold value, correcting the initial triangle into an isosceles triangle, taking the two included angles with the equal error in a 10-degree range as two base angles, and calculating the vertex coordinates of the isosceles triangle; if one included angle is equal to 90 degrees in a third error range, correcting the initial triangle into a right triangle;
When the number of the inflection points is four, the four inflection points are combined in pairs to form an initial quadrangle in sequence, and the included angles of the initial quadrangle are calculated, wherein: if the three included angles are equal to 90 degrees in the fourth error range, correcting the initial quadrangle into a rectangle, and calculating the coordinates of the remaining two points according to the position of one side and the length of the adjacent side; if the diagonals of the initial quadrangles are equal in a fifth error range, correcting the initial quadrangles into parallelograms; if the diagonals of the initial quadrangle are equal in the fifth error range and the lengths of the four sides are equal in the sixth error range, correcting the initial quadrangle into a diamond;
When the number of the inflection points is five, sequentially connecting the five inflection points into an initial pentagon, and calculating the included angle of the initial pentagon, wherein: and if four included angles are smaller than 90 degrees, correcting the initial pentagon into a five-pointed star.
Further, the correcting the initial pentagon into a five-pointed star specifically includes: setting the center of the hand-drawn track as a circle center, drawing a circle by taking the average distance from five inflection points to the circle center as a radius, taking the intersection point of the connecting line of one inflection point and the circle center on the circle as a starting point, and carrying out five equal divisions on the circle to obtain five vertexes of the five-pointed star.
According to a second aspect of the present disclosure, there is provided a shape recognition and correction apparatus based on a hand-drawn trajectory, comprising: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to: based on a pre-trained neural network model, performing large-classification recognition on the obtained hand-drawn track, so that the hand-drawn track is divided into one of a closed graph and a non-closed graph; calculating inflection points existing in the hand-drawn track when the hand-drawn track is the closed graph so as to determine the specific shape of the hand-drawn track; when the hand-drawn track is the non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of characteristic points; and correcting the hand-drawn track according to the obtained specific shapes of the hand-drawn tracks and the inflection points or/and the characteristic points so as to fit the hand-drawn track with a standard graph.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium storing a computer program which, when executed by a processor, performs the above-described method of shape recognition and correction based on hand-drawn trajectories.
The technical scheme of the present disclosure has the following beneficial effects:
According to the shape recognition and correction method, device, equipment and storage medium based on the hand-drawn track, the accuracy of recognition of the hand-drawn geometric figure can be improved, and the type of the figure drawn by the user can be recognized and corrected more quickly and accurately. The mobile touch device has high applicability, and is suitable for the conventional drawing tools such as a hand drawing board and the like and the conventional mobile touch device.
Drawings
FIG. 1 is a flow chart of a shape recognition and correction method based on a hand-drawn track in an embodiment of the present disclosure;
FIG. 2 is a flow chart of a method of calculating inflection points of a hand-drawn trajectory in an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating the correction of straight lines in an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of the correction of parabolas in the embodiments of the present description;
FIG. 5 is a schematic diagram illustrating correction of heart shapes in an embodiment of the present disclosure;
FIG. 6 is a schematic diagram illustrating the correction of cloud shape in an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a parabolic arrowed correction in an embodiment of the present disclosure;
FIG. 8 is a graph showing the result of correction of parabolic arrowed lines in the examples of the present specification;
FIG. 9 is a schematic diagram of a shape recognition and correction device based on a hand-drawn track according to an embodiment of the present disclosure;
fig. 10 is a schematic diagram of a terminal device for implementing a shape recognition and correction method based on a hand-drawn track according to an embodiment of the present disclosure;
FIG. 11 is a computer readable storage medium for implementing a method for shape recognition and correction based on hand-drawn trajectories in an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the present disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.
Furthermore, the drawings are only schematic illustrations of the present disclosure. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
As shown in fig. 1, the embodiment of the present disclosure provides a shape recognition and correction method based on a hand-drawn track, where an execution subject of the method may be a terminal device, and the terminal device may be a mobile phone, a tablet computer, a personal computer, or the like. The method specifically comprises the following steps S101 to S103:
in step S101, based on the pre-trained neural network model, large classification recognition is performed on the acquired hand-drawn trajectory such that the hand-drawn trajectory is classified into one of a closed figure and a non-closed figure.
The pre-trained neural network model, namely the recognition model trained by adopting a plurality of geometric samples, can be used for carrying out basic recognition on the hand-drawn track. The hand-drawn track may be drawing information generated from a drawing device such as a hand-drawn board, a touch screen, or the like. Closed figures refer to lines of a hand-drawn trace that are closed, such as circles, polygons, and the like. Non-closed graphics refer to non-closed lines of a hand-drawn trace, such as straight lines, curved lines, and the like.
In step S102, when the hand-drawn track is the closed figure, calculating an inflection point existing in the hand-drawn track to determine a specific shape of the hand-drawn track; and when the hand-drawn track is the non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of characteristic points.
The neural network model identifies the basic category of the hand-drawn track, such as circles, polygons, pentagram, hearts, clouds and the like in the closed graph, or straight lines, parabolas, straight lines with arrows, curves with arrows and the like in the non-closed graph, so that a specific shape of the hand-drawn track, such as triangles, quadrilaterals, pentagons and the like in the polygons, needs to be obtained through calculation, and in the specific shape, the triangles are identified as isosceles triangles, equilateral triangles, right-angled triangles, common triangles, quadrilaterals are identified as rectangles, diamonds, parallelograms and the like. And the identification of the specific shape can be obtained by calculating the number of inflection points or the curvature value.
In step S103, according to the obtained specific shape of the hand-drawn track and according to the inflection point or/and the feature point, correcting the hand-drawn track so as to fit the hand-drawn track to a standard graph.
After the specific shape of the hand rail track is obtained, only the definition of the hand drawing track is realized, and the hand drawing track is required to be corrected when the hand rail track is applied to drawing, so that the obtained graph is more exquisite and neat.
In one embodiment, as shown in fig. 2, when the hand-drawn track is one of a circle, a polygon, a five-pointed star, a heart, and a cloud, step S102 specifically executes the following steps S201 to S204:
Step S201: a first straight line segment AB is connected between the first and second points A, B of any selected line of the hand-drawn track, and the first straight line segment AB is a chord of the selected line.
The line segment of the whole hand-drawn track is a curve due to the characteristic of hand-drawing, so that the selected line is generally a curve with a certain radian.
Step S202: and obtaining a point C with the largest distance from the first straight line segment AB on the selected line, and calculating the distance d between C and the first straight line segment AB.
Step S203: comparing the distance d with a preset first threshold value, if the distance d is smaller than the first threshold value, using the first straight line segment AB as an approximate segment of the selected line, calculating to obtain a plurality of approximate segments, using connection points of the approximate segments as inflection points, and determining the specific shape of the hand-drawn track according to the number of the inflection points.
Step S204: if the distance is greater than the first threshold, selecting a point C with the largest distance from the first straight line segment on the selected line as a splitting point, splitting the selected line into two sections of AC and BC, and continuously executing steps S201-S203 on the two sections of AC and BC respectively.
In one embodiment, when the hand-drawn track is one of a straight line, a parabolic line, a straight line with an arrow, and a curve with an arrow, the step S102 specifically includes the following calculation method:
Setting the coordinates of each point on the hand-drawn track as (x1,y1),(x2,y2),(x3,y3),...,(xn,yn);
By calculation formulaObtaining the curvature as cur, wherein:
temp=(a*a+b*b-c*c)/(2*a*b);
a. b and c are three adjacent points, x1 to x3 are x-axis coordinates of a, b and c, and y1 to y3 are y-axis coordinates of a, b and c;
Calculating the difference in curvature: dcur [ n ] = cur [ n+1] -cur [ n ];
Since dcur [ n ] dcur [ n+1] <0and cur [ n ] threshold;
n is the position of the feature point, threshold is an adjustable second threshold, threshold can be adjusted according to specific requirements, and the smaller the value, the more feature points are found.
And obtaining the specific shape of the hand-drawn track according to the number of the characteristic points.
In an embodiment, after the specific shape pointed by the foregoing embodiment is obtained, the hand-drawn track needs to be corrected according to the type of the specific shape, so that the hand-drawn track is fitted to the standard graph, and the specific correction method includes:
As shown in fig. 3, when the specific shape of the hand-drawn track is a straight line, the head and tail points of the hand-drawn track are connected to generate a new straight line. Wherein the dotted line is a hand-drawn track, and the solid line is a corrected straight line.
As shown in fig. 4, when the specific shape of the hand-drawn track is parabolic, connecting the first and the last points of the hand-drawn track into a second straight line segment, setting the point farthest from the second straight line segment in the hand-drawn track as the vertex of the parabola, splitting the hand-drawn track into two segments from the vertex, and smoothly connecting the two segments of the hand-drawn track by using three bezier curves respectively to generate a new parabola.
When a specific track of the hand-drawn track is a circle, selecting a center point of the hand-drawn track as a circle center, calculating to obtain average distances between each point of the hand-drawn track and the center point, and generating a new circle by taking the average distances as a radius;
when the specific shape of the hand-drawn track is elliptical, calculating a major axis and a minor axis according to the auxiliary circumscribed rectangle of the hand-drawn track, and generating a new ellipse according to an ellipse formula;
When the specific shape of the hand-drawn track is a polygon, calculating an included angle between connecting lines connected with the same inflection point, determining that the hand-drawn track is one of a triangle, a quadrilateral, a pentagon and a five-pointed star according to the included angle and the quantity of the inflection points, and generating a new shape to replace the original hand-drawn track;
when the specific shape of the hand-drawn track is a heart shape or a cloud shape, drawing the heart shape or the cloud shape which is adjacent to each side of the auxiliary external rectangle and is symmetrically arranged in the auxiliary external rectangle of the hand-drawn track.
When the specific shape of the hand-drawn track is a heart shape, as shown in fig. 5, the auxiliary circumscribed rectangle of the heart shape has a length H and a width W, the upper half of the heart shape is connected by two semicircles, and a radius r=w/4. The center point of the graph is taken as the center point, and the point closest to the center point in all points of the drawing points is regarded as the concave point of the heart shape, namely the midpoint of O1 and O2. And respectively searching one tenth of the total points of the graph from the inner concave points serving as starting points to the two sides, and respectively connecting the inner concave points to calculate vector bisectors of the two lines, wherein the angle of the bisectors is the orientation position of the heart shape. The lower half is computationally connected with the formula u (x) = -3*r (sqrt (1-sqrt ((abs (x))/(2*r))).
When the specific shape of the hand-drawn track is a cloud shape, as shown in fig. 6, the center point of the hand-drawn track graph is used as the center of a circle, and the length and the width of the minimum auxiliary circumscribed rectangle are used as the length and the width of the cloud. Four arcs on the left and right sides respectively,The central angle is 120 degrees; the central angle is 180 degrees; The central angle is 120 degrees; The central angle is 90 degrees. The upper and lower sides are respectively connected by n circular arcs with 90-degree central angles, and rn=r4. Thus, the original hand-drawn track can be corrected under the condition of not damaging the drawing habit and rule of the original hand-drawn track.
In one embodiment, when the number of inflection points is three, three inflection points are connected to form an initial triangle, and the included angle of the initial triangle is calculated, wherein:
If the three included angles are equal to 60 degrees in the first error range, correcting the initial triangle into an equilateral triangle, and calculating the position of a third point of the equilateral triangle according to the positions of two inflection points;
If two included angles are equal in a second set error range and the degree difference of the two included angles from the rest included angles exceeds a third threshold value, correcting the initial triangle into an isosceles triangle, taking the two included angles with the equal error in a 10-degree range as two base angles, and calculating the vertex coordinates of the isosceles triangle;
If one included angle is equal to 90 degrees in a third error range, correcting the initial triangle into a right triangle;
when the number of the inflection points is four, the four inflection points are combined in pairs to form an initial quadrangle in sequence, and the included angles of the initial quadrangle are calculated, wherein:
if the three included angles are equal to 90 degrees in the fourth error range, correcting the initial quadrangle into a rectangle, and calculating the coordinates of the remaining two points according to the position of one side and the length of the adjacent side;
if the diagonals of the initial quadrangles are equal in a fifth error range, correcting the initial quadrangles into parallelograms;
If the diagonals of the initial quadrangle are equal in the fifth error range and the lengths of the four sides are equal in the sixth error range, correcting the initial quadrangle into a diamond;
when the number of the inflection points is five, sequentially connecting the five inflection points into an initial pentagon, and calculating the included angle of the initial pentagon, wherein:
And if four included angles are smaller than 90 degrees, correcting the initial pentagon into a five-pointed star.
Additionally, the correcting the initial pentagon into a five-pointed star specifically includes:
setting the center of the hand-drawn track as a circle center, drawing a circle by taking the average distance from five inflection points to the circle center as a radius, taking the intersection point of the connecting line of one inflection point and the circle center on the circle as a starting point, and carrying out five equal divisions on the circle to obtain five vertexes of the five-pointed star. And the correction of the common pentagon is sequentially connected with five points. In addition, five points of the five-pointed star are sequentially connected after the coordinates of five points of the concave are calculated, and the five-pointed star can be calculated by the characteristics of the five-pointed star.
In an embodiment, when the specific shape of the hand-drawn track is a straight line or a parabolic line and has an arrow, calculating the length of a line segment between a plurality of the feature points, taking the line segment between two feature points with the longest length as a trunk part of the hand-drawn track, correcting the trunk part, and replacing the rest part of the hand-drawn track with a preset arrow shape.
Wherein, as the arrow segments have a plurality of irregular folding lines, in order to correct the degree of fit, it is therefore necessary to calculate the trunk position of the hand-drawn trace pattern and the position of the arrow drawing. At this time, parameters such as the length of each irregular line segment are required to be calculated to search the trunk and the arrow. The straight line with arrow trunk correction and straight line correction are the same, and the curved line with arrow trunk correction and parabolic correction are the same.
As shown in fig. 7, the characteristic points P1, P2, P3 are found according to the curvature method described above, and the length of each curve is calculated:
d1 The longest section is the part of the curve, the rest part is replaced by an arrow part, and the correction result is shown in fig. 8.
Based on the same concept, the exemplary embodiment of the present disclosure further provides a shape recognition and correction device based on a hand-drawn track, as shown in fig. 9, the shape recognition and correction device 900 based on the hand-drawn track includes: the recognition module 1001 performs large-classification recognition on the obtained hand-drawn track based on the pre-trained neural network model, so that the hand-drawn track is divided into one of a closed graph and a non-closed graph; a calculation module 1002 that calculates inflection points that exist in the hand-drawn trajectory to determine a specific shape of the hand-drawn trajectory when the hand-drawn trajectory is the closed figure; when the hand-drawn track is the non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of characteristic points; and a correction module 1003, configured to correct the hand-drawn track according to the obtained specific shape of the hand-drawn track and according to the inflection point or/and the feature point, so as to fit the hand-drawn track to a standard graph.
By adopting the shape recognition and correction device based on the hand-drawn track, the accuracy of the recognition of the hand-drawn geometric figure can be improved, and the type of the figure drawn by the user can be recognized and corrected more quickly and accurately.
The specific details of each module/unit in the above apparatus are already described in the method section embodiments, and the details not disclosed may refer to the method section embodiments, so that they will not be described in detail.
Based on the same thought, the embodiment of the present disclosure further provides a shape recognition and correction device based on the hand-drawn track, as shown in fig. 10.
The shape recognition and correction device based on the hand-drawn track may be a terminal device or a server provided in the above embodiments.
The shape recognition and correction device based on the hand-drawn trajectory may vary widely due to configuration or performance, may include one or more processors 1001 and memory 1002, and may have one or more stored applications or data stored in memory 1002. The memory 1002 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) units and/or cache memory units, and may further include read only memory units. The application programs stored in memory 1002 may include one or more program modules (not shown), including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Still further, the processor 1001 may be configured to execute a series of computer executable instructions in the memory 1002 on a shape recognition and correction device based on the hand-drawn trajectory. The shape recognition and correction device based on the hand-drawn track may also include one or more power supplies 1003, one or more wired or wireless network interfaces 1004, one or more I/O interfaces (input output interfaces) 1005, one or more external devices 1006 (e.g., keyboard, hand-drawn pad, bluetooth device, etc.), one or more devices that enable a user to interact with the device, and/or any devices (e.g., routers, modems, etc.) that enable the device to communicate with one or more other computing devices. Such communication may occur through the I/O interface 1005. Also, the device can communicate with one or more networks (e.g., a Local Area Network (LAN)) via a wired or wireless interface 1004.
In particular, in this embodiment, the shape recognition and correction device based on the hand-drawn trajectory includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the shape recognition and correction device based on the hand-drawn trajectory, and configured to be executed by the one or more processors, the one or more programs including computer-executable instructions for:
Based on a pre-trained neural network model, performing large-classification recognition on the obtained hand-drawn track, so that the hand-drawn track is divided into one of a closed graph and a non-closed graph; calculating inflection points existing in the hand-drawn track when the hand-drawn track is the closed graph so as to determine the specific shape of the hand-drawn track; when the hand-drawn track is the non-closed graph, calculating the curvature between every three adjacent data points of the hand-drawn track to obtain the number of characteristic points, and determining the specific shape of the hand-drawn track according to the number of characteristic points; and correcting the hand-drawn track according to the obtained specific shapes of the hand-drawn tracks and the inflection points or/and the characteristic points so as to fit the hand-drawn track with a standard graph.
Based on the same idea, exemplary embodiments of the present disclosure further provide a computer readable storage medium having stored thereon a program product capable of implementing the method described in the present specification. In some possible implementations, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to carry out the steps according to the various exemplary embodiments of the disclosure as described in the "exemplary methods" section of this specification, when the program product is run on the terminal device.
Referring to fig. 11, a program product 1100 for implementing the above-described method according to an exemplary embodiment of the present disclosure is described, which may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the exemplary embodiments of the present disclosure.
Furthermore, the above-described figures are only schematic illustrations of processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (8)

when the hand-drawn track is the closed graph, calculating inflection points existing in the hand-drawn track to determine a specific shape of the hand-drawn track, and executing steps S201-S204 during calculation: step S201: connecting a first straight line segment between the head point and the tail point of any selected line of the hand-drawn track, wherein the first straight line segment is a string of the selected line; step S202: obtaining a point with the largest distance from the first straight line segment on the selected line, and calculating the distance between the point and the first straight line segment; step S203: comparing the distance with a preset first threshold value, if the distance is smaller than the first threshold value, the first straight line segment is used as an approximate segment of the selected line, connection points of a plurality of approximate segments are inflection points, and the specific shape of the hand-drawn track is determined according to the number of the inflection points; step S204: if the distance is greater than the first threshold value, selecting a point with the largest distance from the first straight line section on the selected line as a splitting point, splitting the selected line into two sections, and executing steps S201-S203 on the two sections of selected line respectively;
CN202210868235.7A2022-07-222022-07-22Shape recognition and correction method, device and storage medium based on hand-drawn trackActiveCN115100321B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210868235.7ACN115100321B (en)2022-07-222022-07-22Shape recognition and correction method, device and storage medium based on hand-drawn track

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210868235.7ACN115100321B (en)2022-07-222022-07-22Shape recognition and correction method, device and storage medium based on hand-drawn track

Publications (2)

Publication NumberPublication Date
CN115100321A CN115100321A (en)2022-09-23
CN115100321Btrue CN115100321B (en)2024-08-02

Family

ID=83298296

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210868235.7AActiveCN115100321B (en)2022-07-222022-07-22Shape recognition and correction method, device and storage medium based on hand-drawn track

Country Status (1)

CountryLink
CN (1)CN115100321B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN116300908A (en)*2023-02-162023-06-23北京石头创新科技有限公司 Method, device and equipment for generating task area in cleaning map
CN116309942B (en)*2023-05-112024-01-19北京元跃科技有限公司Method and system for correcting graphic shape of mobile equipment
CN119379982B (en)*2024-12-262025-03-21深圳市正通仁禾科技有限公司 A method, system, product and medium for shape recognition and correction of hand-drawn trajectory
CN119691876B (en)*2025-02-212025-05-27上海建工四建集团有限公司Section drawing method and system based on computer vision

Citations (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113763505A (en)*2021-04-272021-12-07腾讯科技(深圳)有限公司 Graphical generation method, apparatus, computer equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104424473A (en)*2013-09-062015-03-18北京三星通信技术研究有限公司Method and device for identifying and editing freehand sketch
CN109671133A (en)*2018-12-122019-04-23成都四方伟业软件股份有限公司Generation method, device, electronic equipment and the storage medium of track
CN110069204B (en)*2019-04-152021-12-03广州视源电子科技股份有限公司Graph processing method, device and equipment based on writing track and storage medium
CN111625179B (en)*2020-06-022021-11-16京东方科技集团股份有限公司Graph drawing method, electronic device, and computer storage medium
CN113888546B (en)*2021-09-012025-01-24浙江大华技术股份有限公司 Hand-drawn graphics regularization method, electronic device and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN113763505A (en)*2021-04-272021-12-07腾讯科技(深圳)有限公司 Graphical generation method, apparatus, computer equipment and storage medium

Also Published As

Publication numberPublication date
CN115100321A (en)2022-09-23

Similar Documents

PublicationPublication DateTitle
CN115100321B (en)Shape recognition and correction method, device and storage medium based on hand-drawn track
US10664695B2 (en)System and method for managing digital ink typesetting
RU2372654C2 (en)System and method for recognising shape of hand-written objects
JP7388645B2 (en) Method and corresponding device for selecting graphic objects
KR20170030613A (en) Touch classification
US11474627B2 (en)Method, apparatus and device for erasing handwriting on electronic whiteboard
JP6807840B2 (en) Systems and methods for recognizing geometry
EP3387582B1 (en)System and method for beautifying digital ink
Hse et al.Recognition and beautification of multi-stroke symbols in digital ink
CN113095421B (en)Method for generating font database, training method and device for neural network model
US10733710B2 (en)System and method for drawing beautification
Fišer et al.Advanced drawing beautification with shipshape
WO2008106614A2 (en)Radical set determination for hmm based eastern asian character recognition
US12354392B2 (en)Gesture stroke recognition in touch-based user interface input
CN115601769A (en)Method and device for adjusting hand-drawn graph, electronic equipment and medium
Costagliola et al.Recognition and autocompletion of partially drawn symbols by using polar histograms as spatial relation descriptors
CN108898631B (en)Interest area selection method, device, equipment and storage medium
StahovichPen-based interfaces for engineering and education
CN112949298B (en) Word segmentation method, apparatus, electronic device and readable storage medium
JP3221488B2 (en) Online character recognition device with verification function
WO2024110354A1 (en)Setting font size in an unconstrained canvas
De RosaOn the auto-completion of hand drawn symbols
JP3209595B2 (en) Fuzzy arc model generation method and apparatus
EP4627433A1 (en)Selecting handwritten objects
CN117727050A (en)Handwritten text evaluation method, handwritten text evaluation device, computer equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp