Graph correction method, device and equipment

By obtaining the corner point set and graphic features, determining the correction point set and correcting it, the deviation problem caused by hand instability in hand-drawn graphics during teaching is solved, and more accurate graphic correction is achieved.

CN118864327AActive Publication Date: 2024-10-29SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD

Patent Information

Application Number
CN202410898391.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2024-10-29
Estimated Expiration
2044-07-05

AI Technical Summary

Technical Problem

During the teaching process, when the user manually draws graphics, due to the instability of the hand, the actual drawn graphics deviate from the expected graphics, and the original hand-drawn graphics need to be corrected.

Method used

By obtaining the corner point set and the graphic features of the hand-drawn graphics, the correction point set that needs to be corrected is determined, and the reference straight line is determined based on these point sets and features, and the correction points are corrected, thereby realizing the correction of the graphics.

Benefits of technology

This makes the corrected graphics closer to the user's expectations and improves the accuracy and effect of graphics correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864327A_ABST
    Figure CN118864327A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a graph correction method, device and equipment, and relates to the technical field of computers. According to the embodiment of the invention, the correction point set needing to be corrected can be determined from the bevel point set of the hand-drawn graph according to the graph features of the hand-drawn graph, then the reference straight line is determined based on the correction point set and the graph features, and the correction points in the correction point set are corrected based on the reference straight line, so that correction of the original hand-drawn graph is realized; and the corrected graph can be closer to the expectation of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device and equipment for graphic correction. Background Art

[0002] With the development of Internet technology and large-screen technology, teaching using handwriting tablets, electronic whiteboards and other devices has gradually become a new teaching method. In the teaching process, users are often required to draw some graphics manually.

[0003] In the process of drawing graphics, the graphics actually drawn by the user may deviate from the expected graphics due to unstable hands and other reasons. Therefore, the original hand-drawn graphics need to be corrected. Summary of the invention

[0004] The embodiments of the present application provide a graphics correction method, device and equipment, which can correct the user's hand-drawn graphics.

[0005] In a first aspect, an embodiment of the present application provides a graphics correction method, comprising:

[0006] Obtaining a corner point set and graphic features of a hand-drawn graphic, wherein the corner point set is obtained by processing a touch point set of the hand-drawn graphic collected during the graphic drawing process, and the graphic features are determined based on the corner point set;

[0007] According to the graphic features, a correction point set that needs to be corrected is determined from the corner point set;

[0008] Determine the reference straight line according to the calibration point set and the graphic features;

[0009] The correction points in the correction point set are corrected according to the reference straight line to obtain a corrected hand-drawn figure.

[0010] In a second aspect, an embodiment of the present application provides a graphics correction device, including: an acquisition module, a determination module and a correction module;

[0011] An acquisition module is used to acquire a corner point set and graphic features of a hand-drawn graphic. The corner point set is obtained by processing a touch point set of the hand-drawn graphic collected during the graphic drawing process, and the graphic features are determined based on the corner point set.

[0012] A determination module is used to determine the correction point set that needs to be corrected from the corner point set according to the graphic features; and to determine the reference straight line according to the correction point set and the graphic features;

[0013] The correction module is used to correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0015] processor;

[0016] a memory for storing computer program instructions;

[0017] When the computer program instructions are executed by the processor, the method according to the first aspect is implemented.

[0018] In a fourth aspect, the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0019] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method described in the first aspect.

[0020] The embodiment of the present application can first determine the correction point set that needs to be corrected from the corner point set of the hand-drawn graphic according to the graphic features of the hand-drawn graphic, then determine the reference straight line based on the correction point set and the graphic features, and then correct the correction points in the correction point set based on the reference straight line, thereby realizing the correction of the original hand-drawn graphic, so that the corrected graphic can be closer to the user's expectations. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A flowchart of a graphics correction method provided in an embodiment of the present application;

[0023] Figure 2 A flowchart of another graphics correction method provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of a hand-drawn graphic provided in an embodiment of the present application being a symmetrical graphic;

[0025] Figure 4 A schematic diagram of a corner point provided in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of a process for determining a calibration point set provided in an embodiment of the present application;

[0027] Figure 6 A flowchart of another graphics correction method provided in an embodiment of the present application;

[0028] Figure 7A flowchart of another graphics correction method provided in an embodiment of the present application;

[0029] Figure 8 A flow chart of calibrating a calibration point in a calibration point set provided in an embodiment of the present application;

[0030] Fig. 9 A schematic diagram of a hand-drawn graphic provided in an embodiment of the present application;

[0031] Fig.10 A partially enlarged schematic diagram of a hand-drawn graphic provided in an embodiment of the present application;

[0032] Fig.11 A schematic diagram of a process of calibrating a calibration point provided in an embodiment of the present application;

[0033] Fig.12 A structural diagram of a graphics correction device provided in an embodiment of the present application;

[0034] Fig.13 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and Examples. It should be understood that the specific embodiments described herein are only configured to explain the present application and are not configured to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0036] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0037] The graphics correction method provided in the embodiment of the present application can be applied to scenarios where users manually draw graphics using devices such as handwriting tablets and electronic whiteboards. By correcting the hand-drawn graphics, the corrected graphics can be made as close as possible to the user's expectations.

[0038] The graphic correction method, device and equipment provided in the embodiments of the present application are described in detail below through specific embodiments.

[0039] Figure 1 A flowchart of a graphics correction method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the graphics correction method may include the following steps:

[0040] S110, obtaining the corner point set and the graphic features of the hand-drawn graphic.

[0041] The corner point set is obtained by processing the touch point set of the hand-drawn graphics collected during the graphics drawing process, and the graphics features are determined based on the corner point set.

[0042] S120: Determine a correction point set that needs to be corrected from the corner point set according to the graphic features.

[0043] S130: Determine a reference straight line according to the calibration point set and the graphic features.

[0044] S140: Correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

[0045] The embodiment of the present application can first determine the correction point set that needs to be corrected from the corner point set of the hand-drawn graphic according to the graphic features of the hand-drawn graphic, then determine the reference straight line based on the correction point set and the graphic features, and then correct the correction points in the correction point set based on the reference straight line, thereby realizing the correction of the original hand-drawn graphic, so that the corrected graphic can be closer to the user's expectations.

[0046] The above steps are described in detail below:

[0047] In S110, the touch point set can be a collection of touch points collected by the user in the process of drawing a hand-drawn graphic. For example, the position coordinates of each touch point can be collected in real time to obtain the touch point set, or the touch point set can be obtained by sampling at a sampling frequency, and the sampling frequency can be set according to actual needs.

[0048] For example, the touch point set can be represented as M{(x0, y0), (x1, y1)…, (x n ,y n )},(x i ,y i ) is the position coordinate of the touch point, 1≤i≤n, and n is the number of touch points.

[0049] The corner point set is also called the key point set, which is obtained by processing the touch point set M. For example, the curvature of each touch point in the touch point set M can be calculated, and the touch points with curvature greater than the curvature threshold are determined as corner points and added to the corner point set N. Of course, the corner point set can also be determined by other methods. For example, the corner point set can be expressed as N{(x0, y0), (x p ,y p )…,(x n ,y n )}, where (x0, y0) represents the point where the pen is placed, i.e. the starting point of the hand-drawn figure, (x n ,y n ) is the pen-lifting point, which is also the ending point of the hand-drawn figure.

[0050] The graphic feature may be a feature used to characterize the characteristics of hand-drawn features, and may include, for example, symmetrical graphics and asymmetrical graphics. The graphic feature may be determined based on a set of inflection points, and the specific determination process is not limited in the embodiments of the present application.

