Shape recognition and correction method and system for hand-drawn track, product and medium

By identifying and generating auxiliary lines, and extraction and display deviation vectors and adjustment directions when necessary, the problem of difficulty providing local adjustment and guidance in existing technologies, improving the identification accuracy and drawing efficiency of hand -drawn trajectory.

CN119379982AActive Publication Date: 2025-01-28SHENZHEN ZHENGTONG RENHE TECH CO LTD

Patent Information

Application Number
CN202411930903.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-01-28
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The prior art is difficult to provide timely guidance on the user's local adjustment needs during the drawing process in hand-drawn trajectory recognition and assisted drawing, resulting in inefficiency of users in pursuing detailed accuracy.

Method used

By collecting the user's hand -drawn trajectory data, the basic shape recognition and auxiliary line generation shows the corresponding auxiliary line to guide the user to draw. When a specific situation is detected, the trajectory data is featured and processed, the deviation vector and the adjustment direction are displayed and displayed to help users make precise adjustments.

Benefits of technology

It improves the normality and accuracy of users when drawing graphics, improved the drawing efficiency, and provides more accurate reference information to guide the drawing of the user.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379982A_ABST
    Figure CN119379982A_ABST
Patent Text Reader

Abstract

The invention discloses a shape recognition and correction method and system for a hand-drawn track, a product and a medium, and relates to the field of image recognition, and the method comprises the steps: carrying out the basic shape recognition of first hand-drawn track data at preset time intervals, generating basic shape data, generating corresponding auxiliary line data according to the basic shape data, and carrying out the correction of the shape of the hand-drawn track; and displaying the auxiliary line data according to a preset display rule, and when it is detected that the drawing speed of the second hand-drawing track data is lower than a preset speed threshold value or a detail analysis trigger gesture of a user is received, performing curve fitting on the hand-drawing segment data to obtain an optimal curve path. Generating a deviation vector and an adjustment direction of each control point in the second hand-drawn track based on the second hand-drawn track data and the optimal curve path; and displaying the deviation vector and the adjustment direction according to a preset display rule. By implementing the method, more accurate reference information can be provided for a user using the digital panel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition, and in particular to a method, system, product and medium for shape recognition and correction of hand-drawn trajectories. Background Art

[0002] With the development of digital technology, digital tablets are widely used in engineering drawing, product design, architectural design and other fields. In these fields, designers need to draw standardized and standard graphics on digital tablets, which puts forward high requirements on the accuracy and standardization of hand-drawing.

[0003] In the related art, real-time recognition and assistance are used to help users draw standard graphics. Such software usually analyzes the user's hand-drawn trajectory in real time, and when it is recognized that the user is drawing a certain basic graphic, the corresponding standard graphic will be immediately displayed for the user's reference.

[0004] However, since the software can only recognize and assist in the overall shape, it cannot provide timely guidance for the user's local adjustment needs during the drawing process. When the user needs to make fine adjustments to some local details of the graphics, it cannot provide sufficiently accurate reference information, causing the user to have to try repeatedly in pursuit of detail accuracy, reducing drawing efficiency. Summary of the invention

[0005] The present application provides a method, system, product and medium for shape recognition and correction of a hand-drawn trajectory, which are used to provide more accurate reference information for users using a digital tablet.

[0006] In a first aspect, the present application provides a shape recognition and correction method based on hand-drawn trajectories, which is applied to a shape recognition and correction system, the method comprising: upon receiving an auxiliary instruction, collecting first hand-drawn trajectory data of a user on a digital tablet; performing basic shape recognition on the first hand-drawn trajectory data at preset time intervals to generate basic shape data, the basic shape data including a shape type and shape parameters; generating corresponding auxiliary line data based on the basic shape data, and displaying the auxiliary line data according to preset display rules, the auxiliary line shape in the auxiliary line data being consistent with the shape type; when it is detected that the drawing speed of the second hand-drawn trajectory data is lower than a preset speed threshold or a detail analysis trigger gesture of the user is received, performing feature point extraction and segmentation processing on the second hand-drawn trajectory data to obtain hand-drawn segmented data of sub-segment feature parameters; performing curve fitting on the hand-drawn segmented data to obtain an optimal curve path, and generating a deviation vector and an adjustment direction for each control point in the second hand-drawn trajectory based on the second hand-drawn trajectory data and the optimal curve path; and displaying the deviation vector and the adjustment direction according to the preset display rules.

[0007] By adopting the above technical solution, the hand-drawn trajectory data is first collected after receiving the auxiliary instruction, and then the basic shape recognition is performed and the auxiliary line data is generated, so that the user can see the reference of the standard shape in time during the drawing process to guide the drawing direction. When a specific situation is detected, the trajectory data is feature extracted and processed, and the deviation vector and adjustment direction are obtained and displayed, so that the user can clearly understand the difference between his drawing and the optimal path, so as to make precise adjustments, which effectively improves the standardization and accuracy of the user's drawing and improves the drawing efficiency.

[0008] In combination with some embodiments of the first aspect, in some embodiments, the step of performing basic shape recognition on the first hand-drawn trajectory data at every preset time interval to generate basic shape data specifically includes: performing data smoothing processing on the first hand-drawn trajectory data at every preset time interval to obtain a smoothed trajectory point sequence; calculating a direction angle sequence between adjacent trajectory points based on the trajectory point sequence; identifying the inflection point position in the first hand-drawn trajectory data based on the direction angle sequence, and dividing the first hand-drawn trajectory data into multiple trajectory segments based on the inflection point position; analyzing the shape features of each of the trajectory segments to obtain the radian parameter and length parameter of each of the trajectory segments; determining the shape type corresponding to the first hand-drawn trajectory data according to the combination relationship between the radian parameter and the length parameter of each of the trajectory segments; calculating the shape parameters based on the trajectory point sequence to obtain the basic shape data corresponding to the shape type.

[0009] By adopting the above technical solution, the first hand-drawn trajectory data is smoothed at preset time intervals, thereby reducing noise and jitter in the data. The direction angle sequence is calculated based on the processed trajectory point sequence, which can better grasp the trend of the trajectory. By identifying the turning point position, the data is divided into multiple trajectory segments, which is convenient for analyzing different parts separately. The shape features of each trajectory segment are analyzed and the shape type is determined, and the shape parameters are calculated, thereby improving the accuracy of shape recognition and the effect of auxiliary drawing.

[0010] In combination with some embodiments of the first aspect, in some embodiments, the step of generating corresponding auxiliary line data based on the basic shape data, wherein the basic shape data includes a shape type and shape parameters, specifically includes: determining the corresponding auxiliary line generation rule based on the shape type in the basic shape data; selecting a shape template matching the shape type from a preset shape template based on the auxiliary line generation rule; substituting the shape parameters in the basic shape data into the shape template to generate an auxiliary line contour of a standard shape; generating a guide arrow including a drawing direction at a preset distance position of the auxiliary line contour; and adjusting the display length of the auxiliary line contour and the display position of the guide arrow in real time according to the drawing progress of the first hand-drawn trajectory data to obtain the auxiliary line data.

[0011] By adopting the above technical scheme, the auxiliary line generation rules are determined according to the shape type in the basic shape data, which ensures that the auxiliary lines match the recognized shapes, selects a suitable template from the preset shape template, and substitutes the shape parameters into the template to generate the auxiliary line contour, which ensures that the auxiliary lines can accurately reflect the standard shape, generates guide arrows at the preset distance position of the contour, provides users with clear drawing direction instructions, and adjusts the display of auxiliary line contours and arrows in real time according to the drawing progress, which improves the convenience and accuracy of user drawing.

[0012] In combination with some embodiments of the first aspect, in some embodiments, the step of performing curve fitting on the hand-drawn segmented data to obtain an optimal curve path, and generating a deviation vector and adjustment direction for each control point in the second hand-drawn trajectory based on the second hand-drawn trajectory data and the optimal curve path, specifically includes: performing cluster analysis according to the sub-segment feature parameters in the hand-drawn segmented data to obtain similar trajectory sub-segments with similar features; selecting a corresponding curve fitting algorithm according to the feature parameters of the similar trajectory sub-segments, and performing curve fitting on each of the similar trajectory sub-segments according to the curve fitting algorithm to obtain a hand-drawn trajectory fitting curve; connecting the hand-drawn trajectory fitting curves between each of the similar trajectory sub-segments to generate the optimal curve path; calculating the vertical deviation distance of each control point in the second hand-drawn trajectory relative to the optimal curve based on the optimal curve path to generate a deviation vector; and determining the adjustment direction of each control point according to the direction of the deviation vector.

[0013] By adopting the above technical solution, cluster analysis is performed according to the sub-segment feature parameters in the hand-drawn segmentation data, so that trajectory sub-segments with similar features can be classified, and the corresponding curve fitting algorithm is selected according to the feature parameters of the similar trajectory sub-segments, thereby improving the accuracy and adaptability of the fitting. By performing curve fitting on each similar trajectory sub-segment and connecting them to obtain the optimal curve path, the trajectory actually drawn by the user can be more accurately approximated. Based on this, the deviation vector and adjustment direction are calculated, allowing the user to clearly understand the adjustment direction and degree of each control point, further improving the accuracy and standardization of the drawn graphics.

[0014] In combination with some embodiments of the first aspect, in some embodiments, after the step of displaying the deviation vector and the adjustment direction according to the preset display rule, the method also includes: obtaining a reference graphic imported by the user; calculating the shape feature similarity between each reference area in the reference graphic and the second hand-drawn trajectory data; screening out reference areas whose shape feature similarity exceeds a first preset similarity threshold as reference trajectory data; decomposing the reference trajectory data into multiple reference trajectory segments according to the drawing direction, and extracting feature parameters for each reference trajectory segment; performing similarity matching on the sub-segment feature parameters in the hand-drawn segmented data of the second hand-drawn trajectory data with the feature parameters of the reference trajectory segment to obtain matching similarity; when there is a target trajectory segment whose matching similarity exceeds the second preset similarity threshold, generating a target curve path and a target deviation vector based on the target trajectory segment; generating auxiliary prompt information based on the target curve path and the target deviation vector, the auxiliary prompt information including the standard contour line, key control point position and recommended drawing direction of the reference trajectory segment.