[0051] Exemplarily, after the hand-drawn graphic is drawn, the electronic device can process the collected touch point set to obtain a corner point set, and determine the graphic features of the hand-drawn graphic based on the corner point set, providing a more accurate basis for subsequent correction of the hand-drawn graphic.

[0052] In S120, the correction point set may be a set including points that need to be corrected, and the correction point set is part or all of the corner point set.

[0053] Exemplarily, the correction point set that needs to be corrected can be determined from the corner point set according to the graphic features. For example, the correction direction can be determined according to the graphic features, and then whether the corner point needs to be corrected can be determined according to the distance from the corner point to the vertical direction of the correction direction.

[0054] Exemplarily, the graphic features and the corner point set may also be input into the correction model, and the correction model may output the correction point set that needs to be corrected.

[0055] In S130, the reference straight line is the basis for the correction of the graphic, that is, the embodiment of the present application corrects the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn graphic.

[0056] Exemplarily, a reference straight line can be determined based on a correction point set and graphic features. For example, the slope of the reference straight line can be determined based on the graphic features, and the intercept of the reference straight line can be determined based on the correction point set. Thus, a reference straight line y=k*x+b can be obtained, where k is the slope and b is the intercept.

[0057] Exemplarily, the correction point set and the graphic features may also be input into the straight line determination model, and the straight line determination model outputs the reference straight line.

[0058] In S140 , after the reference straight line is determined, the reference straight line and the correction points in the correction point set can be used for correction, so that the corrected hand-drawn figure is closer to the user's expectations.

[0059] Exemplarily, the projection point of the correction point on the reference line may be determined as the corrected point, or the corrected point may be determined based on the intersection point and / or angle between the side constituting the point and the reference line.

[0060] Exemplarily, the correction process can be an iterative process, that is, the correction point set and the reference straight line are different in different numbers of iterations. For example, in the first iteration, the correction point set can be determined first to obtain the corresponding reference straight line, and the correction points in the correction point set can be corrected using the reference straight line. Then, the points in the correction point set can be deleted from the corner point set, and then the correction point set and the corresponding reference straight line can be determined again from the remaining corner points until all the points in the corner point set are traversed.

[0061] The following is an explanation of the process of determining the calibration point set through a specific embodiment. Figure 2 As shown, the graphics correction method may include the following steps:

[0062] S210, obtaining the corner point set and the graphic features of the hand-drawn graphic.

[0063] S220: Determine a correction direction according to the graphic features.

[0064] S230, determining a first distance from each inflection point in the inflection point set to a reference straight line where the correction direction is located.

[0065] S240: Determine a correction point set from the corner point set according to each first distance.

[0066] S250: Determine a reference straight line according to the calibration point set and the graphic features.

[0067] S260: Correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

[0068] The processes of S210, S250 and S260 may refer to the above embodiments, and will not be described again here for the sake of brevity.

[0069] The other steps above are described in detail below:

[0070] In S220 , different graphic features correspond to different correction directions, and there may be one or more correction directions.

[0071] Exemplarily, when the hand-drawn figure is a symmetrical figure, the direction of the symmetry axis of the hand-drawn figure and / or the direction of the perpendicular line of the symmetry axis are determined as the correction direction;

[0072] When the hand-drawn graphic is an asymmetric graphic, the horizontal direction and / or the direction perpendicular to the horizontal direction is determined as the correction direction.

[0073] That is, when the hand-drawn figure is a symmetrical figure, Figure 3 As shown, the direction where the symmetry axis l1 is located can be determined as the correction direction. The vertical direction l2 of the symmetry axis can also be determined as the correction direction. The direction where the symmetry axis l1 is located and the vertical direction l2 of the symmetry axis can also be used as the correction direction, that is, the embodiment of the present application can correct the hand-drawn graphics from multiple directions, so that the corrected hand-drawn graphics can be closer to the user's expectations.

[0074] For example, when the hand-drawn graphic is an asymmetric graphic, the horizontal direction may be determined as the correction direction, the direction perpendicular to the horizontal direction may be determined as the correction direction, or both the horizontal direction and the vertical direction may be determined as the correction direction, so that the hand-drawn graphic can be corrected from multiple directions, so that the corrected hand-drawn graphic can be closer to the user's expectations. The horizontal direction may be a direction parallel to the ground.

[0075] Exemplarily, the correction direction can be used as the slope of the reference straight line. For example, when the hand-drawn figure is a symmetrical figure, the slope k of the reference straight line = the slope of the axis of symmetry and / or the slope of the perpendicular line to the axis of symmetry. When the hand-drawn figure is an asymmetrical figure, the slope k of the reference straight line = 0 and / or a larger value.

[0076] The embodiment of the present application can more accurately determine the correction direction of the hand-drawn graphic based on the graphic features of the hand-drawn graphic, so that the hand-drawn graphic can be corrected along the correction direction subsequently, thereby improving the accuracy of the correction result.

[0077] In S230, the reference straight line is the straight line where the correction direction is located, and the first distance is the perpendicular distance from the corner point to the reference straight line, that is, the length of the perpendicular segment from the corner point to the reference straight line.

[0078] For example, a corner point can be selected from the corner points of the corner point set as a reference point, and then a straight line passing through the reference point and parallel to the correction direction is determined as the reference straight line. The selected corner point can be, for example, the first point, the last point, or any point between the first point and the last point in the corner point set.

[0079] Exemplarily, the point corresponding to the average value of each corner point may be used as a reference point, or each corner point may be used as a reference point.

[0080] Taking each corner point as a reference point as an example, illustratively, the above S230 may include the following steps:

[0081] For each chamfer point in the chamfer point set, the following actions are performed:

[0082] Taking the corner point as the reference point, determine the straight line passing through the corner point and parallel to the correction direction as the reference straight line;

[0083] Determine the first distance from other knuckle points to the reference line. Other knuckle points are all knuckle points in the knuckle point set except the knuckle point.

[0084] For example, Figure 4 As shown, assuming that the corner point set includes 5 corner points, namely a, b, c, d, and e, and taking the correction direction as the horizontal direction as an example, the corner point a can be used as the reference point to obtain the reference straight line a1 passing through the corner point a and parallel to the horizontal direction. At this time, the first distances from b, c, d, and e to the reference straight line a1 can be calculated respectively.

[0085] Similarly, the inflection point b, the inflection point c, the inflection point d and the inflection point e can be used as reference points to obtain corresponding reference straight lines, and then the first distances from other inflection points except the reference point to the reference straight line can be obtained.

[0086] Still Figure 4 For example, for each reference point, 4 first distances can be obtained, and a total of 20 first distances can be obtained.

[0087] For example, for the same inflection point, the average value of multiple first distances corresponding to the inflection point can be calculated, and the average value can be used as the final first distance of the inflection point. In this way, a total of 5 first distances can be obtained.

[0088] The embodiment of the present application can use each corner point in the corner point set as a reference point, combine it with the correction direction, obtain a reference straight line, and then obtain the first distance from each corner point to the reference straight line, providing an accurate basis for subsequent determination of the correction point set.

[0089] In S240, according to each first distance, a correction point set can be determined from the corner point set. For example, when the first distance is less than a distance threshold, the corner point corresponding to the first distance can be determined as a correction point and added to the correction point set. The size of the distance threshold can be set and adjusted according to actual needs.

[0090] Exemplarily, a candidate point set may be preliminarily determined from the corner point set based on the first distance, and a correction point set may be further determined based on the candidate point set and the graphic features.

[0091] Based on this, in some embodiments, the above S240 may include the following steps:

[0092] When there is a candidate distance satisfying the first distance condition in each first distance, and the number of corner points corresponding to the candidate distance is greater than or equal to the first value, a candidate point set is obtained according to the corner points corresponding to the candidate distance;