[0015] By adopting the above technical solution, the reference graphic imported by the user is obtained and the shape feature similarity between it and the second hand-drawn trajectory data is calculated. It is possible to introduce external standards for comparison, screen out reference areas with high similarity as reference trajectory data, decompose the reference trajectory data into multiple segments and extract feature parameters, and perform similarity matching with the hand-drawn segmented data to find the part that is most similar to the user's drawn trajectory. When there is a target trajectory segment with high similarity, the target curve path and deviation vector are generated, and auxiliary prompt information is provided, including standard contour lines, key control point locations, and recommended drawing directions, to help users better understand and correct their own drawings, thereby improving the accuracy and efficiency of drawing.

[0016] In combination with some embodiments of the first aspect, in some embodiments, after the step of displaying the deviation vector and the adjustment direction according to the preset display rule, the method also includes: recording the user's multiple modification operations on the second hand-drawn trajectory data to obtain a modification record database; extracting the number of modifications and the modification amplitude of each control point from the modification record database to generate an error frequency distribution graph; based on the error frequency distribution graph, determining the characteristic pattern of the error-prone area, which includes the curvature mutation position, the direction turning point and the midpoint area of ​​the long curve segment.

[0017] By adopting the above technical solution, the user's multiple modification operations on the second hand-drawn trajectory data are recorded and a modification record database is generated. The number of modifications and the modification amplitude of each control point are extracted from the database to generate an error frequency distribution diagram, which can intuitively reflect the error distribution in the user's drawing process. Based on the error frequency distribution diagram, the characteristic patterns of error-prone areas are determined, including the location of curvature mutation, direction turning point and midpoint area of ​​long curve segments, etc., which helps users understand their own drawing habits and places where errors are prone to occur, so as to make targeted improvements.

[0018] In combination with some embodiments of the first aspect, in some embodiments, after the step of determining a characteristic pattern of an error-prone area based on the error frequency distribution diagram, wherein the characteristic pattern includes a curvature mutation location, a direction turning point, and a midpoint area of ​​a long curve segment, the method further includes: when a target area matching the characteristic pattern appears in the second hand-drawn trajectory data, marking the target area as a potential error area; determining a risk level for each of the potential error areas based on statistical results of the error occurrence frequency and the modification amplitude; and generating an auxiliary prompt strategy based on the risk level.

[0019] By adopting the above technical solution, potential error areas are identified and risk levels are determined. An auxiliary prompt strategy is generated based on the risk level. Prompts for high-risk areas are more significant, prompts for medium-risk areas are moderate, and prompts for low-risk areas are simpler. This allows users to understand the risk level of each area more clearly and effectively improve drawing accuracy and efficiency.

[0020] In a second aspect, an embodiment of the present application provides a shape recognition and correction system, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the shape recognition and correction system to perform the method described in the first aspect and any possible implementation method of the first aspect.

[0021] In a third aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when the computer program product is run on a shape recognition and correction system, enables the shape recognition and correction system to perform the method described in the first aspect and any possible implementation method of the first aspect.

[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the instructions are executed on a shape recognition and correction system, the shape recognition and correction system executes the method described in the first aspect and any possible implementation method of the first aspect.

[0023] It can be understood that the shape recognition and correction system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here.

[0024] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. This application first collects hand-drawn trajectory data after receiving auxiliary instructions, and then performs basic shape recognition and generates auxiliary line data, so that users can see the reference of standard shapes in time during the drawing process to guide the drawing direction. When specific situations are detected, the trajectory data is feature extracted and processed to obtain and display the deviation vector and adjustment direction, so that users can clearly understand the difference between their own drawings and the optimal path, and thus make precise adjustments, which effectively improves the standardization and accuracy of user-drawn graphics and improves drawing efficiency.

[0025] 2. This application obtains the reference graphics imported by the user and calculates the similarity of its shape features with the second hand-drawn trajectory data. It can introduce external standards for comparison, screen out reference areas with high similarity as reference trajectory data, decompose the reference trajectory data into multiple segments and extract feature parameters, and perform similarity matching with the hand-drawn segmented data to find the part that is most similar to the user's drawn trajectory. When there are target trajectory segments with high similarity, the target curve path and deviation vector are generated and auxiliary prompt information is provided, including standard contour lines, key control point locations, and recommended drawing directions, to help users better understand and correct their own drawings.

[0026] 3. The present application records the user's multiple modification operations on the second hand-drawn trajectory data and generates a modification record database, extracts the number of modifications and the modification amplitude of each control point from the database to generate an error frequency distribution diagram, which can intuitively reflect the error distribution in the user's drawing process, and determines the characteristic patterns of error-prone areas based on the error frequency distribution diagram, including the location of sudden changes in curvature, turning points in direction, and the midpoint area of ​​long curve segments, etc., which helps users understand their own drawing habits and places where errors are prone to occur, so as to make targeted improvements. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flowchart of a shape recognition and correction method based on hand-drawn trajectories in an embodiment of the present application; Figure 2 is another flowchart of a shape recognition and correction method based on hand-drawn trajectories in an embodiment of the present application; Figure 3 It is another flowchart of the shape recognition and correction method based on hand-drawn trajectory in the embodiment of the present application; Figure 4 It is a schematic diagram of the structure of a physical device of the shape recognition and correction system in the embodiment of the present application. DETAILED DESCRIPTION

[0028] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.

[0029] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0030] For ease of understanding, the following is a description of the process of the method provided by this implementation. Figure 1 , which is a flow chart of a shape recognition and correction method based on hand-drawn trajectories in an embodiment of the present application.

[0031] S101. When receiving an auxiliary instruction, collect first hand-drawn trajectory data of the user on the digital tablet.

[0032] Among them, the auxiliary instruction refers to the input signal for starting the shape recognition and correction function triggered by the user through a specific operation, which can be a keyboard shortcut, a touchpad gesture or a menu option, etc. The digital tablet refers to an input device that can convert the user's handwriting input into a digital signal, including an effective sensing area and a pressure-sensitive pen for capturing the user's drawing actions. The first hand-drawn trajectory data refers to the original data of the user's drawing trajectory collected from the digital tablet, including information such as the two-dimensional coordinates of the sampling point, the pressure value, the tilt angle and the timestamp.

[0033] When the system detects that the user triggers the auxiliary command, the data acquisition function of the tablet is started. Specifically, the system continuously collects the movement data of the pressure-sensitive pen on the tablet at a fixed sampling frequency (usually 100Hz), records the coordinate position (x, y), pressure value p (0-1023), tilt angle α (0-90 degrees) and timestamp t of each sampling point, and organizes these data into a structured data sequence [(x1, y1, p1, α1, t1), (x2, y2, p2, α2, t2), ...] in chronological order as the input for subsequent shape recognition and correction processing.

[0034] In some embodiments, the collection of the first hand-drawn trajectory data can be achieved in the following ways: acquiring the real-time status data of the pressure-sensitive pen by monitoring the USBHID event of the digital tablet device; preprocessing the raw data, including coordinate mapping, pressure value normalization, and outlier filtering; and saving the processed data in the trajectory buffer. Optionally, it can also be achieved in the following ways: starting a dedicated digital tablet driver interface to obtain device data; using a real-time queue to store sampled data, and performing real-time downsampling and data smoothing; establishing a spatiotemporal index structure of sampling points for fast retrieval. It is understandable that other device interfaces or data collection methods can also be used to achieve the acquisition of trajectory data, which is not limited here.

[0035] S102: Perform basic shape recognition on the first hand-drawn trajectory data at every preset time interval to generate basic shape data, where the basic shape data includes shape type and shape parameters.

[0036] Among them, the preset time interval refers to the fixed period of the system for shape recognition, which is usually set to 20-50 milliseconds. Basic shape recognition refers to the process of analyzing the geometric features of hand-drawn trajectories to determine which basic graphic type they belong to. Shape type refers to a class in the predefined set of basic geometric shapes, such as a straight line, a circle, a rectangle, etc. Shape parameters refer to geometric feature parameters used to describe a specific shape, such as position, size, direction and other numerical values. Basic shape data refers to a data structure containing a shape type identifier and corresponding parameter values.

[0037] The system periodically processes the accumulated trajectory data at preset time intervals. Specifically, the trajectory point sequence is first smoothed and denoised, and the geometric feature indicators of the trajectory are calculated, including length, curvature, angle, etc. These features are then matched with the predefined shape template to determine the best matching shape type. Finally, according to the identified shape type, the corresponding shape parameters are calculated, such as the vertex coordinates and rotation angle of the rectangle, the center position and radius of the circle, etc.

[0038] In some embodiments, basic shape recognition can be achieved by: using a sliding window to segment the trajectory data; extracting the feature vector in each window; and using a rule-based shape classifier to make type judgments. Optionally, it can also be achieved by: establishing a deep learning model of shape features; performing real-time reasoning on the input trajectory data; and using the category with the highest probability as the recognition result. It is understandable that other pattern recognition or machine learning methods can also be used to achieve shape recognition and parameter estimation, which are not limited here.

[0039] S103, generating corresponding auxiliary line data according to the basic shape data, and displaying the auxiliary line data according to a preset display rule, wherein the auxiliary line shape in the auxiliary line data is consistent with the shape type.

[0040] Among them, auxiliary line data refers to the visual reference line information used to guide users in drawing, including elements such as contour lines, symmetry axes, and control points. Preset display rules refer to the parameter set that defines the visual effects of auxiliary lines, including attributes such as line type, color, transparency, and animation effects. Auxiliary line shape refers to the geometric shape of the auxiliary line, which needs to be consistent with the recognized shape type. Shape type refers to the category of basic geometric figures, such as straight line, rectangle, circle, ellipse, etc.