[0093] When the remaining point set is not empty, the candidate straight line is determined according to the candidate point set and the graphic features, and the remaining point set is the point set in the corner point set except the candidate point set;

[0094] A correction point set is determined according to a first distance between each remaining point in the remaining point set and the candidate straight line.

[0095] Exemplarily, the first distance condition may be that the first distance is smaller than a distance threshold, and there are at least two first distances smaller than the distance threshold. The first value may be 2, for example.

[0096] For example, if there is no first distance satisfying the first distance condition, the process may be terminated directly, that is, there is no need to correct the hand-drawn graphic.

[0097] For example, in the embodiment of the present application, first distances smaller than a distance threshold may be screened out from the first distances, and then the smallest W first distances may be determined from the screened out first distances as candidate distances.

[0098] If the number of corner points corresponding to the candidate distance is greater than or equal to 2, that is, there are at least two candidate distances. Then the two smallest candidate distances can be selected, and the corner points corresponding to the two candidate distances can be obtained to obtain a candidate point set. If the number of corner points corresponding to the candidate distance is less than 2, it can also end directly without executing subsequent correction strategies for the hand-drawn graphics.

[0099] by Figure 4 For example, assuming that the first distances corresponding to the inflection point b, the inflection point c and the inflection point d are all smaller than the distance threshold, and the first distances corresponding to the inflection point d, the inflection point c and the inflection point b increase successively, that is, there are two smallest first distances among the first distances that are smaller than the distance threshold, then the inflection point c and the inflection point d corresponding to the two smallest first distances can be added to the candidate point set.

[0100] If the remaining point set is empty, it means that the candidate point set is the corner point set, that is, the corner point set contains only two corner points. If the remaining point set is not empty, it means that the corner point set includes other corner points in addition to the candidate point set.

[0101] Exemplarily, when the remaining point set is not empty, the candidate straight line l3 can be determined based on the candidate point set and the graphic features, and the determination process is similar to that of the reference straight line. The correction point set can be further determined based on the second distance between each remaining point in the remaining point set and the candidate straight line. The second distance can be the Euclidean distance between the remaining point and the candidate straight line.

[0102] Exemplarily, when the second distance does not satisfy the second distance condition, the candidate point set is determined as the correction point set;

[0103] When the second distance satisfies the second distance condition, determining whether the remaining points corresponding to the second distance and each candidate point in the candidate point set satisfy an adjacent relationship;

[0104] When it is determined that the remaining points corresponding to the second distance do not satisfy the adjacent relationship with each candidate point in the candidate point set, the remaining points corresponding to the second distance are added to the candidate point set, and the updated candidate point set is determined as the correction point set;

[0105] When it is determined that the remaining points corresponding to the second distance satisfy a neighbor relationship with each candidate point in the candidate point set, the candidate point set is determined as the correction point set.

[0106] Exemplarily, the second distance condition may include that the second distance is less than a distance threshold, that is, if there are no remaining points in the remaining point set whose second distance to the candidate straight line is less than the distance threshold, the candidate point set determined above can be directly determined as the correction point set.

[0107] If there are residual points in the residual point set whose second distance to the candidate line is greater than or equal to the distance threshold, the neighbor relationship between the residual point and each candidate point in the candidate point set can be further determined. When there are multiple residual points whose second distance to the candidate line is greater than or equal to the distance threshold, the one with the smallest distance can be selected from the multiple residual points.

[0108] The adjacent relationship may include whether the remaining points and each candidate point satisfy the adjacent relationship or do not satisfy the adjacent relationship. Among them, satisfying the adjacent relationship means that the remaining points and each candidate point form three adjacent points. Taking the candidate point set including p1 and p2, and the remaining point is p3 as an example, when p1, p2 and p3 are three adjacent points in the corner point set, it can be considered that these three points satisfy the adjacent relationship. For example, p1, p2 and p3 can be adjacent in sequence, or p1, p3 and p2 can be adjacent in sequence, or p3, p2 and p1 can be adjacent in sequence.

[0109] Exemplarily, if the remaining points and each candidate point in the candidate point set satisfy an adjacent relationship, the candidate point set can be directly determined as the correction point set. If the remaining points and each candidate point in the candidate point set do not satisfy an adjacent relationship, the remaining points can be added to the candidate point set to obtain an updated candidate point set, and the updated candidate point set can be determined as the correction point set.

[0110] That is, the embodiment of the present application can first screen the candidate distances that meet the first distance condition from the corner point set to obtain the candidate point set and the candidate straight line, and then, when the remaining point set is not empty, further determine the correction point set based on the distance relationship between the remaining points in the remaining point set and the candidate straight line. Because the candidate point set and the candidate straight line are both changing in different iterations, that is, the embodiment of the present application can dynamically adjust the candidate straight line, so that the points that need to be corrected can be determined more accurately, providing a more accurate basis for the correction of hand-drawn graphics.

[0111] Take the example of the corner point set N containing at least two corner points. Figure 5 The process of determining the correction point set is described.

[0112] S510, determining a first distance from each inflection point in the inflection point set to a reference straight line where a correction direction is located.

[0113] S520: Determine two points p1 and p2 corresponding to two first distances that are smaller than the distance threshold and the smallest, and form an N2 point set, which is also a candidate point set.

[0114] S530, determine whether the N2 point set exists, if the N2 point set exists, execute S540, if the N2 point set does not exist, execute S590.

[0115] S540, deleting the points in N2 from N, determining the candidate straight line l3 according to N2, and determining p3 from the remaining point set whose distance to the candidate straight line l3 is less than the distance threshold and has the smallest distance.

[0116] S550, determine whether p3 exists. If p3 does not exist, execute S560; if p3 exists, execute S570.

[0117] S560, adding p3 to N2, determining the updated N2 as a correction point set, and using the updated N2 to determine a reference straight line, and using the reference straight line to correct the points in the updated N2.

[0118] S570: Determine N2 as a correction point set, and use N2 to determine a reference straight line, and use the reference straight line to correct the points in N2.

[0119] S580 , clear N2 and return to execute S520 .

[0120] S590, calibration ends. That is, if the N2 point set does not exist, the subsequent calibration strategy is no longer executed, and the calibration process ends.

[0121] Determining the reference straight line means determining the slope and intercept of the reference straight line. The process of determining the reference straight line is defined by a specific embodiment below. Figure 6 As shown, the graphics correction method may include the following steps:

[0122] S610: Obtain the corner point set and graphic features of the hand-drawn graphic.

[0123] S620: Determine a correction point set that needs to be corrected from the corner point set according to the graphic features.

[0124] S630: Determine the reference slope of the reference straight line according to the graphic features.

[0125] S640: For each calibration point in the calibration point set, determine the angle constituting the calibration point and the length of the side constituting the calibration point according to the corner point set.

[0126] S650: Determine the weight of each calibration point according to the angle and length corresponding to each calibration point.

[0127] S660: When the slope of the reference straight line is the reference slope, determine the reference intercept of the reference straight line according to the weight of each calibration point.

[0128] S670: Correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

[0129] The processes of S610, S620 and S670 may refer to the above embodiments, and will not be described again here for the sake of brevity.

[0130] The other steps above are described below, as follows:

[0131] In S630, the reference slope is the slope of the reference straight line. The reference slope can be determined based on the graphic features. For example, when the hand-drawn graphic is a symmetrical graphic, the reference slope of the reference straight line can be the slope of the axis of symmetry and / or the slope of the perpendicular line to the axis of symmetry. When the hand-drawn graphic is an asymmetrical graphic, the reference slope of the reference straight line can be 0 and / or a larger value.