[0041] When the system completes shape recognition, it immediately generates the corresponding auxiliary line data based on the recognition results. Specifically, first select the corresponding auxiliary line generation algorithm according to the shape type, and then substitute the parameters in the basic shape data into the algorithm to calculate the geometric trajectory of the auxiliary line. For the rectangular type, generate the contour lines of the four sides and two diagonals; for the circular type, generate the circumferential contour line and orthogonal diameter line; for the ellipse type, generate the ellipse contour line and the major and minor axis lines. The display of auxiliary lines adopts a real-time update mechanism to dynamically adjust the display range and position according to the user's drawing progress. The auxiliary lines use a blue translucent effect (RGB: 0, 120, 255, alpha: 0.6), a line width of 2 pixels, and add marker symbols at key points.

[0042] In some embodiments, the generation and display of auxiliary lines can be achieved in a variety of ways: optionally, the auxiliary line trajectory is calculated using a parameterized curve equation, the curve is discretized into a point sequence, the lines are drawn using OpenGL, real-time animation effects are added, and control points are displayed at key locations; an adaptive display algorithm is implemented to adjust the line density and thickness according to the view zoom level; a layer management mechanism is established to ensure that auxiliary lines are always displayed in the correct position. Optionally, an auxiliary line object is constructed using a vector graphics library, interactive control points and auxiliary markers are defined, smooth animation transition effects are achieved, switching of multiple display styles is supported, and real-time visual feedback is provided. It is understandable that other graphics rendering technologies or visualization methods can also be used to achieve the generation and display of auxiliary lines, which are not limited here.

[0043] S104: When it is detected that the drawing speed of the second hand-drawn trajectory data is lower than a preset speed threshold or a detail analysis trigger gesture of the user is received, feature point extraction and segmentation processing are performed on the second hand-drawn trajectory data to obtain hand-drawn segmentation data of sub-segment feature parameters.

[0044] Among them, the second hand-drawn trajectory data refers to the trajectory data drawn by the user in the detail modification stage, which is used for fine adjustment. The drawing speed refers to the instantaneous speed of the pressure-sensitive pen movement, which is calculated by dividing the distance between adjacent sampling points by the time interval. The preset speed threshold refers to the speed limit value for judging whether the user enters the detail drawing mode, which is usually set to 30 pixels per second. The detail analysis trigger gesture refers to a specific operation in which the user actively activates the detail analysis mode, such as double-finger clicking or holding down a specific key. Feature point extraction refers to the process of identifying key points in the trajectory, including curvature extreme points, speed change points, etc. Segmentation processing refers to the operation of dividing the trajectory into multiple sub-segments according to feature points. Sub-segment feature parameters refer to numerical indicators that describe the geometry and motion characteristics of trajectory segments. Hand-drawn segmented data refers to a set of structured trajectory data after segmentation processing.

[0045] The system continuously monitors the user's drawing behavior and triggers detailed analysis when one of the following two situations is detected: one is that the drawing speed drops below the preset threshold, indicating that the user is making fine adjustments; the other is that the user's explicit trigger gesture is received. Specifically, the instantaneous velocity sequence of the trajectory is first calculated, and the noise is eliminated using a sliding average filter. Then the geometric features of the trajectory are analyzed, and the locations where the curvature changes significantly are detected as feature points, while considering the mutation points of speed and pressure. Based on these feature points, the trajectory is divided into multiple sub-segments, and feature parameters are extracted for each sub-segment, including length, average curvature, direction angle change rate, speed statistical characteristics, etc. Finally, all segmentation information and feature parameters are organized into a structured data set for subsequent fine analysis and processing.

[0046] In some embodiments, the analysis and segmentation of trajectories can be achieved in a variety of ways: Optionally, a multi-scale curvature analysis method is used to detect feature points, adaptively sample the trajectory, calculate local geometric features, build a feature point hierarchy, and achieve robust segmentation processing; a dynamic programming algorithm is applied to optimize the segmentation position to ensure the global optimality of the segmentation results; a feature parameter index is established to support fast similarity queries. Optionally, a feature point detection model based on deep learning is used to extract local features of the trajectory in real time, a clustering algorithm is used for automatic segmentation, the feature vector of each sub-segment is calculated, and the density distribution of the feature space is constructed. It is understandable that other signal processing or pattern recognition methods can also be used to achieve trajectory analysis and segmentation processing, which is not limited here.

[0047] S105 , performing curve fitting on the hand-drawn segmented data to obtain an optimal curve path, and generating a deviation vector and an adjustment direction for each control point in the second hand-drawn trajectory based on the second hand-drawn trajectory data and the optimal curve path.

[0048] Among them, the hand-drawn segmented data refers to the set of trajectory segments after feature point segmentation, including point sequence and feature parameters. Curve fitting refers to the use of mathematical methods to fit discrete trajectory points into a continuous and smooth curve equation. The optimal curve path refers to the continuous curve that can best approximate the original trajectory, expressed by the parametric equation C(u). The second hand-drawn trajectory data refers to the original trajectory point sequence actually drawn by the user. The control point refers to the sampling point on the trajectory, which is used to control the shape of the trajectory. The deviation vector refers to the vertical distance vector from the control point to the optimal curve. The adjustment direction refers to the recommended direction in which the control point should move, which is opposite to the direction of the deviation vector.

[0049] When the system obtains the segmented data, the curve fitting process starts immediately. Specifically, first select an appropriate fitting algorithm for each trajectory segment: use cubic polynomial fitting when the curvature changes gently, use cubic B-spline interpolation when the curvature changes significantly, and use piecewise Bezier curves for cases with cusps. Then solve the fitting parameters using the least squares method or other optimization methods to obtain a continuous curve equation. Then smoothly connect the fitting curves of adjacent segments using Hermite interpolation to ensure the continuity and smoothness of the overall curve. Finally, calculate the shortest distance from each control point to the optimal curve to obtain the deviation vector Vi=(dxi, dyi), and calculate the normalized adjustment direction Di=-Vi / |Vi| based on the deviation vector.

[0050] In some embodiments, curve fitting and deviation calculation can be implemented in a variety of ways: Optionally, an adaptive segmented fitting algorithm is used to dynamically adjust fitting parameters, calculate fitting errors and confidence levels, optimize node positions and weight coefficients, and achieve local and global smooth transitions. Optionally, a curve generation method based on a physical model is used to construct an energy function to describe the curve characteristics, and the optimal solution is solved by the calculus of variations to achieve a smooth curve with specific constraints. It is understandable that other numerical calculation or optimization methods can also be used to implement curve fitting and deviation analysis, which are not limited here.

[0051] S106: Display the deviation vector and the adjustment direction according to the preset display rule.

[0052] Among them, preset display rules refer to the set of parameters that define visual effects, including properties such as color, line type, and transparency. Deviation vector display refers to the process of visualizing the deviation relationship between the control point and the optimal curve. Adjustment direction display refers to the process of indicating the recommended modification direction through graphic marks such as arrows. Display priority refers to the order and importance of superposition of different visual elements. Visual feedback refers to the real-time graphical response of the system to user operations.

[0053] The system refreshes the display content immediately after each update of the deviation information. Specifically, first set the basic display parameters: the deviation vector is represented by a red semi-transparent line segment (RGB: 255, 0, 0, alpha: 0.6), and the line width is proportional to the deviation size; the adjustment direction is represented by a green arrow (RGB: 0, 255, 0, alpha: 0.8), and the arrow length is fixed at 10 pixels. Then dynamically adjust the display effect according to the deviation size: for control points with a deviation of more than 10 pixels, add a yellow warning mark; for control points with a deviation of less than 2 pixels, reduce the display intensity. Finally, use double buffering technology for rendering to ensure a smooth display process without flickering.

[0054] In some embodiments, the visual display of deviation information can be achieved in a variety of ways: optionally, using gradient colors to encode the deviation size, achieving dynamic transparency adjustment, adding animation effects to enhance visual cues, and building layer management to ensure the correct display order. Optionally, an adaptive layout algorithm is used to optimize the position distribution of visual elements, achieve intelligent label avoidance, and provide interactive display control. It is understandable that other graphics rendering or visualization methods can also be used to achieve the display of deviation information, which is not limited here.

[0055] The following is a more detailed description of the process of the method provided by this implementation. Figure 2 , is another flow chart of the shape recognition and correction method based on hand-drawn trajectories in an embodiment of the present application.

[0056] S201. When receiving an auxiliary instruction, collect first hand-drawn trajectory data of the user on the digital tablet.

[0057] Auxiliary instructions are signals triggered by users through specific operations to start shape recognition and correction functions. They can be keyboard shortcuts (such as pressing Ctrl+D), touchpad gestures (such as three-finger swipe), or menu bar options. A digital tablet is an input device that can convert user handwriting input into digital signals. It includes a sensing layer and an electronic pen, and can collect parameters such as pen tip position, pressure, and tilt angle. The first hand-drawn trajectory data is the original data of the user's drawing trajectory collected by the digital tablet, including timestamps, coordinate point sequences, pressure values, and other information.

[0058] After receiving the user's auxiliary instructions, the system activates the data acquisition function of the tablet and converts the trajectory drawn by the user on the tablet surface with the electronic pen into a digital signal in real time. In specific implementation, the system records the position coordinates (x, y), pressure value p and timestamp t of the electronic pen at a fixed sampling frequency (such as 100Hz) to form a data sequence describing the hand-drawn trajectory [(x1, y1, p1, t1), (x2, y2, p2, t2)...]. These raw data will be used for subsequent shape recognition and correction processing.

[0059] S202: Perform data smoothing processing on the first hand-drawn trajectory data at every preset time interval to obtain a smoothed trajectory point sequence.

[0060] The preset time interval is a fixed sampling period set by the system, usually 10-50 milliseconds. Data smoothing is a signal processing technology used to reduce noise and jitter in the original data to make the trajectory smoother. The trajectory point sequence is a series of two-dimensional coordinate points obtained after smoothing, which can more accurately reflect the user's drawing intention.

[0061] The system performs smoothing on the collected hand-drawn trajectory data at preset time intervals (such as 20ms). Specifically, the moving weighted average algorithm is used to perform weighted calculation on the n sampling points in the current time window: a time window of size n is set (such as n=5), and different weights are assigned to each sampling point in the window (such as [0.1, 0.2, 0.4, 0.2, 0.1]), and the smoothed trajectory points are obtained by weighted averaging. The processed trajectory point sequence is smoother than the original data, reducing the influence of factors such as hand shaking.

[0062] S203: Calculate a direction angle sequence between adjacent trajectory points based on the trajectory point sequence.

[0063] The trajectory point sequence is the set of smoothed two-dimensional coordinate points obtained in the previous step. Adjacent trajectory points are two adjacent coordinate points in the trajectory point sequence. The direction angle is the angle between the line connecting two adjacent trajectory points and the horizontal direction, and its value range is [-180°, 180°]. The direction angle sequence is a data sequence formed by arranging the direction angles corresponding to all adjacent trajectory points in chronological order.

[0064] The system traverses the smoothed trajectory point sequence, and for each pair of adjacent trajectory points Pi(xi, yi) and Pi+1(xi+1, yi+1), the inverse tangent function is used to calculate the direction angle θi=arctan((yi+1-yi) / (xi+1-xi)). To ensure the continuity of the angle, the calculation result is corrected according to the quadrant situation to ensure that there is no sudden change in the change of adjacent angles. Finally, a complete direction angle sequence [θ1, θ2, ..., θn-1] is obtained, which reflects the tangent direction of the hand-drawn trajectory at each position.

[0065] S204: Identify the inflection point position in the first hand-drawn trajectory data based on the direction angle sequence, and segment the first hand-drawn trajectory data into a plurality of trajectory segments based on the inflection point position.

[0066] The direction angle sequence is a data sequence consisting of the direction angles between adjacent trajectory points. The inflection point position refers to the position where the direction in the hand-drawn trajectory changes significantly, which is manifested as a mutation point in the direction angle sequence or a point where the change rate exceeds the threshold. A trajectory segment refers to a continuous trajectory data segment between two adjacent inflection points, which has relatively consistent direction change characteristics.

[0067] First, perform a differential operation on the direction angle sequence to calculate the change between adjacent direction angles Δθi=θi+1-θi. Set the angle change threshold (such as 30°) and the mutation detection window size (such as 5 sampling points). When the angle change in the detection window exceeds the threshold, the corresponding position is marked as an inflection point. To avoid false detection caused by noise, a minimum interval constraint (such as 10 sampling points) is introduced to ensure that there is sufficient distance between adjacent inflection points. After obtaining the inflection point position sequence, the original trajectory data is segmented according to the inflection point position to obtain multiple trajectory segments, each of which contains all the sampling point data in the interval.

[0068] S205 , analyzing the shape feature of each of the trajectory segments to obtain a radian parameter and a length parameter of each of the trajectory segments.

[0069] A track segment is a data segment consisting of continuous track points between two adjacent inflection points. Shape features are numerical indicators that describe the geometric properties of a track segment. The arc parameter describes the curvature of the track segment and is calculated by the ratio of the line connecting the start point and the end point (chord length) to the actual track length. The length parameter is the cumulative sum of the distances between all adjacent track points in the track segment, reflecting the actual drawn length of the track segment.

[0070] Perform feature analysis on each trajectory segment. First, calculate the segment length parameter L: traverse the adjacent trajectory points Pi and Pi+1 in the segment, and accumulate the Euclidean distance di= , calculate the arc parameter K: divide the Euclidean distance D between the segment start point P1 and the end point Pn by the length parameter L, that is, K = D / L. The closer the K value is to 1, the straighter the trajectory is, and the smaller the K value is, the greater the curvature is. At the same time, the mean μθ and standard deviation σθ of the direction angle are calculated to assist in determining the shape characteristics of the trajectory segment. These parameters are combined into a feature vector [L, K, μθ, σθ] as a description of the shape characteristics of the trajectory segment.

[0071] S206: Determine a shape type corresponding to the first hand-drawn trajectory data according to a combination relationship between the arc parameter and the length parameter of each trajectory segment.

[0072] The radian parameter reflects the degree of curvature of the trajectory segment, and its value range is (0, 1]. The length parameter represents the actual length of the trajectory segment, with the unit of pixel. The combination relationship refers to the numerical ratio relationship between the radian parameter and the length parameter. The shape type is a predefined basic graphic category, including straight line segments, circular arcs, elliptical arcs, etc.

[0073] Establish shape type judgment rules: When the radian parameter K > 0.95, it is judged as a straight line segment; when 0.75 < K ≤ 0.95 and the length parameter L > 50 pixels, it is judged as a circular arc with a large curvature; when K ≤ 0.75, it is judged as a circular arc with a small curvature or an elliptical arc. Count the shape types of all trajectory segments, and determine the overall shape based on the number of segments and type distribution. For example, when 4 approximately equal-length straight line segments are detected connected end to end, it is judged as a rectangle; when continuous circular arc segments are detected connected end to end, it is judged as a circle. In this way, local features are combined to form the recognition result of the overall shape.

[0074] S207. Calculate the shape parameters based on this trajectory point sequence to obtain the basic shape data corresponding to this shape type, and this basic shape data includes the shape type and shape parameters.

[0075] The trajectory point sequence is a set of two-dimensional coordinate points after smoothing processing. The shape parameters are numerical features describing basic geometric shapes, including center point coordinates, rotation angle, scaling ratio, etc. The shape type is the identified basic graphic category, such as rectangle, circle, ellipse, etc. The basic shape data is a data structure composed of the shape type and shape parameters, which is used to completely describe a standard geometric figure.

[0076] According to the identified shape type, adopt different parameter calculation methods: For a rectangle, calculate the upper left corner coordinates (x0, y0), width w, height h, and rotation angle α of the circumscribed rectangle; for a circle, calculate the center coordinates (cx, cy) and radius r; for an ellipse, calculate the center coordinates (cx, cy), major axis a, minor axis b, and rotation angle β. Specifically, use the least squares method to fit the trajectory point sequence to obtain the optimal parameter values. For example, for circle fitting, solve the center coordinates and radius by minimizing the error function E = Σ((xi - cx)² + (yi - cy)² - r²)². Finally, pack the shape type and the calculated shape parameters into the basic shape data.

[0077] S208. According to the shape type in this basic shape data, determine the corresponding auxiliary line generation rule.

[0078] Basic shape data is a data structure that contains shape types and shape parameters. Shape types refer to the basic graphics categories that have been identified. Auxiliary line generation rules are a set of algorithms that define how to generate auxiliary lines based on shape types, including the style, position, and number of auxiliary lines. Auxiliary lines are reference lines used to guide users in drawing, with specific display effects and layout methods.

[0079] Select the auxiliary line generation rule corresponding to the shape type from the predefined rule library: the rectangle type uses the four orthogonal line segment rule to generate auxiliary lines parallel to the coordinate axis on the four sides of the rectangle; the circle type uses the arc rule to generate a complete circle outline and radial reference lines; the ellipse type uses the ellipse rule to generate the ellipse outline and the main axis direction line. Each rule contains the auxiliary line generation algorithm, layout method and display parameters. For example, the auxiliary line rule of the circle defines the generation method of the concentric circle outline and 8 equally divided radial lines, as well as the display properties such as line thickness, color, transparency, etc.

[0080] S209: Selecting a shape template matching the shape type from preset shape templates based on the auxiliary line generation rule.

[0081] Auxiliary line generation rules are algorithms and parameter sets used to generate auxiliary lines. Preset shape templates are predefined standard geometric shape sets, each template contains the basic features and deformation parameters of the shape. Shape type is the basic graphic category that has been identified. Matching refers to selecting the appropriate template for shape generation based on the shape type.

[0082] Template matching and selection are performed in the preset shape template library: First, the relevant template subsets are filtered out according to the shape type. For example, the templates corresponding to the rectangle type include standard rectangle, rounded rectangle, equilateral rectangle, etc. Then, based on the specific requirements in the auxiliary line generation rules, the most suitable template is selected. For example, when the rule requires the generation of standard rectangular auxiliary lines, the standard rectangle template is selected, which defines the calculation method of the four vertices of the rectangle, the edge generation algorithm and the constraints. Each template contains a parametric shape description, which is convenient for subsequent scaling and transformation according to the actual size. Through the parametric design of the template, it is ensured that the generated auxiliary lines have standardized geometric features and good visual effects.

[0083] S210: Substitute the shape parameters in the basic shape data into the shape template to generate an auxiliary line outline of a standard shape.

[0084] Basic shape data is a complete data structure that describes a geometric shape, including a shape type identifier and specific numerical parameters. Shape parameters are a set of numerical values ​​that define shape features, including the origin coordinates (x0, y0), width w, height h, and rotation angle α for a rectangle; the center coordinates (cx, cy), radius r for a circle; and the center coordinates (cx, cy), major axis a, minor axis b, and rotation angle β for an ellipse. A shape template is a predefined parametric geometric shape descriptor that contains a mathematical expression and drawing algorithm for the shape. A standard shape is an ideal shape that fully complies with geometric rules and has a precise mathematical definition. Auxiliary line contours are closed curves consisting of a series of ordered sets of points, used to display the boundaries of standard shapes.

[0085] Select the corresponding parameterized equation according to the shape type. Rectangle: Use four-point representation, and the coordinates of each point are calculated by affine transformation: P(x, y) = [x0, y0] + [cosα, -sinα; sinα, cosα] * [u, v], where u∈[0, w], v∈[0, h]; Circle: Use parametric equation, θ∈[0, 2π], step size Δθ=2π / n (n is the number of sampling points, such as 360): x=cx+rcosθ, y=cy+rsinθ; Ellipse: Use parametric equation, θ∈[0, 2π], step size Δθ=2π / n: x=cx+acosθcosβ-bsinθsinβ, y=cy+acosθsinβ+bsinθcosβ.

[0086] Then, according to the shape parameters and the selected parametric equation, the discrete point set on the contour line is calculated. The number of sampling points is dynamically adjusted according to the shape size to ensure that the distance between points is between 1-2 pixels. For rectangles, additional sampling points are added at the four vertices to ensure sharp corners. The position coordinates and corresponding tangential direction of each sampling point are recorded. The generated point sequence is locally smoothed using a Gaussian weighted moving average. The smoothing window size is 5-7 points, and the weight coefficient is set according to the normal distribution. For the corner point area of ​​the rectangle, the original position is retained without smoothing, and the tangential direction of the smoothed point sequence is recalculated. Finally, a data structure is created to store the contour line information, including the point sequence, tangential direction, and curvature. Key feature points are recorded, including vertices, axis endpoints, and curvature extreme points, and a parametric index of the point sequence is established to facilitate subsequent dynamic display. The total length and segment length of the contour line are calculated. Finally, the continuity and smoothness of the contour line are checked and corrected to ensure a smooth transition at the junction of the closed curve.