[0132] In S640, for each correction point in the correction point set, the angle constituting the correction point and the length of the side constituting the correction point may be determined according to the corner point set.

[0133] For example, if the correction point is an endpoint of a hand-drawn figure, that is, the correction point is a starting point or an ending point of the hand-drawn figure, the angle constituting the correction point can be determined as

[0134] If the calibration point is not an endpoint of a hand-drawn figure, the corresponding angle can be determined according to the type of the two sides constituting the calibration point, and the length of the two sides constituting the calibration point and the length of the side of the calibration point can be determined. For example, when the two sides constituting the calibration point are both straight lines, the previous corner point and the next corner point of the calibration point can be determined from the corner point set, and a vector V1 is formed based on the calibration point and the previous corner point, and a vector V2 is formed based on the calibration point and the next corner point.

[0135] When there is a curve between the two sides constituting the correction point, the midpoint of the curve can be taken as the side of the curve, and vector V1 can be constructed based on the correction point and the midpoint. If the other side is also a curve, vector V2 can be obtained based on a similar method. Otherwise, vector V2 can be obtained according to the straight line method.

[0136] Based on vector V1 and vector V2, we can get angle angle=arccos(V1*V2 / (|V1|*|V2|)).

[0137] In S650, the weight of each calibration point may be determined according to the angle and length corresponding to each calibration point.

[0138] Exemplarily, the angle and length corresponding to each calibration point may be input into a weight calculation model to obtain the weight of each calibration point.

[0139] Exemplarily, the weight of each correction point may also be determined in the following manner:

[0140] For each correction point, determine a first ratio of an angle corresponding to the correction point to the sum of angles corresponding to all correction points in the correction point set, and a second ratio of a length of a side corresponding to the correction point to the sum of lengths of sides corresponding to all correction points in the correction point set;

[0141] The weight of each correction point is determined according to the first weight and the second weight of each correction point.

[0142] For example, Among them, angleSclae i is the angle weight corresponding to the i-th calibration point, that is, the first weight, angle i is the angle corresponding to the i-th correction point, is the sum of the angles corresponding to all the correction points in the correction point set, and n is the number of correction points contained in the correction point set.

[0143] For example, Among them, lenSclae i is the length ratio corresponding to the i-th calibration point, that is, the second ratio, len i is the length of the side corresponding to the i-th correction point, is the sum of the lengths of the sides corresponding to all the correction points in the correction point set.

[0144] The weight of each correction point may be determined according to the first weight and the second weight of each correction point. For example, the first weight and the second weight of each correction point may be input into a weight calculation model to obtain the weight of each correction point.

[0145] Exemplarily, the weight of each correction point may also be determined by the following formula:

[0146]

[0147] Among them, weight i is the weight of the i-th correction point.

[0148] In the embodiment of the present application, for each correction point, the angle and length corresponding to the correction point can be determined respectively, and the angle proportion and length proportion of the correction point can be obtained by combining all the correction points in the correction point set, and then the weight of each correction point can be obtained according to the angle proportion and length proportion of each correction point. That is, in the embodiment of the present application, the weight of each correction point can be determined according to the relationship between the angle proportion and the length proportion corresponding to each correction point in the correction point set, and the factors are considered more comprehensively, so that the weight of each correction point can be determined more accurately, which provides a more accurate basis for the subsequent determination of the intercept of the reference straight line.

[0149] In S660 , when the slope of the reference straight line is the reference slope, a reference intercept of the reference straight line may be determined according to the weight of each correction point.

[0150] Exemplarily, when the slope of the reference straight line is the reference slope, determining a first intercept corresponding to each calibration point;

[0151] For each correction point, calculate the product value of the weight of the correction point and the corresponding first intercept;

[0152] The product values ​​of each calibration point are summed and the sum result is determined as the reference intercept.

[0153] According to y=k*x+b, we can get b=yk*x. When the slope of the reference line is the reference slope, each correction point can be substituted into the above intercept formula to get b i =y i -k*x i , combined with the weights corresponding to each correction point, the reference intercept of the reference straight line can be obtained.

[0154] For example, Where b is the reference intercept, b i is the first intercept corresponding to the i-th correction point. That is, the total intercept, i.e., the reference intercept, can be obtained by weighting and summing the weights of each correction point and the first intercept.

[0155] The embodiment of the present application determines the reference intercept of the reference straight line according to the first intercept of each correction point at the reference slope and the weight of each correction point, taking into account the influence of each correction point, thereby improving the accuracy of the reference straight line.

[0156] The following is an explanation of the calibration process of the calibration points through a specific embodiment. Figure 7 As shown, the graphics correction method may include the following steps:

[0157] S710: Obtain the corner point set and graphic features of the hand-drawn graphic.

[0158] S720: Determine a correction point set that needs to be corrected from the corner point set according to the graphic features.

[0159] S730: Determine a reference straight line according to the calibration point set and the graphic features.

[0160] S740, when the correction points in the correction point set have been corrected along the first correction direction, determine the projection point of the correction point on the reference straight line as the corrected point, and the first correction direction is the direction other than the correction direction corresponding to the reference straight line; when the correction points in the correction point set have not been corrected, correct the correction points according to the start and end features of the correction points, the features of the edges constituting the correction points and the reference straight line; clear the correction point set, and continue to return to execute the operation of determining the correction point set until the traversal of the folding corner point set is completed.

[0161] S750, using the corrected points to replace the corresponding corner points in the corner point set to obtain a corrected hand-drawn figure.

[0162] The processes of S710 - S730 may refer to the above embodiment.

[0163] Exemplarily, in an embodiment of the present application, a correction point set can be preliminarily determined from the corner point set, and a corresponding reference straight line can be obtained. After the correction points in the correction point set are corrected using the reference straight line, the remaining corner point sets can be traversed to execute the next loop process. That is, the embodiment of the present application can cyclically execute the above process until all corner point sets are traversed.

[0164] By replacing the corresponding correction points with all the corrected points, the corrected hand-drawn figure can be obtained.

[0165] The embodiment of the present application improves the accuracy of the graphics correction result by traversing the corner point set multiple times and dynamically adjusting the reference straight line, so that the corrected hand-drawn graphics are closer to the user's expectations.

[0166] Taking the correction of a hand-drawn figure along multiple directions as an example, the first correction direction is the correction direction other than the correction direction corresponding to the reference straight line. For example, if the hand-drawn figure is a symmetrical figure, the correction direction may include the direction of the axis of symmetry and the direction of the perpendicular to the axis of symmetry. Assuming that the slope of the reference straight line is the slope of the axis of symmetry, that is, the corresponding correction direction is the direction of the axis of symmetry, the first correction direction may be the direction of the perpendicular to the axis of symmetry.

[0167] For example, if the correction points in the correction point set have been corrected along the first correction direction, then in this correction, the projection points of the correction points on the reference line can be directly determined as the corrected points. For example, if the correction points in the correction point set have been corrected once in the direction perpendicular to the axis of symmetry, then when the correction is performed along the direction of the axis of symmetry, the projection points of the correction points on the reference line can be directly determined as the corrected points.

[0168] Exemplarily, if the correction points in the correction point set have not been calibrated before, that is, this calibration is the first calibration, the correction points can be calibrated according to the start and end features of the correction points, the features of the edges constituting the correction points, and the reference straight line.

[0169] The start and end features are used to characterize whether the calibration point is the endpoint of the hand-drawn figure, that is, whether it is the starting point or the ending point of the hand-drawn figure. The features of the edge constituting the calibration point may include whether the edge constituting the calibration point contains a curve.

[0170] Different start and end features and edge features require different correction strategies when making corrections.

[0171] That is, in the embodiment of the present application, when the correction point has been corrected in other directions, the projection point of the correction point on the reference line can be directly determined as the corrected point. When the correction point is corrected for the first time, the correction point can be corrected based on the start and end features of the correction point and the features of the edges that constitute the correction point, combined with the reference line, thereby improving the diversity of correction methods and ensuring the accuracy of the correction results.

[0172] When the correction point is corrected for the first time, it can be determined whether the correction point is an endpoint of a hand-drawn figure and whether the edge constituting the correction point is a curve. According to the judgment result, a suitable correction strategy is adopted to correct the correction point.

[0173] In some embodiments, when the correction point is an endpoint of a hand-drawn figure and the edge constituting the correction point is not a curve, Figure 8 As shown, the above-mentioned “correcting the correction point according to the start and end features of the correction point, the features of the edges constituting the correction point, and the reference straight line” may include the following steps:

[0174] S810, determining whether the hand-drawn figure is a closed figure;

[0175] S820, when the hand-drawn figure is a closed figure, calibrate the calibration point according to the drawing direction and a first angle between the straight line where two sides constituting the calibration point are located and the reference straight line;

[0176] S830: When the hand-drawn figure is a non-closed figure, determine the intersection of the straight line where the edge constituting the correction point is located and the reference straight line as the corrected point.

[0177] Exemplarily, when the correction point is an endpoint of a hand-drawn figure and the edge constituting the correction point is not a curve, it can be further determined whether the hand-drawn figure is a closed figure. The specific determination process is not limited in the embodiment of the present application.

[0178] Exemplarily, when the hand-drawn figure is a closed figure, the edges that constitute the correction point include two. At this time, the first angle between the straight line where the two edges are located and the reference straight line can be determined, where the first angle is the angle between the straight line where the two edges are located and the reference straight line obtained along the drawing direction.

[0179] like Fig. 9 As shown, assuming that the drawing direction of the hand-drawn figure is from bottom to top, as shown by the arrow, l0 is the reference straight line, assuming that the corner point 2 is the correction point, it can be determined that the two sides that constitute the correction point 2 are m1 and m2, then according to the drawing direction, it can be determined that the angle between the straight line where the side m1 is located and the reference straight line is α1, and the angle between the straight line where the side m2 is located and the reference straight line is α2, as shown in Fig.10 α1 and α2 are collectively referred to as the first angle.

[0180] The calibration point may be calibrated according to the first angle, and the specific calibration process may refer to the following embodiment.

[0181] Exemplarily, when the hand-drawn figure is a non-closed figure, the intersection of the straight line on which the edge constituting the correction point is located and the reference straight line can be directly determined as the corrected point.

[0182] In the embodiment of the present application, when the correction point is the endpoint of a hand-drawn figure and the edge constituting the correction point is not a curve, correction can be further performed based on whether the hand-drawn figure is a closed figure. That is, when performing graphic correction, not only the position of the correction point in the hand-drawn figure and the line characteristics of the hand-drawn figure are considered, but also the closed characteristics of the hand-drawn figure are considered. The factors considered are more comprehensive and the correction result is more accurate.

[0183] Exemplarily, the above “correcting the correction point according to the first angle between the straight line where the two sides constituting the correction point are located and the reference straight line” may include the following steps:

[0184] When all first angles are greater than or equal to the first angle threshold, determine the intersection of the straight line where the two sides constituting the correction point are located and the reference straight line, and determine the average value of the intersection as the corrected point;

[0185] When at least one first angle is smaller than the first angle threshold, a target edge satisfying a preset condition is determined from two edges constituting the correction point, and an intersection of a straight line where the target edge is located and a reference straight line is determined as a corrected point.

[0186] The first angle threshold can be set according to actual needs. For example, when the hand-drawn figure is a closed figure, if the angles between the straight lines where the two sides of the correction point are located and the reference straight line are both large, the average of the intersections of the straight lines where the two sides of the correction point are located and the reference straight line can be determined as the corrected point.

[0187] If at least one of the angles between the two sides constituting the correction point and the reference straight line is smaller, a target side that meets preset conditions can be determined from the two sides constituting the correction point, and the intersection of the target side and the reference straight line can be determined as the corrected point.

[0188] The target edge may be, for example, an edge that is later in the drawing order among the edges constituting the correction point, or an edge that is irrelevant to the adjacent correction point among the edges constituting the correction point. The adjacent correction point may be a correction point that is adjacent to the correction point in the correction point set.

[0189] In the embodiment of the present application, when the hand-drawn figure is a closed figure, different correction strategies can be used to correct the correction point according to the drawing direction and the size of the angle between the straight lines on which the two sides constituting the correction point are located and the reference straight line, so that the correction result can change dynamically with the size of the angle, thereby improving the accuracy of the correction result.

[0190] In some embodiments, when the correction point is not an endpoint of a hand-drawn figure, or when the correction point is an endpoint of a hand-drawn figure and the side constituting the correction point is a curve, the above-mentioned “correcting the correction point according to the start and end features of the correction point, the features of the side constituting the correction point, and the reference straight line” may include the following steps:

[0191] When the correction point is not an endpoint of the hand-drawn figure, or when the correction point is an endpoint of the hand-drawn figure and the side constituting the correction point is a curve, determining whether both sides constituting the correction point are straight lines;

[0192] In the case where at least one of the two sides constituting the calibration point is not a straight line, a projection point of the calibration point on the reference straight line is determined as the calibrated point;

[0193] When both sides constituting the correction point are straight lines, determine the points in the corner point set adjacent to the correction point, the second distance between the adjacent point and the reference straight line, and the first side of the two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy the preset relationship, and the adjacent correction point is the point in the correction point set adjacent to the correction point;

[0194] The correction point is corrected according to the second distance and a second angle between the straight line where the first side is located and the reference straight line.

[0195] Exemplarily, when the correction point is not an endpoint of a hand-drawn figure, or when the correction point is an endpoint of a hand-drawn figure but the side constituting the correction point is a curve, it can be further determined whether the two sides constituting the correction point are both straight lines. If the two sides constituting the correction point are both straight lines, or at least one of them is not a straight line, the correction strategy used is different.

[0196] For example, when at least one of the two sides constituting the correction point is not a straight line, the projection point of the correction point on the reference straight line may be determined as the corrected point.

[0197] For example, when both sides constituting the correction point are straight lines, it can be further determined whether the points adjacent to the correction point in the corner point set need to be corrected, as well as the second angle between the straight line where the first side of the two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy the preset relationship and the reference straight line.

[0198] Determine whether the points adjacent to the correction point in the corner point set need to be corrected, that is, determine whether the second distance between the points adjacent to the correction point in the corner point set and the reference straight line meets the correction condition, that is, whether the second distance is less than the distance threshold.

[0199] The first side of the two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy the preset relationship may be the side of the two sides constituting the correction point that is not related to the adjacent correction point. Fig. 9 As shown, if the corner point 2 and the corner point 3 are both correction points, and the corner point 2 and the corner point 3 are adjacent correction points in the correction point set, for the corner point 2, among the two sides m1 and m2 constituting the corner point 2, the side that is not related to the corner point 3 is m1, then m1 can be determined as the first side.

[0200] According to the second distance and the second angle between the straight line where the first side is located and the reference straight line, a corresponding correction strategy can be determined to correct the correction point.

[0201] Exemplarily, when the second distance is less than the distance threshold and the second angle is greater than or equal to the second angle threshold, a target edge with a preset condition is determined from two edges constituting the correction point, and an intersection point of a straight line where the target edge is located and a reference straight line is determined as a corrected point;

[0202] When the second distance is greater than or equal to the distance threshold, and / or the second angle is greater than the second angle threshold, determining a third angle between the straight line where two sides constituting the calibration point are located and the reference straight line;