[0087] S211. Generate a guide arrow including a drawing direction at a preset distance position of the auxiliary line contour.

[0088] The auxiliary line outline is the outer boundary line of the standard shape. The preset distance is the fixed interval between the guide arrow and the outline. The guide arrow is a graphic mark indicating the drawing direction, which contains attributes such as arrow position, direction angle and size. The drawing direction is the recommended drawing path that the user should follow.

[0089] Generate guide arrows around the auxiliary line outline: First, divide the outline into several segments according to the drawing order, and set an arrow position at a fixed distance (such as 50 pixels) between each segment. For each arrow position, calculate the tangential direction vector v=(dx, dy) at the point, and the arrow direction is consistent with the tangential direction. Generate arrow graphics: Starting from the arrow position, draw a line segment with a main length of 10 pixels along the tangential direction, and draw arrow wings with a length of 5 pixels at an angle of 60 degrees on both sides of the line segment endpoint. The normal distance between the arrow position and the outline is maintained at 15 pixels. For closed shapes, ensure a smooth transition between the first and last arrow directions. Each arrow is drawn using a semi-transparent effect (transparency 0.6) so that the visual cues are not too intrusive.

[0090] S212. According to the drawing progress of the first hand-drawn trajectory data, the display length of the auxiliary line outline and the display position of the guide arrow are adjusted in real time to obtain the auxiliary line data, and the auxiliary line data is displayed according to preset display rules. The auxiliary line shape in the auxiliary line data is consistent with the shape type.

[0091] The first hand-drawn trajectory data is the trajectory information actually drawn by the user. The drawing progress is the proportion of the current drawing position to the overall trajectory. The auxiliary line outline is a reference line of a standard shape. The guide arrow is an arrow mark indicating the drawing direction. The auxiliary line data is the complete display information including the outline and the guide arrow. The preset display rules define the visual effect parameters of the auxiliary line.

[0092] Calculate the current drawing progress: divide the length of the drawn track by the estimated total length. Adjust the display content according to the progress value (between 0 and 1): the display length of the auxiliary line outline is equal to the standard outline length multiplied by the progress value, and only the outline corresponding to the completed part is displayed; the display position of the guide arrow moves forward with the current drawing position, and only the arrow mark of the next drawing area is displayed. Display parameter settings: The outline line uses light blue (RGB: 100, 150, 255), line width 2 pixels, and transparency 0.4; the guide arrow uses dark blue (RGB: 50, 100, 200), line width 1.5 pixels, and transparency 0.6. Provide users with continuous drawing guidance by adjusting the display range and position in real time. Overlay the processed auxiliary line data on the drawing area to ensure that the auxiliary line shape fully matches the recognized shape type.

[0093] S213: When it is detected that the drawing speed of the second hand-drawn trajectory data is lower than a preset speed threshold or a detail analysis trigger gesture of the user is received, feature point extraction and segmentation processing are performed on the second hand-drawn trajectory data to obtain hand-drawn segmentation data of sub-segment feature parameters.

[0094] The second hand-drawn trajectory data is the drawing data of the user in the detail modification stage, including coordinates, timestamps and pressure values. The drawing speed is the distance between adjacent sampling points divided by the time interval, in pixels per second. The preset speed threshold is the speed limit for judging the user to enter the detail drawing mode, which is usually set to 20-30 pixels per second. The detail analysis trigger gesture is a specific operation in which the user actively activates the detail analysis mode, such as double-finger clicking or holding down a specific key. Feature points are key points in the trajectory, including curvature extreme points, speed mutation points and pressure change points. The sub-segment feature parameters contain the geometric and dynamic characteristics of each segment of the trajectory. The hand-drawn segmentation data is a data set containing multiple sub-segments and their feature parameters.

[0095] The system continuously monitors the drawing speed of the second hand-drawn trajectory data, calculates the instantaneous speed v[i]=distance(P[i], P[i-1]) / (t[i]-t[i-1]) between adjacent sampling points, and performs 5-point moving average smoothing. When the average speed is lower than 30 pixels / second or a trigger gesture is detected, the feature point extraction process is started. First, the trajectory curvature k[i]=|x'[i]*y''[i]-y'[i]*x''[i]| / (x'[i]²+y'[i]²)^(3 / 2) is calculated, and the curvature extreme points, speed mutation points (speed changes exceeding 10 pixels / second) and pressure change points are detected. The trajectory is divided into sub-segments with these feature points as boundaries, and the characteristic parameters of each sub-segment are calculated, including geometric features (length, average curvature, start and end point positions), dynamic features (average speed, speed standard deviation) and pressure features (average pressure, pressure change range). In this way, the continuous trajectory data is converted into structured segmented data, providing a basis for subsequent analysis and processing.

[0096] S214 , performing cluster analysis according to the sub-segment feature parameters in the hand-drawn segmentation data to obtain similar trajectory sub-segments with similar features.

[0097] Hand-drawn segmentation data is a data set containing multiple trajectory sub-segments, each of which has its own characteristic parameters. The sub-segment characteristic parameters are multidimensional vectors that describe the characteristics of the trajectory segment, including geometric characteristics, dynamic characteristics, and pressure characteristics. Cluster analysis is a data analysis method that classifies objects with similar characteristics into the same category. Similar trajectory sub-segments are a set of trajectory segments whose characteristic parameters are close in the feature space.

[0098] For each sub-segment, the standardized feature vector F=[L / Lmax, K / Kmax, V / Vmax, P / Pmax, σv / σvmax, σp / σpmax] is calculated, which contains six dimensions: length, average curvature, average velocity, average pressure, velocity standard deviation, and pressure standard deviation. The distance between feature vectors is calculated using Euclidean distance, and an NxN distance matrix D is constructed (N is the number of sub-segments). The matrix element D[i, j]=sqrt(Σ(F[i, k]-F[j, k])²) represents the similarity between sub-segments i and j. The DBSCAN clustering algorithm is used for analysis, and the neighborhood radius ε=0.2 and the minimum number of points MinPts=3 are set to classify trajectory sub-segments with close distances in the feature space into the same category. In this way, trajectory segments with similar drawing features are identified, providing a classification basis for subsequent curve fitting.

[0099] S215 , selecting a corresponding curve fitting algorithm according to the characteristic parameters of the similar trajectory sub-segment, and performing curve fitting on each of the similar trajectory sub-segments according to the curve fitting algorithm to obtain a hand-drawn trajectory fitting curve.

[0100] Similar trajectory subsegments are a collection of trajectory segments with similar characteristics obtained through cluster analysis. Characteristic parameters are numerical indicators that describe the geometric and dynamic characteristics of the trajectory. Curve fitting algorithms are mathematical methods that fit discrete point sets into continuous curves, including polynomial fitting, spline interpolation, etc. The hand-drawn trajectory fitting curve is a smooth continuous curve obtained by mathematically fitting the original trajectory data.

[0101] The system selects an appropriate fitting algorithm based on the characteristic parameters of the trajectory sub-segment: when the curvature is small and changes slowly, a cubic polynomial is used to fit y=ax³+bx²+cx+d, and the coefficients are solved by the least squares method; when the curvature changes significantly, cubic B-spline interpolation is used, node vectors are set, and basis functions are constructed to solve the coordinates of the control points; for the presence of cusps, a piecewise Bezier curve is used to generate the curve by calculating the position of the control points and using the deCasteljau algorithm; for closed curves, periodic spline interpolation is used. After the fitting is completed, the average distance from the calculated point to the curve is used as the fitting error, and the fitting effect is optimized by adjusting the algorithm parameters to ensure the continuity and smoothness of the curve, and finally a uniformly sampled sequence of curve points is generated. This adaptive fitting strategy can select the most appropriate algorithm according to different types of trajectory characteristics and provide accurate curve fitting results.

[0102] S216: Connect the hand-drawn trajectory fitting curves between each of the similar trajectory sub-segments to generate the optimal curve path.

[0103] Similar trajectory sub-segments are a set of trajectory segments with similar characteristics obtained by clustering. The hand-drawn trajectory fitting curve is a continuous curve obtained by mathematically fitting each sub-segment. The optimal curve path is a complete curve formed by connecting all the fitting curve segments, which has global continuity and smoothness. The connection operation refers to the mathematical process of establishing a smooth transition between adjacent curve segments.

[0104] For each pair of adjacent fitting curve segments, the positions, first-order derivatives, and second-order derivatives of the two curve segments are first calculated at the connection point. The transition region is established by constructing a cubic Hermite interpolation polynomial H(t), ensuring positional continuity (C0), tangential continuity (C1), and curvature continuity (C2) at the connection point. Specifically, four control points are used to define the Hermite interpolation: P0 and P1 are the endpoints of the two curve segments, and M0 and M1 are the corresponding tangent vectors. The parameter form of the interpolation polynomial is H(t)=(2t³-3t²+1)P0+(t³-2t²+t)M0+(-2t³+3t²)P1+(t³-t²)M1, where t∈[0,1]. This interpolation method is applied at all connection points, and the smoothness of the transition is optimized by adjusting the size of the tangent vector. The optimal curve path finally obtained remains smooth and continuous overall while retaining the local characteristics of the original trajectory.

[0105] S217: Calculate the vertical deviation distance of each control point in the second hand-drawn trajectory relative to the optimal curve based on the optimal curve path, and generate a deviation vector.

[0106] The optimal curve path is the complete reference curve obtained by connecting all the fitted curves. The second hand-drawn trajectory is the trajectory data actually drawn by the user. The control point is the sampling point on the hand-drawn trajectory. The vertical deviation distance is the shortest distance from the control point to the optimal curve. The deviation vector is the vector pointing from the projection point on the optimal curve to the control point, which contains distance and direction information.