[0203] When each third angle is greater than or equal to the third angle threshold, the average of the intersections of the straight lines on which the two sides constituting the correction point are located and the reference straight line is determined as the corrected point;

[0204] In the case where at least one of the third angles is smaller than the third angle threshold, the projection point of the correction point on the reference straight line is determined as the corrected point.

[0205] Exemplarily, if the second distance is less than the distance threshold, it means that the points adjacent to the correction point in the corner point set need to be corrected, and if the second distance is greater than or equal to the distance threshold, it means that the points adjacent to the correction point in the corner point set do not need to be corrected.

[0206] For example, when the second distance is less than the distance threshold and the second angle is greater than or equal to the second angle threshold, a target edge with a preset condition can be determined from the two edges constituting the correction point, and the intersection of the straight line where the target edge is located and the reference straight line is determined as the corrected point. The specific determination process can refer to the above embodiment.

[0207] Exemplarily, when the second distance is greater than or equal to the distance threshold, and / or the second angle is greater than the second angle threshold, the third angle between the straight line where the two sides of the correction point are located and the reference straight line can be further determined; when the third angles are both greater than or equal to the third angle threshold, the average of the intersections of the straight line where the two sides of the correction point are located and the reference straight line can be determined as the corrected point; when at least one of the third angles is less than the third angle threshold, the projection point of the correction point on the reference straight line is determined as the corrected point. The specific determination process can be referred to the above embodiment.

[0208] That is, in the embodiment of the present application, when the correction point is not the endpoint of the hand-drawn figure, or when the correction point is the endpoint of the hand-drawn figure and the side constituting the correction point is a curve, it can be further determined whether the two sides constituting the correction point are both straight lines, thereby adopting different correction strategies. This allows the correction result to dynamically change with the start and end features of the correction point and the line type corresponding to the two sides constituting the correction point, thereby improving the accuracy of the correction result.

[0209] Combine the following Fig.11 The specific calibration process of the calibration point is described.

[0210] S1100, determine whether the calibration point has been calibrated in other directions, if so, execute S1110, if not, execute S1120.

[0211] S1110: Determine the projection point of the calibration point on the reference line as the calibrated point.

[0212] S1120, determine whether the correction point is the endpoint of the hand-drawn figure, and the edge constituting the correction point is not a curve. If so, that is, the correction point is the endpoint of the hand-drawn figure, and the edge constituting the correction point is not a curve, then execute S1130; if not, that is, the correction point is not the endpoint of the hand-drawn figure, or the correction point is the endpoint of the hand-drawn figure but the edge constituting the correction point is a curve, then execute S1170.

[0213] S1130, determine whether the hand-drawn figure is a closed figure, if so, execute S1140, if not, execute S1210.

[0214] S1140, determining whether the first angles between the straight lines where the two sides constituting the calibration point are located and the reference straight line are both greater than or equal to a first angle threshold, if so, executing S1150, if not, executing S1160.

[0215] S1150: Determine the intersection of the straight line on which the two sides constituting the correction point are located and the reference straight line, and determine the average value of the intersection as the corrected point.

[0216] S1160: Determine a target edge that meets a preset condition from the two edges constituting the correction point, and determine the intersection of the straight line where the target edge is located and the reference straight line as the corrected point.

[0217] S1170, determine whether the two sides constituting the calibration point are both straight lines, if so, execute S1180, if not, execute S1110.

[0218] S1180: Determine points in the corner point set that are adjacent to the correction point, a second distance between the adjacent point and the reference line, and a first side of two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy a preset relationship.

[0219] S1190, determine whether the second distance is less than the distance threshold, and the second angle is greater than or equal to the second angle threshold; if so, that is, the second distance is less than the distance threshold, and the second angle is greater than or equal to the second angle threshold, execute S1160; if not, execute S1200.

[0220] S1200, determining whether the third angles between the straight line where the two sides constituting the calibration point are located and the reference straight line are both greater than or equal to a third angle threshold; if so, executing S1150; if not, executing S1110.

[0221] S1210: Determine the intersection of the straight line on which the side constituting the correction point is located and the reference straight line as the corrected point.

[0222] Based on the same inventive concept, the present application embodiment also provides a graphics correction device. Fig.12 The graphic correction device provided in the embodiment of the present application is described in detail.

[0223] Fig.12 A structural diagram of a graphics correction device provided in an embodiment of the present application.

[0224] like Fig.12 As shown, the graphic correction device 1200 may include: an acquisition module 1201, a determination module 1202 and a correction module 1203;

[0225] The acquisition module 1201 is used to acquire a corner point set and graphic features of a hand-drawn graphic. The corner point set is obtained by processing a touch point set of the hand-drawn graphic collected during the graphic drawing process, and the graphic features are determined based on the corner point set.

[0226] The determination module 1202 is used to determine the correction point set that needs to be corrected from the corner point set according to the graphic features; and determine the reference straight line according to the correction point set and the graphic features;

[0227] The correction module 1203 is used to correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

[0228] The embodiment of the present application can first determine the correction point set that needs to be corrected from the corner point set of the hand-drawn graphic according to the graphic features of the hand-drawn graphic, then determine the reference straight line based on the correction point set and the graphic features, and then correct the correction points in the correction point set based on the reference straight line, thereby realizing the correction of the original hand-drawn graphic, so that the corrected graphic can be closer to the user's expectations.

[0229] In some embodiments, the determination module 1202 is specifically configured to:

[0230] Determine the correction direction according to the graphic features;

[0231] Determine the first distance between each inflection point in the inflection point set and the reference straight line where the correction direction is located;

[0232] According to each first distance, a correction point set is determined from the corner point set.

[0233] In some embodiments, the determination module 1202 is specifically configured to:

[0234] When the hand-drawn figure is a symmetrical figure, the direction of the symmetry axis of the hand-drawn figure and / or the direction of the perpendicular line of the symmetry axis are determined as the correction direction;

[0235] When the hand-drawn graphic is an asymmetric graphic, the horizontal direction and / or the direction perpendicular to the horizontal direction is determined as the correction direction.

[0236] In some embodiments, the determination module 1202 is specifically configured to:

[0237] For each chamfer point in the chamfer point set, the following actions are performed:

[0238] Taking the corner point as the reference point, determine the straight line passing through the corner point and parallel to the correction direction as the reference straight line;

[0239] Determine the first distance from other knuckle points to the reference line. Other knuckle points are all knuckle points in the knuckle point set except the knuckle point.

[0240] In some embodiments, the determination module 1202 is specifically configured to:

[0241] When there is a candidate distance satisfying the first distance condition in each first distance, and the number of corner points corresponding to the candidate distance is greater than or equal to the first value, a candidate point set is obtained according to the corner points corresponding to the candidate distance;

[0242] When the remaining point set is not empty, the candidate straight line is determined according to the candidate point set and the graphic features, and the remaining point set is the point set in the corner point set except the candidate point set;

[0243] The correction point set is determined according to the second distance between each remaining point in the remaining point set and the candidate straight line.

[0244] In some embodiments, the determination module 1202 is specifically configured to:

[0245] When the second distance does not satisfy the second distance condition, determining the candidate point set as the correction point set;

[0246] When the second distance satisfies the second distance condition, determining whether the remaining points corresponding to the second distance and each candidate point in the candidate point set satisfy an adjacent relationship;

[0247] When it is determined that the remaining points corresponding to the second distance do not satisfy the adjacent relationship with each candidate point in the candidate point set, the remaining points corresponding to the second distance are added to the candidate point set, and the updated candidate point set is determined as the correction point set;

[0248] When it is determined that the remaining points corresponding to the second distance satisfy a neighbor relationship with each candidate point in the candidate point set, the candidate point set is determined as the correction point set.

[0249] In some embodiments, the determination module 1202 is specifically configured to:

[0250] According to the characteristics of the graph, the reference slope of the reference straight line is determined;

[0251] For each correction point in the correction point set, determine the angle constituting the correction point and the length of the side constituting the correction point according to the corner point set;

[0252] Determine the weight of each calibration point according to the angle and length corresponding to each calibration point;

[0253] When the slope of the reference straight line is the reference slope, the reference intercept of the reference straight line is determined according to the weight of each correction point.

[0254] In some embodiments, the determination module 1202 is specifically configured to:

[0255] When the slope of the reference straight line is the reference slope, determining a first intercept corresponding to each calibration point;

[0256] For each correction point, calculate the product value of the weight of the correction point and the corresponding first intercept;

[0257] The product values ​​of each calibration point are summed and the sum result is determined as the reference intercept.

[0258] In some embodiments, the correction module 1203 is specifically configured to:

[0259] In the case where the correction points in the correction point set have been corrected along the first correction direction, the projection points of the correction points on the reference straight line are determined as the corrected points, and the first correction direction is a direction other than the correction direction corresponding to the reference straight line; in the case where the correction points in the correction point set have not been corrected, the correction points are corrected according to the start and end features of the correction points, the features of the edges constituting the correction points, and the reference straight line; the correction point set is cleared, and the operation of determining the correction point set is continued to be returned until the traversal of the folded corner point set is completed;

[0260] The corrected points are used to replace the corresponding corner points in the corner point set to obtain the corrected hand-drawn figure.

[0261] In some embodiments, the correction module 1203 is specifically configured to:

[0262] When the calibration point is an endpoint of the hand-drawn figure and the edge constituting the calibration point is not a curve, determining whether the hand-drawn figure is a closed figure;

[0263] When the hand-drawn figure is a closed figure, the correction point is corrected according to the drawing direction and the first angle between the straight line where the two sides constituting the correction point are located and the reference straight line;

[0264] When the hand-drawn figure is a non-closed figure, the intersection of the straight line where the side constituting the correction point is located and the reference straight line is determined as the corrected point.

[0265] In some embodiments, the correction module 1203 is specifically configured to:

[0266] When all first angles are greater than or equal to the first angle threshold, determine the intersection of the straight line where the two sides constituting the correction point are located and the reference straight line, and determine the average value of the intersection as the corrected point;

[0267] When at least one first angle is smaller than the first angle threshold, a target edge satisfying a preset condition is determined from two edges constituting the correction point, and an intersection of a straight line where the target edge is located and a reference straight line is determined as a corrected point.

[0268] In some embodiments, the correction module 1203 is specifically configured to:

[0269] When the correction point is not an endpoint of the hand-drawn figure, or when the correction point is an endpoint of the hand-drawn figure and the side constituting the correction point is a curve, determining whether both sides constituting the correction point are straight lines;

[0270] In the case where at least one of the two sides constituting the calibration point is not a straight line, a projection point of the calibration point on the reference straight line is determined as the calibrated point;

[0271] When both sides constituting the correction point are straight lines, determine the points in the corner point set adjacent to the correction point, the second distance between the adjacent point and the reference straight line, and the first side of the two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy the preset relationship, and the adjacent correction point is the point in the correction point set adjacent to the correction point;

[0272] The correction point is corrected according to the second distance and a second angle between the straight line where the first side is located and the reference straight line.

[0273] In some embodiments, the correction module 1203 is specifically configured to:

[0274] When the second distance is less than the distance threshold and the second angle is greater than or equal to the second angle threshold, a target edge with a preset condition is determined from the two edges constituting the correction point, and an intersection point of a straight line where the target edge is located and a reference straight line is determined as a corrected point;

[0275] When the second distance is greater than or equal to the distance threshold, and / or the second angle is greater than the second angle threshold, determining a third angle between the straight line where two sides constituting the calibration point are located and the reference straight line;

[0276] When each third angle is greater than or equal to the third angle threshold, the average of the intersections of the straight lines on which the two sides constituting the correction point are located and the reference straight line is determined as the corrected point;

[0277] In the case where at least one of the third angles is smaller than the third angle threshold, the projection point of the correction point on the reference straight line is determined as the corrected point.

[0278] Fig.12 Each module in the device shown has the function of realizing Figure 1-Figure 11 The functions of each step in the process can achieve the corresponding technical effects, so for the sake of brevity, they will not be described in detail here.

[0279] Based on the same inventive concept, the embodiment of the present application further provides an electronic device, which may be a server. Fig.13 The electronic device provided in the embodiments of the present application is described in detail.

[0280] like Fig.13 As shown, the electronic device 1300 may include a processor 1310 and a memory 1320 for storing computer program instructions.

[0281] The processor 1310 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0282] The memory 1320 may include a large capacity memory for data or instructions. For example, but not limitation, the memory 1320 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 1320 may include a removable or non-removable (or fixed) medium, or the memory 1320 is a non-volatile solid-state memory. In one example, the memory 1320 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM) or a flash memory or a combination of two or more of these.

[0283] The processor 1310 reads and executes the computer program instructions stored in the memory 1320 to implement Figure 1-Figure 11 The method in the embodiment shown in the figure is achieved Figure 1-Figure 11 The corresponding technical effects achieved by executing the method in the illustrated embodiment are not described in detail here for the sake of brevity.

[0284] In one example, the electronic device 1300 may further include a communication interface 1330 and a bus 1340. Fig.13 As shown, the processor 1310, the memory 1320, and the communication interface 1330 are connected via a bus 1340 and communicate with each other.

[0285] The communication interface 1330 is mainly used to implement communication between various modules, devices and / or equipment in the embodiments of the present application.

[0286] Bus 1340 includes hardware, software or both, and each component of electronic device 1300 is coupled to each other. For example, but not limitation, bus 1340 may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), Hyper Transport (Hyper Transport, HT) interconnection, industry standard architecture (Industry Standard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1340 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0287] After obtaining the corner point set and the graphic features of the hand-drawn graphic, the electronic device can execute the graphic correction method in the embodiment of the present application, thereby realizing the combination of Figure 1-Figure 11 The described graphics correction method and Fig.12 A graphic correction device is described.

[0288] In addition, in combination with the graphic correction method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any graphic correction method in the above embodiment is implemented.

[0289] In addition, an embodiment of the present application also provides a computer program product, including a computer program, which is executed by at least one processor to implement the various processes of the above-mentioned graphics correction method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0290] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A graphics correction method, It is characterized in that include: Acquire a corner point set and a graphic feature of a hand-drawn graphic, wherein the corner point set is obtained by processing a touch point set of the hand-drawn graphic collected during the graphic drawing process, and the graphic feature is determined based on the corner point set; According to the graphic features, determining a correction point set that needs to be corrected from the corner point set; Determining a reference straight line according to the calibration point set and the graphic features; The correction points in the correction point set are corrected according to the reference straight line to obtain a corrected hand-drawn figure.

2. The method according to claim 1, It is characterized in that The step of determining a correction point set to be corrected from the corner point set according to the graphic features includes: Determining a correction direction according to the graphic features; Determine a first distance from each corner point in the corner point set to a reference straight line where the correction direction is located; The correction point set is determined from the corner point set according to each of the first distances.

3. The method according to claim 2, It is characterized in that The step of determining the correction direction according to the graphic features comprises: In the case where the hand-drawn figure is a symmetrical figure, the direction of the symmetry axis of the hand-drawn figure and / or the direction of the perpendicular line of the symmetry axis are determined as the correction direction; In the case that the hand-drawn figure is an asymmetric figure, the horizontal direction and / or the direction perpendicular to the horizontal direction is determined as the correction direction.