[0107] For each control point Pi in the second hand-drawn trajectory, first find the nearest point Qi on the optimal curve and solve it through iterative optimization: set the current curve parameter to t, calculate the curve point C(t) and the tangent vector C'(t), and get the optimal parameter value by minimizing |Pi-C(t)|². Calculate the vertical deviation vector Vi=Pi-Qi, whose modulus |Vi| represents the deviation distance, and the direction represents the deviation direction of the control point relative to the optimal curve. To improve the computational efficiency, the optimal curve is discretized using spatial partitioning technology, and a grid index structure is established to quickly locate the curve segment near the control point to be found. For each deviation vector, its size, direction angle and corresponding curve parameter value are recorded to form a complete deviation data set.

[0108] S218. Determine the adjustment direction of each control point according to the direction of the deviation vector.

[0109] The deviation vector is a vector that describes the deviation of the control point from the optimal curve. The adjustment direction is the instruction information that guides the user on how to move the control point to approach the optimal curve. The preset display rules define the visualization parameters of the deviation vector and adjustment direction, including color, line type, transparency, etc. The display operation is the process of converting the calculated vector information into a visual graphic.

[0110] Based on the deviation vector Vi of each control point, calculate the normalized adjustment direction vector Di=-Vi / |Vi|, pointing to the optimal curve. Set the display parameters: the deviation vector uses a red semi-transparent line segment (RGB: 255, 0, 0, alpha: 0.6), the line width is proportional to the deviation size, ranging from 1-3 pixels; the adjustment direction uses a green arrow (RGB: 0, 255, 0, alpha: 0.8), and the arrow length is fixed at 10 pixels.

[0111] S219: Display the deviation vector and the adjustment direction according to the preset display rule.

[0112] On the drawing interface, the deviation vector is drawn with the control point as the starting point, and an arrow mark is added at the end point of the vector to indicate the adjustment direction. For control points whose deviation distance exceeds the threshold (such as 10 pixels), a yellow warning ring mark (RGB: 255, 255, 0, alpha: 0.4) is added. All graphic elements use double buffering technology to ensure smooth display without flickering. Through this visualization method, the deviation of the current trajectory from the optimal path and the recommended correction direction are intuitively shown to the user.

[0113] The following is a more detailed description of the process of the method provided by this implementation. Figure 3 , is another flow chart of the shape recognition and correction method based on hand-drawn trajectories in an embodiment of the present application.

[0114] S301. Determine the adjustment direction of each control point according to the direction of the deviation vector.

[0115] The deviation vector is a geometric vector that describes the position deviation between the control point and the optimal curve, and contains size and direction information. The control point is a key sampling point on the hand-drawn trajectory, which is used to control the trajectory shape. The adjustment direction is a vector instruction that guides the user to correct the position of the control point. Its direction is opposite to the deviation vector and points to the optimal curve. The direction angle is the angle between the vector and the positive direction of the x-axis on the two-dimensional plane, and the value range is [-180°, 180°].

[0116] For each control point Pi, first read its corresponding deviation vector Vi=(dx, dy), calculate the direction angle θ=arctan(dy / dx) of the deviation vector through inverse trigonometric functions, and determine the quadrant according to the signs of dx and dy to obtain the final direction angle. Calculate the adjustment direction vector Di=(-dx, -dy), that is, reverse the deviation vector. In order to facilitate user understanding and operation, the adjustment vector is normalized: Di_norm=Di / |Di|, and the direction indication of unit length is obtained. At the same time, the adjustment priority is calculated: for control points with a deviation distance greater than 10 pixels, set a high priority; for control points with a deviation distance between 5-10 pixels, set a medium priority; for control points with a deviation distance less than 5 pixels, set a low priority. The adjustment direction vector and priority information of each control point are stored in a data structure for subsequent display and interactive use.

[0117] S302: Acquire a reference graphic imported by the user.

[0118] User import refers to the process of transferring external graphic data into the system through the interface provided by the system. Reference graphics are standard graphic samples provided by users, which can be graphic files in bitmap format (PNG, JPG) or vector format (SVG, AI). Graphic import includes three stages: file reading, format conversion and data preprocessing. Data preprocessing includes operations such as image enhancement, noise reduction, and edge extraction.

[0119] First, open the file selection dialog box, which supports file selection in multiple graphic formats. For bitmap formats, use the image processing library to read pixel data and perform grayscale processing: Y=0.299R+0.587G+0.114B. Apply Gaussian filtering for noise reduction: set a 5x5 Gaussian kernel, standard deviation σ=1.0, and perform convolution operations on the image. Use the Canny operator to extract edges: set double thresholds th1=100, th2=200 to obtain a binary edge image. For vector formats, parse the file data to extract path information, including control point coordinates and curve parameters. All graphic data are uniformly converted into a standard path representation: a discrete contour point sequence is obtained by uniform sampling, with a sampling interval of 1 pixel. A spatial index structure is established for the extracted contour data to facilitate subsequent rapid retrieval and matching.

[0120] S303: Calculate the shape feature similarity between each reference area in the reference graphic and the second hand-drawn trajectory data.

[0121] The reference area is a local graphic fragment in the reference graphic, which is intercepted on the graphic contour by sliding the window. Shape features are numerical indicators that describe the geometric characteristics of the graphic, including curvature sequence, direction angle sequence, length ratio, etc. The second hand-drawn trajectory data is the trajectory information actually drawn by the user. Similarity is a numerical indicator that measures the similarity between two shape features, and the value range is [0, 1].

[0122] A fixed-size sliding window (50 pixels wide) is used to sample the reference figure contour, moving 10 pixels each time to extract the local reference area. The shape feature vector is calculated for each reference area: first, the curvature sequence k[i] and the direction angle sequence θ[i] of the sampling points are calculated, and then the statistical features are calculated, including the average curvature μk, the standard deviation of curvature σk, and the direction angle change rate dθ / ds. The same feature extraction method is used for the second hand-drawn trajectory data. The similarity between feature vectors is calculated using cosine similarity: sim(A, B)=(A·B) / (|A|·|B|), where A and B are the feature vectors of the reference area and the hand-drawn trajectory, respectively. At the same time, considering geometric invariance, the feature vectors are rotated and scaled normalized to ensure the stability of the similarity calculation. The calculated similarity values ​​are recorded in the similarity matrix for subsequent matching analysis.

[0123] S304: Filter out reference areas whose shape feature similarity exceeds a first preset similarity threshold as reference trajectory data.

[0124] Shape feature similarity is the degree of match between two shapes expressed as a percentage, with a value between 0 and 1, and a larger value indicates a higher degree of match. The first preset similarity threshold is a fixed judgment standard value, set to 0.9, which is used to screen shapes with high matching degree. The reference area is a continuous sequence of points extracted from the reference figure, and each point contains two-dimensional coordinates (x, y). The reference trajectory data is the standard trajectory information obtained after similarity screening, which contains geometric features such as point sequence, curvature, and direction angle.

[0125] Read the similarity value between each reference area and the hand-drawn trajectory from the similarity matrix, and set the screening conditions: the overall shape similarity must be greater than 0.9, and the local feature similarity (including curvature similarity and azimuth similarity) must be greater than 0.85. Extract the complete information of the reference area that meets the conditions (including serial number, starting point coordinates, end point coordinates, point sequence, curvature sequence, and azimuth sequence) and store it in the reference trajectory data array. For adjacent reference areas that meet the conditions, calculate their starting and end point distances, and merge these areas into a continuous reference trajectory when the distance is less than 20 pixels. Finally, sort the reference trajectory data and number them in order of position in the original reference figure to form an ordered reference trajectory data set.

[0126] S305 : Decompose the reference trajectory data into a plurality of reference trajectory segments according to the drawing direction, and extract feature parameters for each reference trajectory segment.

[0127] The reference trajectory data is an ordered sequence of points consisting of multiple two-dimensional coordinate points (x, y). The drawing direction is a unit vector (dx, dy) determined by the coordinates of two adjacent points. The reference trajectory segment is a sub-trajectory after the complete trajectory is divided according to the direction change. The characteristic parameters include segment length (number of pixels), average curvature (radians), starting direction angle (radians), ending direction angle (radians), direction change rate (radians / pixel) and other numerical indicators.

[0128] First, calculate the direction angle θi=arctan((yi+1-yi) / (xi+1-xi)) of each point on the reference trajectory. When the direction angle difference of adjacent points |θi+1-θi| is greater than π / 4 (45 degrees), mark the point as a segmentation point. Divide the reference trajectory into multiple segments at each segmentation point. Calculate the characteristic parameters for each segment: the segment length L is the sum of the distances between all points; the average curvature K is the arithmetic mean of the curvatures of each point; the starting direction angle θs and the ending direction angle θe are the direction angles of the first and last points of the segment respectively; the direction change rate r is the total change in the direction angle divided by the segment length. Store these characteristic parameters in an array in a fixed format [L, K, θs, θe, r], establish a segment index table, and record the correspondence between the starting point sequence number of each segment and the characteristic parameter array.

[0129] S306: Perform similarity matching on the sub-segment feature parameters in the hand-drawn segmented data of the second hand-drawn trajectory data and the feature parameters of the reference trajectory segment to obtain matching similarity.

[0130] The hand-drawn segmentation data is a set of segmented hand-drawn trajectory segments, each of which contains a point sequence and feature parameters. The sub-segment feature parameters are five-dimensional feature vectors [L, K, θs, θe, r] that describe the hand-drawn trajectory segments. The reference trajectory segments are segmented data of the standard trajectory, with feature vectors in the same format. The matching similarity is the weighted matching degree of each component of the two feature vectors, with a value range of [0, 1].

[0131] For each pair of hand-drawn segments and reference segments, feature matching is calculated: length similarity SL = min (L1, L2) / max (L1, L2); curvature similarity SK = exp (-|K1-K2| / 0.5); starting direction similarity Ss = cos (θs1-θs2); ending direction similarity Se = cos (θe1-θe2); rate of change similarity Sr = exp (-|r1-r2| / 0.2). The total similarity S = 0.3SL + 0.3SK + 0.2Ss + 0.1Se + 0.1*Sr, where each coefficient represents the importance of different features. Calculate the similarity between each hand-drawn segment and all reference segments, and construct an N × M similarity matrix (N is the number of hand-drawn segments, M is the number of reference segments). Each matrix element records the matching similarity of the corresponding segment pair for subsequent optimal matching analysis.

[0132] S307: When there is a target trajectory segment whose matching similarity exceeds a second preset similarity threshold, generate a target curve path and a target deviation vector based on the target trajectory segment.

[0133] The target trajectory segment is the hand-drawn trajectory segment with the highest matching degree, which consists of a sequence of point coordinates {(xi, yi)}. The matching similarity is the calculated similarity value between the segments. The second preset similarity threshold is the standard value for judging whether the match is valid, which is set to 0.85. The target curve path is the continuous curve equation after mathematical fitting of the target trajectory segment. The target deviation vector is the vertical distance vector from the actual trajectory point to the target curve, expressed as {(dxi, dyi)}.

[0134] Check the value of each element in the similarity matrix. When a pair with a matching similarity greater than 0.85 is found, mark the corresponding hand-drawn segment as the target trajectory segment. Perform cubic B-spline fitting on the point sequence {(xi, yi)} of the target trajectory segment: set the node vector U={u0, u1, ..., un}, construct the basis function Ni, k(u), solve the control point coordinates {Pi}, and obtain the parametric equation C(u)=(x(u), y(u)). Calculate the shortest distance from each sampling point in the target trajectory segment to the fitting curve: for the point (xi, yi), solve the parametric equation by bisection to obtain the nearest point (x(ui), y(ui)), and calculate the deviation vector (dxi, dyi)=(xi-x(ui), yi-y(ui)). Store the fitting curve equation C(u) and the deviation vector sequence {(dxi, dyi)} as the target curve path and the target deviation vector, respectively.

[0135] S308: Generate auxiliary prompt information according to the target curve path and the target deviation vector, where the auxiliary prompt information includes a standard contour line, a key control point position, and a recommended drawing direction of the reference trajectory segment.

[0136] The target curve path is the parameterized curve equation C(u) representing the standard shape. The target deviation vector is the vector sequence {(dxi, dyi)} describing the correction direction. The standard contour line is the visual stroke of the target curve, which is connected by uniform sampling points. The key control points are important feature points on the curve, including the extreme curvature points, inflection points, etc. The recommended drawing direction is the direction indicator symbol to guide the user to make corrections. The auxiliary prompt information is the combined display of these visual elements.

[0137] According to the target curve path C(u), 200 points are sampled according to a fixed step size (Δu=0.01) to form a standard contour line, which is drawn with a blue solid line (RGB:0, 0, 255) and the line width is set to 2 pixels. Calculate the key control points on the curve: By solving the extreme point of the curvature equation k(u)=|x'y''-y'x''| / (x'²+y'²)^(3 / 2), the coordinates of the extreme point of curvature are obtained; by judging the change in the direction of the tangent vector, the position of the inflection point is determined. Draw a red dot mark (RGB:255,0,0) at the key control point with a radius of 4 pixels. According to the direction of the target deviation vector {(dxi, dyi)}, draw an arrow indicator at each sampling point: the arrow trunk length is 8 pixels, the arrow wing angle is 60 degrees, and it is drawn with green (RGB:0,255,0). All graphic elements are displayed superimposed to form a complete auxiliary prompt information.

[0138] S309: Record multiple modification operations of the user on the second hand-drawn trajectory data to obtain a modification record database.

[0139] User modification operation refers to the adjustment behavior of the hand-drawn trajectory, including operation type, location and timestamp. The second hand-drawn trajectory data is the original trajectory point sequence that is modified. The modification record database is a structured data set that stores all modification operation information. Each record contains fields such as operation ID, timestamp, trajectory point ID, original coordinates, and modified coordinates.

[0140] A record item is created for each modification operation: the operation ID uses an incremental number; the timestamp records the time when the operation occurs (accurate to milliseconds); the trajectory point ID identifies the sequence number of the modified point; the original coordinates and the modified coordinates respectively store the positions (x, y) before and after the modification. Create a data table structure: CREATETABLEModificationRecord(opIDINT, timeStampBIGINT, pointIDINT, originalXFLOAT, originalYFLOAT, modifiedXFLOAT, modifiedYFLOAT). Each time a change in the trajectory point position is detected, the displacement vector (Δx, Δy) is calculated. When the displacement is greater than 1 pixel, the modification information is inserted into the data table: INSERTINTOmodificationRecordVALUES(nextID, currentTime, pID, x0, y0, x1, y1). In this way, all modification operations are recorded to provide a data basis for subsequent analysis of user modification patterns.

[0141] S310, extracting the modification times and modification amplitude of each control point from the modification record database, and generating an error frequency distribution diagram.

[0142] The modification record database is a structured data table containing modification operation details. Each record contains operation ID, timestamp, point ID and coordinate information. Control points are sampling points on the trajectory, identified by a unique point ID. The number of modifications is the cumulative number of times each control point has been adjusted. The modification amplitude is the displacement distance of each modification operation, in pixels. The error frequency distribution diagram is a two-dimensional heat map, with the horizontal axis representing the trajectory parameters, the vertical axis representing the error size, and the color depth representing the modification frequency.

[0143] Count the modification information of each control point from the modification record database: execute the SQL query "SELECTpointID, COUNT(*)asmodCount, AVG(SQRT(POWER(modifiedX-originalX, 2)+POWER(modifiedY-originalY, 2)))asavgDistFROMModificationRecordGROUPBYpointID" to obtain the number of modifications and the average modification amplitude of each point. Divide the trajectory parameter range [0, 1] evenly into 100 intervals, and count the modification data of the control points falling within this range in each interval. Construct a 200×100 error frequency matrix M: the horizontal axis represents the trajectory parameter u∈[0, 1], the vertical axis represents the modification amplitude d∈[0, 20] pixels, and the matrix element M[i, j] records the number of modifications when the parameter value is in interval j and the modification amplitude is in range i. Use bilinear interpolation to smooth the frequency matrix and generate a continuous heat map. The color mapping uses the jet color spectrum: blue represents low frequency (0-2 times) and red represents high frequency (>10 times).

[0144] S311. Based on the error frequency distribution diagram, determine the characteristic pattern of the error-prone area, where the characteristic pattern includes the curvature mutation position, the direction turning point, and the midpoint area of ​​the long curve segment.

[0145] The error frequency distribution map is a two-dimensional heat map showing the modification frequency, and the matrix element value represents the number of modifications. Error-prone areas are high-frequency areas in the heat map, with more than 10 modifications. Characteristic patterns are geometric features shared by these areas. Curvature mutation locations are points where the curvature value changes rapidly, and the curvature change rate exceeds 0.1. Directional turning points are locations where the tangent vector direction changes sharply, and the direction angle changes by more than 45 degrees. Long curve segments are continuous curve segments with a length of more than 100 pixels, and the midpoint area refers to the part of the curve segment parameter value in the range of 0.4-0.6.

[0146] Analyze the high-frequency areas in the error frequency distribution diagram: Set the frequency threshold to 10 and extract the area set that satisfies M[i, j]>10. Calculate the geometric features for each high-frequency area: 1) Calculate the curvature change rate dk / du, and when |dk / du|>0.1, mark it as the curvature mutation position; 2) Calculate the tangent vector direction angle sequence θ(u), and when |θ(u+Δu)-θ(u)|>π / 4, mark it as the direction turning point; 3) Calculate the arc length of the curve segment s=∫√((dx / du)²+(dy / du)²)du, and when s>100 pixels, mark it as a long curve segment, and take the parameter range [0.4L, 0.6L] as the midpoint area. Perform correlation analysis on these positions and high-frequency areas, and establish a feature pattern dictionary: {pattern type: [parameter range, geometric feature threshold]} for subsequent pattern matching.

[0147] S312: When a target area matching the feature pattern appears in the second hand-drawn trajectory data, mark the target area as a potential error area.

[0148] The second hand-drawn trajectory data is the sequence of trajectory points {(xi, yi)} currently drawn by the user. The feature pattern is a set of error-prone geometric features that have been identified. The target area is the trajectory segment that matches the feature pattern. The potential error area is the location where drawing errors are predicted to occur, represented by the parameter range [ua, ub]. Matching refers to the degree of fit between the geometric features of the target area and the pattern features.

[0149] Perform feature analysis on the second hand-drawn trajectory data: calculate the curvature function k(u) and the azimuth function θ(u), and extract key feature points. Check whether each feature point meets the pattern matching conditions: 1) When the curvature change rate |dk / du|>0.1, mark the parameter range [u-0.05, u+0.05] as a potential error area; 2) When the azimuth change |Δθ|>π / 4, mark the range [u-0.1, u+0.1] as a potential error area; 3) For curve segments longer than 100 pixels, mark the range [0.4L, 0.6L] near the midpoint as a potential error area. All marked areas are recorded in the potential error area list, each of which contains the start and end parameter values, feature type, and matching confidence. This information will be used for subsequent real-time prompts and error prevention.

[0150] S313. Determine the risk level of each potential error area based on the statistical results of the error occurrence frequency and the correction range.

[0151] The frequency of error refers to the number of modification operations in a specific area, which is obtained by counting the modification records. The modification amplitude is the displacement distance of each modification operation, calculated in pixels. The statistical results are numerical analysis of the frequency and amplitude data, including mean, standard deviation and distribution characteristics. The potential error area is the trajectory segment where drawing errors are predicted to occur, defined by the parameter range [ua, ub]. The risk level is a discrete level that measures the probability of error, which is divided into three levels: high (3), medium (2), and low (1).