4. The method according to claim 2, It is characterized in that The determining of a first distance from each corner point in the corner point set to a reference straight line where the correction direction is located includes: The following operations are performed for each corner point in the corner point set: Taking the kink point as a reference point, determining a straight line passing through the kink point and parallel to the correction direction as a reference straight line; Determine a first distance from other inflection points to the reference straight line, wherein the other inflection points are all inflection points in the inflection point set except the inflection point.

5. The method according to claim 2, It is characterized in that The step of determining the correction point set from the corner point set according to each of the first distances comprises: When there is a candidate distance satisfying the first distance condition in each of the first distances, and the number of corner points corresponding to the candidate distances is greater than or equal to a first value, obtaining a candidate point set according to the corner points corresponding to the candidate distances; In the case where the remaining point set is not empty, determining a candidate straight line according to the candidate point set and the graphic features, the remaining point set being a point set in the corner point set excluding the candidate point set; The correction point set is determined according to the second distance between each remaining point in the remaining point set and the candidate straight line.

6. The method according to claim 5, It is characterized in that The step of determining the correction point set according to the second distance between each remaining point in the remaining point set and the candidate straight line comprises: When the second distance does not satisfy a second distance condition, determining the candidate point set as the correction point set; When the second distance satisfies the second distance condition, determining whether the remaining points corresponding to the second distance satisfy an adjacent relationship with each candidate point in the candidate point set; When it is determined that the remaining points corresponding to the second distance do not satisfy the adjacent relationship with each candidate point in the candidate point set, the remaining points corresponding to the second distance are added to the candidate point set, and the updated candidate point set is determined as the correction point set; When it is determined that the remaining points corresponding to the second distance satisfy an adjacent relationship with each candidate point in the candidate point set, the candidate point set is determined as the correction point set.

7. The method according to claim 1, It is characterized in that The step of determining a reference straight line according to the calibration point set and the graphic features comprises: Determining a reference slope of the reference straight line according to the graphic features; For each correction point in the correction point set, determining an angle constituting the correction point and a length of a side constituting the correction point according to the corner point set; Determining the weight of each of the calibration points according to the angle and length corresponding to each of the calibration points; When the slope of the reference straight line is the reference slope, a reference intercept of the reference straight line is determined according to the weight of each of the correction points.

8. The method according to claim 7, It is characterized in that When the slope of the reference straight line is the reference slope, determining the reference intercept of the reference straight line according to the weight of each correction point includes: When the slope of the reference straight line is the reference slope, determining a first intercept corresponding to each of the calibration points; For each of the correction points, calculating a product value of a weight of the correction point and a corresponding first intercept; The product values ​​of the correction points are summed, and the sum result is determined as the reference intercept.

9. The method according to claim 1, It is characterized in that The step of correcting the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure includes: In the case where the correction points in the correction point set have been corrected along the first correction direction, the projection point of the correction point on the reference straight line is determined as the corrected point, and the first correction direction is a direction other than the correction direction corresponding to the reference straight line; in the case where the correction points in the correction point set have not been corrected, the correction points are corrected according to the start and end features of the correction points, the features of the edges constituting the correction points, and the reference straight line; the correction point set is cleared, and the operation of determining the correction point set is continuously returned to, until the traversal of the corner point set is completed; The corrected points are used to replace the corresponding corner points in the corner point set to obtain a corrected hand-drawn figure.

10. The method according to claim 9, It is characterized in that The step of correcting the correction point according to the start and end features of the correction point, the features of the edges constituting the correction point, and the reference straight line comprises: When the correction point is an endpoint of the hand-drawn figure and the side constituting the correction point is not a curve, determining whether the hand-drawn figure is a closed figure; When the hand-drawn figure is a closed figure, the correction point is corrected according to the drawing direction and the first angle between the straight line where two sides constituting the correction point are located and the reference straight line; In the case that the hand-drawn figure is a non-closed figure, the intersection of the straight line where the side constituting the correction point is located and the reference straight line is determined as the corrected point.

11. The method according to claim 10, It is characterized in that The step of correcting the correction point according to a first angle between a straight line where two sides constituting the correction point are located and the reference straight line comprises: When each of the first angles is greater than or equal to the first angle threshold, determining the intersection of the straight line on which the two sides constituting the correction point are located and the reference straight line, and determining the average value of the intersection as the corrected point; When at least one of the first angles is smaller than the first angle threshold, a target edge satisfying a preset condition is determined from the two edges constituting the correction point, and the intersection of the straight line where the target edge is located and the reference straight line is determined as the corrected point.

12. The method according to claim 9, It is characterized in that The step of correcting the correction point according to the start and end features of the correction point, the features of the edges constituting the correction point, and the reference straight line comprises: When the correction point is not an endpoint of the hand-drawn figure, or when the correction point is an endpoint of the hand-drawn figure and the side constituting the correction point is a curve, determining whether both sides constituting the correction point are straight lines; In the case where at least one of the two sides constituting the correction point is not a straight line, determining the projection point of the correction point on the reference straight line as the corrected point; In the case where both sides constituting the correction point are straight lines, determining a point in the corner point set adjacent to the correction point, a second distance between the adjacent point and the reference straight line, and a first side of the two sides constituting the correction point whose relationship with the adjacent correction point does not satisfy a preset relationship, the adjacent correction point being a point in the correction point set adjacent to the correction point; The correction point is corrected according to the second distance and a second angle between a straight line on which the first edge is located and a reference straight line.

13. The method according to claim 12, It is characterized in that The step of correcting the correction point according to the second distance and a second angle between a straight line where the first edge is located and a reference straight line includes: When the second distance is less than a distance threshold and the second angle is greater than or equal to a second angle threshold, determining a target edge with a preset condition from two edges constituting the correction point, and determining an intersection of a straight line where the target edge is located and the reference straight line as a corrected point; When the second distance is greater than or equal to a distance threshold, and / or the second angle is greater than a second angle threshold, determining a third angle between a straight line where two sides constituting the calibration point are located and the reference straight line; When each of the third angles is greater than or equal to the third angle threshold, the average of the intersections of the straight lines on which the two sides constituting the correction point are located and the reference straight line is determined as the corrected point; In the case where at least one of the third angles is smaller than a third angle threshold, the projection point of the correction point on the reference straight line is determined as a corrected point.

14. A graphics correction device, It is characterized in that include: An acquisition module, a determination module and a correction module; The acquisition module is used to acquire a corner point set and graphic features of a hand-drawn graphic, wherein the corner point set is obtained by processing a touch point set of the hand-drawn graphic collected during the graphic drawing process, and the graphic features are determined based on the corner point set; The determination module is used to determine the correction point set that needs to be corrected from the corner point set according to the graphic features; and determine the reference straight line according to the correction point set and the graphic features; The correction module is used to correct the correction points in the correction point set according to the reference straight line to obtain a corrected hand-drawn figure.

15. An electronic device, It is characterized in that include: processor; a memory for storing computer program instructions; When the computer program instructions are executed by the processor, the method according to any one of claims 1 to 13 is implemented.

Citation Information

Patent Citations

  • Scanning apparatus and method having image correction function

    CN101170627A

  • Display equipment and geometric figure recognition method

    CN112181207A

  • Graph generation method and device, computer equipment and storage medium

    CN113763505A

  • Freehand graph normalizing method, electronic equipment and storage medium

    CN113888546A

  • Method and device for correcting hand-drawn triangle and storage medium

    CN117011423A

Cited By

  • Layout chart generation method and device, electronic equipment and storage medium

    CN122597580A