[0152] Perform risk assessment on each potential error area: extract all modification records within the parameter range of the area, calculate the frequency index F = number of modifications / area length (number of times / pixel), and calculate the amplitude index A = average modification amplitude (pixel). Set the assessment threshold: frequency threshold F1 = 0.1, F2 = 0.05; amplitude threshold A1 = 5, A2 = 3. Determine the risk level based on the index value: when F>F1 and A>A1, set it to high risk (3); when F1≥F>F2 and A1≥A>A2, set it to medium risk (2); when F≤F2 and A≤A2, set it to low risk (1). Record the risk level and its judgment basis in the data structure: {area ID, parameter range [ua, ub], frequency index F, amplitude index A, risk level level, feature type type}. These risk assessment results will be used for the subsequent generation of differentiated prompt strategies.

[0153] S314: Generate an auxiliary prompt strategy based on the risk level.

[0154] The risk level is a three-level discrete value (3, 2, 1) that represents the probability of error. The auxiliary prompt strategy is a prompt scheme that uses different visual effects according to the risk level. Visual effects include attributes such as color (RGB value), line type (solid line, dashed line), transparency (0-1), and line width (pixel). Auxiliary prompts include visual elements such as contour lines, arrow marks, and highlights. The prompt strategy is the combination rule of these visual elements.

[0155] Differentiated visual prompt parameters are set according to the risk level: for high-risk areas (level 3), a red solid line (RGB: 255, 0, 0) is used to draw the contour line, with a line width of 3 pixels and a transparency of 0.8, and a flashing effect is added (the transparency changes periodically between 0.6-1.0), and a warning arrow (length 12 pixels, arrow wing angle 45 degrees) is drawn at the boundary of the area; for medium-risk areas (level 2), an orange dotted line (RGB: 255, 165, 0) is used to draw the contour line, with a line width of 2 pixels, a transparency of 0.6, and a dotted line interval of 4 pixels, and a circular mark (radius 4 pixels) is added at the key point; for low-risk areas (level 1), a yellow dotted line (RGB: 255, 255, 0) is used to draw the contour line, with a line width of 1 pixel and a transparency of 0.4, and a prompt text is added in the center of the area. All visual elements are drawn using double buffering technology and updated once per frame to ensure smooth display. Through this graded visual prompt strategy, users can intuitively identify areas of different risk levels and adopt corresponding drawing strategies.

[0156] In some embodiments, steps S301 to S314 may be performed after S219 or after step S106, which is not limited here.

[0157] The following describes the shape recognition and correction system in the embodiment of the present invention from the perspective of hardware processing. Figure 4 , which is a schematic diagram of a physical device structure of the shape recognition and correction system in an embodiment of the present application.

[0158] It should be noted that Figure 4 The structure of the shape recognition and correction system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0159] like Figure 4 As shown, the shape recognition and correction system includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in RAM 403. CPU 401, ROM 402 and RAM 403 are connected to each other through bus 404. Input / output (I / O) interface 405 is also connected to bus 404.

[0160] The following components are connected to the I / O interface 405: an input section 406 including an audio input device, a button switch, etc.; an output section 407 including a liquid crystal display (LCD) and an audio output device, an indicator light, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.

[0161] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 409, and / or installed from a removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, various functions defined in the present invention are performed.

[0162] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.

[0163] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings.

[0164] Specifically, the shape recognition and correction system of this embodiment includes a processor and a memory. The memory stores a computer program. When the computer program is executed by the processor, the shape recognition and correction method based on the hand-drawn trajectory provided in the above embodiment is implemented.

[0165] As another aspect, the present invention further provides a computer-readable storage medium, which may be included in the shape recognition and correction system described in the above embodiment; or may exist independently without being assembled into the shape recognition and correction system. The above storage medium carries one or more computer programs, and when the above one or more computer programs are executed by a processor of the shape recognition and correction system, the shape recognition and correction system implements the shape recognition and correction method based on hand-drawn trajectories provided in the above embodiment.

[0166] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0167] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0168] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A method for shape recognition and correction of hand-drawn trajectories, characterized in that: Applied to a shape recognition and correction system, the method comprises: When receiving the auxiliary instruction, collecting the first hand-drawn trajectory data of the user on the digital tablet; Performing basic shape recognition on the first hand-drawn trajectory data at every preset time interval to generate basic shape data, wherein the basic shape data includes a shape type and shape parameters; Generate corresponding auxiliary line data according to the basic shape data, and display the auxiliary line data according to a preset display rule, wherein the auxiliary line shape in the auxiliary line data is consistent with the shape type; When it is detected that the drawing speed of the second hand-drawn trajectory data is lower than a preset speed threshold or a detail analysis trigger gesture of the user is received, feature point extraction and segmentation processing are performed on the second hand-drawn trajectory data to obtain hand-drawn segmentation data of sub-segment feature parameters; Performing curve fitting on the hand-drawn segmented data to obtain an optimal curve path, and generating a deviation vector and an adjustment direction of each control point in the second hand-drawn trajectory based on the second hand-drawn trajectory data and the optimal curve path; The deviation vector and the adjustment direction are displayed according to the preset display rule.

2. The method according to claim 1, characterized in that The step of performing basic shape recognition on the first hand-drawn trajectory data at every preset time interval to generate basic shape data, wherein the basic shape data includes a shape type and shape parameters, specifically comprises: Performing data smoothing processing on the first hand-drawn trajectory data at every preset time interval to obtain a smoothed trajectory point sequence; Calculate the direction angle sequence between adjacent trajectory points based on the trajectory point sequence; identifying an inflection point position in the first hand-drawn trajectory data based on the direction angle sequence, and dividing the first hand-drawn trajectory data into a plurality of trajectory segments based on the inflection point position; Analyze the shape characteristics of each of the track segments to obtain the arc parameter and length parameter of each of the track segments; Determine the shape type corresponding to the first hand-drawn trajectory data according to the combination relationship between the arc parameter and the length parameter of each trajectory segment; Shape parameters are calculated based on the trajectory point sequence to obtain basic shape data corresponding to the shape type.

3. The method according to claim 1, characterized in that The step of generating corresponding auxiliary line data according to the basic shape data specifically includes: Determining corresponding auxiliary line generation rules according to the shape type in the basic shape data; Selecting a shape template matching the shape type from preset shape templates based on the auxiliary line generation rule; Substituting the shape parameters in the basic shape data into the shape template to generate an auxiliary line outline of a standard shape; Generating a guide arrow including a drawing direction at a preset distance position of the auxiliary line contour; The display length of the auxiliary line outline and the display position of the guide arrow are adjusted in real time according to the drawing progress of the first hand-drawn trajectory data to obtain the auxiliary line data.

4. The method according to claim 1, characterized in that The step of performing curve fitting on the hand-drawn segmented data to obtain an optimal curve path, and generating a deviation vector and an adjustment direction of each control point in the second hand-drawn trajectory based on the second hand-drawn trajectory data and the optimal curve path specifically includes: Performing cluster analysis based on sub-segment feature parameters in the hand-drawn segmentation data to obtain similar trajectory sub-segments with similar features; Selecting a corresponding curve fitting algorithm according to the characteristic parameters of the similar trajectory sub-segments, and performing curve fitting on each of the similar trajectory sub-segments according to the curve fitting algorithm to obtain a hand-drawn trajectory fitting curve; Connecting the hand-drawn trajectory fitting curves between each of the similar trajectory sub-segments to generate the optimal curve path; Calculate the vertical deviation distance of each control point in the second hand-drawn trajectory relative to the optimal curve based on the optimal curve path to generate a deviation vector; The adjustment direction of each of the control points is determined according to the direction of the deviation vector.

5. The method according to claim 1, characterized in that After the step of displaying the deviation vector and the adjustment direction according to the preset display rule, the method further includes: Acquire the reference graphic imported by the user; Calculating the similarity of shape features between each reference area in the reference graph and the second hand-drawn trajectory data; Filtering out reference areas whose shape feature similarity exceeds a first preset similarity threshold as reference trajectory data; Decomposing the reference trajectory data into a plurality of reference trajectory segments according to a drawing direction, and extracting feature parameters for each reference trajectory segment; Performing similarity matching on the sub-segment feature parameters in the hand-drawn segmented data of the second hand-drawn trajectory data and the feature parameters of the reference trajectory segment to obtain matching similarity; When the matching similarity of the target trajectory segment exceeds a second preset similarity threshold, generating a target curve path and a target deviation vector based on the target trajectory segment; Auxiliary prompt information is generated according to the target curve path and the target deviation vector, wherein the auxiliary prompt information includes a standard contour line, a key control point position and a recommended drawing direction of the reference trajectory segment.

6. The method according to claim 1, characterized in that After the step of displaying the deviation vector and the adjustment direction according to the preset display rule, the method further includes: Recording multiple modification operations of the user on the second hand-drawn trajectory data to obtain a modification record database; Extract the modification times and modification amplitude of each control point from the modification record database to generate an error frequency distribution diagram; Based on the error frequency distribution diagram, characteristic patterns of error-prone areas are determined, and the characteristic patterns include locations of sudden changes in curvature, turning points in direction, and midpoint areas of long curve segments.

7. The method according to claim 6, characterized in that After the step of determining the characteristic pattern of the error-prone area based on the error frequency distribution diagram, wherein the characteristic pattern includes the curvature mutation position, the direction turning point and the midpoint area of ​​the long curve segment, the method further includes: When a target area matching the feature pattern appears in the second hand-drawn trajectory data, marking the target area as a potential error area; Determine the risk level of each potential error area based on the statistical results of the error occurrence frequency and the correction amplitude; An auxiliary prompt strategy is generated based on the risk level.

8. A shape recognition and correction system, characterized in that: The shape recognition and correction system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the shape recognition and correction system to execute the method described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on a shape recognition and correction system, the shape recognition and correction system is caused to execute the method according to any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product runs on a shape recognition and correction system, the shape recognition and correction system is enabled to perform the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for identifying and editing freehand sketch

    CN104424473A

  • Shape recognition and correction method and device based on hand-drawn track and storage medium

    CN115100321A

  • Method for correcting hand-drawn quadratic curve and electronic equipment

    CN116909460A

  • Hand-drawn pattern recognition method and device, computer program product and electronic equipment

    CN118823803A

  • Hand-Drawn Graphic Recognition Method, Apparatus and System, and Computer-Readable Storage Medium

    US20230351787A1

Cited By

  • Ageing-suitable data authority management method and system, product and medium

    CN120372665A