Graph correction method, apparatus and device

CN118864327BActive Publication Date: 2026-09-15SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

[0003]在绘制图形的过程中,由于手的不稳定等原因容易导致用户实际绘制出的图形与期望的图形存在一定的偏差

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118864327B_ABST
    Figure CN118864327B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a kind of graphic correction method, device and equipment, it is related to computer technical field.The embodiment of the application can first determine the correction point set needing correction from the corner point set of hand-drawn figure according to the figure feature of hand-drawn figure, then determine reference straight line based on correction point set and figure feature, and then correct the correction point in correction point set based on reference straight line, the correction of original hand-drawn figure is realized, so that the figure after correction can be closer to the expectation of user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and device for image correction. Background Technology

[0002] With the development of internet and large-screen technologies, using devices such as writing tablets and electronic whiteboards for teaching has gradually become a new teaching method. In the teaching process, users often need to manually draw some graphics.

[0003] During the drawing process, factors such as hand instability can easily lead to discrepancies between the user's actual drawing and the desired image. Therefore, it is necessary to correct the original hand-drawn image. Summary of the Invention

[0004] This application provides a graphic correction method, apparatus, and device that can correct a user's hand-drawn graphics.

[0005] In a first aspect, embodiments of this application provide a graphic correction method, including:

[0006] The corner point set and graphic features of the hand-drawn graphic are obtained. The corner point set is obtained by processing the 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] Based on the graphic features, determine the set of correction points that need to be corrected from the set of corner points;

[0008] Determine the reference line based on the set of correction points and graphic characteristics;

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

[0010] Secondly, embodiments of this application provide a graphic correction device, including: an acquisition module, a determination module, and a correction module;

[0011] The acquisition module is used to acquire the corner point set and the graphic features of the hand-drawn graphic. The corner point set is obtained by processing the 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] The determination module is used to determine the set of correction points that need to be corrected from the set of corner points based on the graphic features; and to determine the reference line based on the set of correction points and the graphic features.

[0013] The correction module is used to correct the correction points in the correction point set according to the reference line, so as to obtain the corrected hand-drawn graphic.

[0014] Thirdly, embodiments of this application provide an electronic device, including:

[0015] processor;

[0016] Memory is used to store computer program instructions;

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

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

[0019] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.

[0020] This application embodiment can first determine the set of correction points to be corrected from the set of corner points of the hand-drawn graphic based on the graphic features of the hand-drawn graphic, then determine the reference line based on the set of correction points and graphic features, and then correct the correction points in the set of correction points based on the reference line, thereby realizing the correction of the original hand-drawn graphic, so that the corrected graphic is closer to the user's expectations. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating a graphic correction method provided in this application embodiment;

[0023] Figure 2 A flowchart illustrating another graphic correction method provided in this application embodiment;

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

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

[0026] Figure 5 A schematic diagram illustrating the process of determining a set of correction points as provided in an embodiment of this application;

[0027] Figure 6 A flowchart illustrating another graphic correction method provided in this application embodiment;

[0028] Figure 7A flowchart illustrating another graphic correction method provided in this application embodiment;

[0029] Figure 8 A flowchart for correcting correction points in a correction point set is provided as an embodiment of this application;

[0030] Figure 9 A schematic diagram of a hand-drawn graphic provided for an embodiment of this application;

[0031] Figure 10 This is a partially enlarged schematic diagram of a hand-drawn graphic provided in an embodiment of this application;

[0032] Figure 11 This application provides a schematic diagram of a process for correcting correction points in an embodiment of the present application.

[0033] Figure 12 A structural diagram of a graphic correction device provided in an embodiment of this application;

[0034] Figure 13 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

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

[0036] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0037] The graphic correction method provided in this 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, apparatus, and device provided in this application will be described in detail below through specific embodiments.

[0039] Figure 1 A flowchart of a graphic correction method provided in this application embodiment is shown below. Figure 1 As shown, the graphic correction method may include the following steps:

[0040] S110. Obtain the set of corner points and the graphic features of the hand-drawn graphic.

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

[0042] S120. Based on the graphic characteristics, determine the set of correction points that need to be corrected from the set of corner points.

[0043] S130. Determine the reference line based on the set of correction points and graphic characteristics.

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

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

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

[0047] In S110, the touch point set can be a collection of touch points collected by the user during the process of drawing hand-drawn graphics. 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 according to the sampling frequency. The sampling frequency can be set according to actual needs.

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

[0049] The corner point set, also known as the key point set, 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 touch points with curvature greater than a curvature threshold are identified as corner points and added to the corner point set N. Of course, the corner point set can also be determined in other ways. For example, the corner point set can be represented as N{(x0,y0),(x... p ,y p )...,(x n ,y n )}, where (x0, y0) represents the starting point of the stroke, that is, the starting point of the hand-drawn graphic, (x n ,y n () is the starting point of the pen, which is also the ending point of the hand-drawn graphic.

[0050] Graphic features can be features used to characterize the features of hand-drawn figures, and may include symmetrical and asymmetrical figures. Graphic features can be determined based on a set of corner points, and the specific determination process is not limited in the embodiments of this application.

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

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

[0053] For example, a set of correction points that need to be corrected can be determined from a set of corner points based on graphic features. For instance, the correction direction can be determined based on graphic features, and then whether the corner point needs correction can be determined based on the distance of the corner point from the perpendicular direction to the correction direction.

[0054] For example, graphic features and corner point sets can also be input into the correction model, and the correction model can output the correction point set that needs to be corrected.

[0055] In S130, the reference line serves as the basis for graphic correction. That is, in this embodiment of the application, the correction points in the correction point set are corrected based on the reference line to obtain the corrected hand-drawn graphic.

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

[0057] For example, the set of correction points and graphic features can also be input into the line determination model, and the line determination model can output a reference line.

[0058] In S140, once the reference line is determined, it can be used to perform corrections using the reference line and the correction points in the correction point set, making the corrected hand-drawn graphic closer to the user's expectations.

[0059] For example, the projected point of the correction point on the reference line can be determined as the corrected point, or the corrected point can be determined based on the intersection point or / or the angle between the side constituting the point and the reference line.

[0060] For example, the above correction process can be an iterative process. That is, the set of correction points and the reference line are different in different iterations. For example, in the first iteration, the set of correction points can be determined first, the corresponding reference line can be obtained, and the correction points in the set of correction points can be corrected using the reference line. Then, the points in the set of correction points can be deleted from the set of corner points. Then, the set of correction points and the corresponding reference line can be determined again from the remaining corner points, until all the points in the set of corner points have been traversed.

[0061] The process of determining the correction point set is illustrated below through specific examples. Figure 2 As shown, the graphic correction method may include the following steps:

[0062] S210. Obtain the set of corner points and the graphic features of the hand-drawn graphic.

[0063] S220. Determine the correction direction based on the graphic characteristics.

[0064] S230. Determine the first distance from each corner point in the corner point set to the reference line containing the correction direction.

[0065] S240. Determine the set of correction points from the set of corner points based on each first distance.

[0066] S250. Determine the reference line based on the set of correction points and graphic characteristics.

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

[0068] The processes of S210, S250, and S260 can be found in the above embodiments, and will not be repeated here for the sake of brevity.

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

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

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

[0072] When the hand-drawn graphic is asymmetrical, the horizontal direction and / or the vertical direction of the horizontal direction are determined as the correction direction.

[0073] That is, when the hand-drawn graphic is a symmetrical graphic, such as Figure 3 As shown, the direction of the axis of symmetry l1 can be determined as the correction direction. Alternatively, the perpendicular direction of the axis of symmetry l2 can also be determined as the correction direction. Furthermore, both the direction of the axis of symmetry l1 and the perpendicular direction of the axis of symmetry l2 can be used as correction directions. That is, the embodiments of this application can correct hand-drawn graphics from multiple directions, making the corrected hand-drawn graphics closer to the user's expectations.

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

[0075] For example, the correction direction can be the slope of a reference line. For instance, when the hand-drawn figure is symmetrical, the slope k of the reference line is 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 asymmetrical, the slope k of the reference line is 0 and / or a larger value.

[0076] Based on the graphic features of hand-drawn graphics, the embodiments of this application can more accurately determine the correction direction of hand-drawn graphics, so that the hand-drawn graphics can be corrected along the correction direction, thereby improving the accuracy of the correction results.

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

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

[0079] For example, the point corresponding to the average value of each corner point can be used as the reference point, or each corner point can be used as the reference point.

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

[0081] Perform the following operations for each corner point in the corner point set:

[0082] Using the corner point as the reference point, determine the straight line that passes through the corner point and is parallel to the correction direction as the reference straight line;

[0083] Determine the first distance from other corner points to the baseline line. Other corner points are all corner points in the corner point set except for the corner point itself.

[0084] For example, such as Figure 4 As shown, assuming the set of corner points includes 5 corner points, namely a, b, c, d, and e, taking the correction direction as the horizontal direction as an example, we can first take corner point a as the reference point and obtain the reference line a1 that passes through corner point a and is parallel to the horizontal direction. At this time, we can calculate the first distance from b, c, d, and e to the reference line a1.

[0085] Similarly, by taking corner point b, corner point c, corner point d, and corner point e as reference points, the corresponding reference lines can be obtained, and then the first distance from the other corner points to the reference lines can be obtained.

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

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

[0088] In this embodiment, each corner point in the corner point set can be used as a reference point, and a reference straight line can be obtained by combining the correction direction. Then, the first distance from each corner point to the reference straight line can be obtained, which provides an accurate basis for subsequently determining the correction point set.

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

[0090] For example, a candidate point set can be initially determined from the set of corner points based on the first distance, and a correction point set can be further determined based on the candidate point set and graphic features.

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

[0092] If there are candidate distances that satisfy the first distance conditions among each first distance, and the number of corner points corresponding to the candidate distances is greater than or equal to the first value, then the candidate point set is obtained based on the corner points corresponding to the candidate distances.

[0093] If the remaining point set is not empty, candidate lines are determined based on the candidate point set and graphic features. The remaining point set is the set of points in the corner point set excluding the candidate point set.

[0094] The set of correction points is determined based on the first distance between each remaining point in the set of remaining points and the candidate line.

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

[0096] For example, if there is no first distance that satisfies the first distance condition, the process can end directly, that is, there is no need to correct the hand-drawn graphic.

[0097] For example, in the embodiments of this application, the first distances less than the distance threshold can be selected from each first distance, and then the smallest W first distances can be determined from the selected first distances as candidate distances.

[0098] If the number of corner points corresponding to a candidate distance is greater than or equal to 2, meaning there are at least two candidate distances, then the two smallest candidate distances can be selected, and the corner points corresponding to these two candidate distances can be used to obtain a candidate point set. If the number of corner points corresponding to a candidate distance is less than 2, the process can be terminated directly, and no further correction strategies will be applied to the hand-drawn graphic.

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

[0100] An empty set of remaining points indicates that the candidate point set is the set of corner points, meaning that the set of corner points contains only two corner points. A non-empty set of remaining points indicates that the set of corner points includes other corner points besides the candidate point set.

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

[0102] For example, if the second distance does not meet the second distance condition, the candidate point set is determined as the correction point set;

[0103] If the second distance satisfies the second distance condition, determine whether the remaining point corresponding to the second distance satisfies the adjacency relationship with each candidate point in the candidate point set;

[0104] If the remaining point corresponding to the second distance does not satisfy the adjacency relationship with each candidate point in the candidate point set, the remaining point corresponding to the second distance is added to the candidate point set, and the updated candidate point set is determined as the correction point set.

[0105] If the remaining points corresponding to the second distance satisfy the adjacency relationship with each candidate point in the candidate point set, the candidate point set is determined as the correction point set.

[0106] For example, the second distance condition may include a second distance less than a distance threshold. That is, if there are no remaining points in the remaining point set whose second distance to the candidate 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 remaining points in the remaining point set whose second distance to the candidate line is greater than or equal to the distance threshold, the adjacency relationship between these remaining points and each candidate point in the candidate point set can be further determined. When there are multiple remaining 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 these remaining points.

[0108] The adjacency relationship can include whether the remaining point and each candidate point satisfy the adjacency relationship or not. Satisfying the adjacency relationship means that the remaining point and each candidate point form a three-point adjacency relationship. Taking a candidate point set including p1 and p2, and a remaining point p3 as an example, when p1, p2, and p3 are three adjacent points in the corner point set, these three points can be considered to satisfy the adjacency relationship. For example, p1, p2, and p3 can be adjacent sequentially, or p1, p3, and p2 can be adjacent sequentially, or p3, p2, and p1 can be adjacent sequentially.

[0109] For example, if the remaining point satisfies the adjacency relationship with each candidate point in the candidate point set, the candidate point set can be directly determined as the correction point set. If the remaining point does not satisfy the adjacency relationship with each candidate point in the candidate point set, the remaining point can be added to the candidate point set to obtain the updated candidate point set, and the updated candidate point set can be determined as the correction point set.

[0110] In other words, this embodiment of the application can first filter candidate distances that meet the first distance condition from the set of corner points to obtain a candidate point set and a candidate line. Then, when the remaining point set is not empty, the correction point set is further determined based on the distance relationship between the remaining points in the remaining point set and the candidate lines. Because the candidate point set and candidate lines change in different iterations, this embodiment of the application can dynamically adjust the candidate lines, thereby more accurately determining the points that need to be corrected, providing a more accurate basis for the correction of hand-drawn graphics.

[0111] Taking the set of corner points N containing at least two corner points as an example, the following is combined with... Figure 5 The process of determining the set of correction points is explained.

[0112] S510. Determine the first distance from each corner point in the corner point set to the reference line where the correction direction is located.

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

[0114] S530. Determine if 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. Remove the points in N2 from N, determine the candidate line l3 based on N2, and determine the point p3 from the remaining point set whose distance to the candidate line l3 is less than the distance threshold and has the smallest distance.

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

[0117] S560. Add p3 to N2, and determine the updated N2 as the set of correction points. Use the updated N2 to determine a reference line, and use the reference line to correct the points in the updated N2.

[0118] S570. N2 is determined as the set of correction points, and a reference line is determined using N2. The points in N2 are then corrected using the reference line.

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

[0120] S590, Correction complete. That is, if the N2 point set does not exist, the subsequent correction strategy will not be executed, and the correction process ends.

[0121] Determining the reference line involves determining its slope and intercept. The following specific examples illustrate the process of determining the reference line. Figure 6 As shown, the graphic correction method may include the following steps:

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

[0123] S620. Based on the graphic characteristics, determine the set of correction points that need to be corrected from the set of corner points.

[0124] S630. Determine the reference slope of the reference line based on the graphic characteristics.

[0125] S640. 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 based on the set of corner points.

[0126] S650. Determine the weight of each correction point based on the angle and length corresponding to each correction point.

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

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

[0129] The processes of S610, S620, and S670 can be found in the above embodiments, and will not be repeated here for the sake of brevity.

[0130] The other steps described above are explained below:

[0131] In S630, the reference slope is the slope of the reference line. The reference slope can be determined according to the characteristics of the figure. For example, when the hand-drawn figure is symmetrical, the reference slope of the reference 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 figure is asymmetrical, the reference slope of the reference line can be 0 and / or a large 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 can be determined based on the set of corner points.

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

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

[0135] When the two sides constituting the correction point are curves, the midpoint of the curve can be taken, and vector V1 can be formed based on the correction point and the midpoint. If the other side is also a curve, vector V2 can be obtained in a similar way. Otherwise, vector V2 can be obtained by following the method of using a straight line.

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

[0137] In S650, the weight of each correction point can be determined based on the angle and length corresponding to each correction point.

[0138] For example, the angle and length corresponding to each correction point can be input into the weight calculation model to obtain the weight of each correction point.

[0139] For example, the weights of each correction point can also be determined in the following manner:

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

[0141] The weight of each correction point is determined based on its first and second proportions.

[0142] For example, Among them, angleSclae i Let 'angle' be the angle weight corresponding to the i-th correction point, also known as the first weight. i Let be the angle corresponding to the i-th correction point. Let n be the sum of the angles corresponding to all correction points in the correction point set, and n be the number of correction points in the correction point set.

[0143] For example, Among them, lenSclae i Let len ​​be the length proportion corresponding to the i-th correction point, which is also the second proportion. i Let be the length of the edge corresponding to the i-th correction point. This is the sum of the lengths of the edges corresponding to all correction points in the correction point set.

[0144] The weight of each correction point can be determined based on its first and second weights. For example, the first and second weights of each correction point can be input into the weight calculation model to obtain the weight of each correction point.

[0145] For example, the weight of each correction point can also be determined by the following formula:

[0146]

[0147] Where, weight i Let be the weight of the i-th correction point.

[0148] In this embodiment, for each correction point, the angle and length corresponding to that correction point can be determined separately. By combining the angle and length proportions of all correction points in the correction point set, the angle proportion and length proportion of that correction point can be obtained. Furthermore, based on the angle and length proportions of each correction point, the weight of each correction point can be obtained. That is, this embodiment can determine the weight of each correction point based on the relationship between the angle and length proportions of each correction point in the correction point set, considering more comprehensive factors and thus determining the weight of each correction point more accurately, providing a more accurate basis for subsequently determining the intercept of the reference line.

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

[0150] For example, when the slope of the reference line is the reference slope, the first intercept corresponding to each correction point is determined;

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

[0152] Sum the product values ​​of each correction point and use the summation result as the reference intercept.

[0153] According to y = k*x + b, we can obtain b = yk*x. Therefore, when the slope of the reference line is the reference slope, we can substitute each correction point into the intercept formula above to obtain b. i =y i -k*x i By combining the weights corresponding to each correction point, the reference intercept of the reference line can be obtained.

[0154] For example, Where b is the reference intercept, b i Let be the first intercept corresponding to the i-th correction point. That is, by weighting and summing the first intercept for each correction point, we can obtain the total intercept, which is also the reference intercept.

[0155] The embodiments of this application determine the reference intercept of the reference line based on the first intercept of each correction point under 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 line.

[0156] The calibration process of the calibration points is explained below through specific examples. Figure 7 As shown, the graphic correction method may include the following steps:

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

[0158] S720. Based on the graphic characteristics, determine the set of correction points that need to be corrected from the set of corner points.

[0159] S730. Determine the reference line based on the set of correction points and graphic characteristics.

[0160] S740. If 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 line is determined as the corrected point. The first correction direction is the direction other than the correction direction corresponding to the reference line. If the correction points in the correction point set have not been corrected, the correction points are corrected according to the start and end characteristics of the correction points, the characteristics of the edges constituting the correction points, and the reference line. The correction point set is cleared, and the operation of determining the correction point set is returned until the traversal of the folded corner point set is completed.

[0161] S750. Replace the corresponding corner points in the corner point set with the corrected points to obtain the corrected hand-drawn graphic.

[0162] The processes S710-S730 can be found in the above embodiments.

[0163] For example, in the embodiments of this application, a set of correction points can be initially determined from the set of corner points, and a corresponding reference line can be obtained. After the correction points in the set of correction points are corrected using the reference line, the remaining set of corner points can be traversed to execute the next iteration. That is, the embodiments of this application can cyclically execute the above process until the entire set of corner points has been traversed.

[0164] By replacing the corresponding correction point with all the corrected points, you can obtain the corrected hand-drawn graphic.

[0165] This application embodiment improves the accuracy of graphic correction results by traversing the set of corner points multiple times and dynamically adjusting the reference line, making the corrected hand-drawn graphic closer to the user's expectations.

[0166] Taking the correction of a hand-drawn graphic along multiple directions as an example, the first correction direction is the correction direction other than the correction direction corresponding to the reference line. For example, if the hand-drawn graphic is a symmetrical graphic, the correction direction can include the direction of the axis of symmetry and the direction perpendicular to the axis of symmetry. Assuming that the slope of the reference 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 can be the direction perpendicular to the axis of symmetry.

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

[0168] For example, if the correction points in the correction point set have not been corrected before, that is, this correction is the first correction, the correction points can be corrected according to the start and end characteristics of the correction points, the characteristics of the edges constituting the correction points, and the reference line.

[0169] Start and end features are used to characterize whether the correction point is an endpoint of the hand-drawn graphic, that is, whether it is the starting or ending point of the hand-drawn graphic. The features of the edges that make up the correction point can include whether the edges that make up the correction point contain curves.

[0170] Different start and end features and edge features require different correction strategies during the correction process.

[0171] In other words, in the embodiments of this 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 being corrected for the first time, the correction point can be corrected based on the start and end characteristics of the correction point and the characteristics of the sides constituting the correction point, combined with the reference line. This improves the diversity of correction methods and ensures the accuracy of the correction results.

[0172] When this correction point is being corrected for the first time, it can be determined whether the correction point is an endpoint of the hand-drawn graphic and whether the edge constituting the correction point is a curve. Based on the judgment results, an appropriate correction strategy can be adopted to correct the correction point.

[0173] In some embodiments, when the correction point is an endpoint of a hand-drawn graphic and the edge constituting the correction point is not a curve, such as Figure 8 As shown, the above-mentioned "correcting the correction point based on the start and end characteristics of the correction point, the characteristics of the edges constituting the correction point, and the reference line" may include the following steps:

[0174] S810. Determine whether a hand-drawn graphic is a closed shape;

[0175] S820. When the hand-drawn drawing is a closed figure, the correction point is corrected according to the drawing direction and the first angle between the straight line containing the two sides constituting the correction point and the reference line.

[0176] S830. When the hand-drawn graphic is not a closed graphic, the intersection of the straight line containing the edge that constitutes the correction point and the reference straight line shall be determined as the corrected point.

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

[0178] For example, when the hand-drawn drawing is a closed figure, the sides constituting the correction point include two sides. At this time, the first angle between the straight line containing these two sides and the reference straight line can be determined, where the first angle is the angle between the straight line containing the two sides and the reference straight line obtained along the drawing direction.

[0179] like Figure 9 As shown, assuming the drawing direction of the hand-drawn graphic is from bottom to top, as indicated by the arrow, l0 is the reference line, and assuming the corner point 2 is the correction point, then the two sides constituting the correction point 2 can be determined to be m1 and m2 respectively. According to the drawing direction, the angle between the line containing side m1 and the reference line can be determined to be α1, and the angle between the line containing side m2 and the reference line can be determined to be α2. Figure 10 As shown. α1 and α2 are collectively referred to as the first included angle.

[0180] The correction point can be corrected based on the first included angle. For the specific correction process, please refer to the following example.

[0181] For example, when the hand-drawn graphic is a non-closed graphic, the intersection of the straight line containing the edge constituting the correction point and the reference straight line can be directly determined as the corrected point.

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

[0183] For example, the above-mentioned "correcting the correction point based on the first angle between the straight line containing the two sides constituting the correction point and the reference straight line" may include the following steps:

[0184] When all the first included angles are greater than or equal to the first included angle threshold, the intersection point of the straight line containing the two sides constituting the correction point and the reference straight line is determined, and the average value of the intersection points is determined as the corrected point.

[0185] If at least one of the first included angles is less than the first included angle threshold, the target edge that meets the preset conditions is determined from the two edges that constitute the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point.

[0186] The value of the first included angle threshold can be set according to actual needs. For example, when the hand-drawn graphic is a closed graphic, if the included angles between the lines containing the two sides constituting the correction point and the reference line are both large, the average value of the intersection points of the lines containing the two sides constituting the correction point and the reference line can be determined as the corrected point.

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

[0188] The target edge can be, for example, an edge drawn later in the order that constitutes the correction point, or an edge that is unrelated to adjacent correction points. Adjacent correction points can be correction points in the correction point set that are adjacent to the correction point.

[0189] In the case of a closed figure drawn by hand, this embodiment of the application can use different correction strategies to correct the correction point according to the drawing direction and the angle between the two sides of the correction point and the reference line. This allows the correction result to 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 graphic, or when the correction point is an endpoint of a hand-drawn graphic and the edge constituting the correction point is a curve, the above-mentioned "correcting the correction point based on the start and end characteristics of the correction point, the characteristics of the edge constituting the correction point, and the reference line" may include the following steps:

[0191] If the correction point is not an endpoint of the hand-drawn graphic, or if the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is a curve, determine whether both edges constituting the correction point are straight lines.

[0192] If at least one of the two sides constituting the correction point is not a straight line, the projection point of the correction point onto the reference line is determined as the corrected point.

[0193] When both sides constituting the correction point are straight lines, determine the points adjacent to the correction point in the set of corner points, the second distance between the adjacent points and the reference 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. The adjacent correction point is the point in the set of correction points that is adjacent to the correction point.

[0194] The correction point is corrected based on the second distance and the second angle between the line containing the first side and the reference line.

[0195] For example, when the correction point is not an endpoint of the hand-drawn graphic, or when the correction point is an endpoint of the hand-drawn graphic but the edge constituting the correction point is a curve, it can be further determined whether both edges constituting the correction point are straight lines. The correction strategy used differs depending on whether both edges constituting the correction point are straight lines, or at least one edge is not a straight line.

[0196] For example, if at least one of the two sides constituting the correction point is not a straight line, the projection point of the correction point onto the reference straight line can 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 set of corner points need to be corrected, and the second angle between the straight line containing 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 set of corner points need correction, that is, determine whether the second distance between the points adjacent to the correction point in the set of corner points and the reference line meets the correction condition, that is, whether the second distance is less than the distance threshold.

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

[0200] Based on the second distance and the second angle between the line containing the first side and the reference line, the corresponding correction strategy can be determined, and then the correction point can be corrected.

[0201] For example, when the second distance is less than the distance threshold and the second included angle is greater than or equal to the second included angle threshold, the target edge with preset conditions is determined from the two edges constituting the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point.

[0202] If the second distance is greater than or equal to the distance threshold, and / or the second included angle is smaller than the second included angle threshold, determine the third included angle between the straight line containing the two sides constituting the correction point and the reference straight line;

[0203] When all the third included angles are greater than or equal to the third included angle threshold, the average value of the intersection points of the straight lines containing the two sides constituting the correction point and the reference straight line is determined as the corrected point.

[0204] If at least one of the third included angles is less than the third included angle threshold, the projection point of the correction point onto the reference line is determined as the corrected point.

[0205] For example, 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; 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 a distance threshold and the second included angle is greater than or equal to a second included angle threshold, a target edge meeting preset conditions can be determined from the two edges constituting the correction point, and the intersection of the line containing the target edge and the reference line can be determined as the corrected point. The specific determination process can be found in the above embodiments.

[0207] For example, when the second distance is greater than or equal to a distance threshold, and / or the second included angle is less than a second included angle threshold, the third included angle between the lines containing the two sides constituting the correction point and the reference line can be further determined; when both third included angles are greater than or equal to the third included angle threshold, the average value of the intersection points of the lines containing the two sides constituting the correction point and the reference line can be determined as the corrected point; when at least one of the third included angles is less than the third included angle threshold, the projection point of the correction point onto the reference line is determined as the corrected point. The specific determination process can be found in the above embodiments.

[0208] That is, in the embodiments of this application, when the correction point is not the endpoint of the hand-drawn graphic, or when the correction point is the endpoint of the hand-drawn graphic and the edge constituting the correction point is a curve, it can further determine whether the two edges constituting the correction point are both straight lines, thereby adopting different correction strategies, so that the correction result can dynamically change with the start and end characteristics of the correction point and the line type corresponding to the two edges constituting the correction point, thereby improving the accuracy of the correction result.

[0209] The following is combined Figure 11 The specific calibration process for the calibration points is explained.

[0210] S1100: Determine whether the correction point has been corrected in other directions. If yes, execute S1110; otherwise, execute S1120.

[0211] S1110. Determine the projection point of the correction point onto the reference line as the corrected point.

[0212] S1120. Determine whether the correction point is an endpoint of the hand-drawn graphic and whether the edge constituting the correction point is not a curve. If yes, that is, the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is not a curve, then execute S1130. If no, that is, the correction point is not an endpoint of the hand-drawn graphic, or the correction point is an endpoint of the hand-drawn graphic but the edge constituting the correction point is a curve, then execute S1170.

[0213] S1130. Determine whether the hand-drawn graphic is a closed shape. If yes, execute S1140; otherwise, execute S1210.

[0214] S1140. Determine whether the first angle between the two sides of the correction point and the reference line is greater than or equal to the first angle threshold. If yes, execute S1150; otherwise, execute S1160.

[0215] S1150. Determine the intersection points of the straight lines containing the two sides constituting the correction point with the reference straight line, and determine the average value of the intersection points as the corrected point.

[0216] S1160. Determine the target edge that meets the preset conditions from the two edges that constitute the correction point, and determine the intersection of the line containing the target edge and the reference line as the corrected point.

[0217] S1170. Determine whether both sides constituting the correction point are straight lines. If yes, execute S1180; otherwise, execute S1110.

[0218] S1180, Determine the points adjacent to the correction point in the corner point set, the second distance between the adjacent points and the reference 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.

[0219] S1190. Determine whether the second distance is less than the distance threshold and the second included angle is greater than or equal to the second included angle threshold. If yes, that is, the second distance is less than the distance threshold and the second included angle is greater than or equal to the second included angle threshold, then execute S1160. If no, then execute S1200.

[0220] S1200: Determine whether the third angle between the two sides of the correction point and the reference line is greater than or equal to the third angle threshold. If yes, execute S1150; otherwise, execute S1110.

[0221] S1210. The intersection of the straight line containing the edge that forms the correction point and the reference straight line is determined as the corrected point.

[0222] Based on the same inventive concept, this application also provides a graphic correction device, which is described below in conjunction with... Figure 12 The graphic correction device provided in the embodiments of this application will be described in detail.

[0223] Figure 12 This is a structural diagram of a graphic correction device provided in an embodiment of this application.

[0224] like Figure 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 the corner point set and the graphic features of the hand-drawn graphic. The corner point set is obtained by processing the 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 set of correction points that need to be corrected from the set of corner points based on the graphic features; and to determine the reference line based on the set of correction points 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 line to obtain the corrected hand-drawn graphic.

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

[0229] In some embodiments, the determining module 1202 is specifically used for:

[0230] Determine the correction direction based on graphic characteristics;

[0231] Determine the first distance from each corner point in the corner point set to the reference line containing the correction direction;

[0232] Based on each first distance, determine the set of correction points from the set of corner points.

[0233] In some embodiments, the determining module 1202 is specifically used for:

[0234] When the hand-drawn graphic is symmetrical, the direction of the axis of symmetry and / or the direction of the perpendicular line to the axis of symmetry shall be determined as the correction direction.

[0235] When the hand-drawn graphic is asymmetrical, the horizontal direction and / or the vertical direction of the horizontal direction are determined as the correction direction.

[0236] In some embodiments, the determining module 1202 is specifically used for:

[0237] Perform the following operations for each corner point in the corner point set:

[0238] Using the corner point as the reference point, determine the straight line that passes through the corner point and is parallel to the correction direction as the reference straight line;

[0239] Determine the first distance from other corner points to the baseline line. Other corner points are all corner points in the corner point set except for the corner point itself.

[0240] In some embodiments, the determining module 1202 is specifically used for:

[0241] If there are candidate distances that satisfy the first distance conditions among each first distance, and the number of corner points corresponding to the candidate distances is greater than or equal to the first value, then the candidate point set is obtained based on the corner points corresponding to the candidate distances.

[0242] If the remaining point set is not empty, candidate lines are determined based on the candidate point set and graphic features. The remaining point set is the set of points in the corner point set excluding the candidate point set.

[0243] The set of correction points is determined based on the second distance between each remaining point in the set of remaining points and the candidate line.

[0244] In some embodiments, the determining module 1202 is specifically used for:

[0245] If the second distance does not meet the second distance condition, the candidate point set is determined as the correction point set;

[0246] If the second distance satisfies the second distance condition, determine whether the remaining point corresponding to the second distance satisfies the adjacency relationship with each candidate point in the candidate point set;

[0247] If the remaining point corresponding to the second distance does not satisfy the adjacency relationship with each candidate point in the candidate point set, the remaining point corresponding to the second distance is added to the candidate point set, and the updated candidate point set is determined as the correction point set.

[0248] If the remaining points corresponding to the second distance satisfy the adjacency 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 determining module 1202 is specifically used for:

[0250] Based on the characteristics of the graph, determine the reference slope of the reference line;

[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 based on the set of corner points.

[0252] The weight of each correction point is determined based on the angle and length corresponding to each correction point.

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

[0254] In some embodiments, the determining module 1202 is specifically used for:

[0255] Given that the slope of the reference line is the reference slope, determine the first intercept corresponding to each correction point;

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

[0257] Sum the product values ​​of each correction point and use the summation result as the reference intercept.

[0258] In some embodiments, the correction module 1203 is specifically used for:

[0259] If 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 line is determined as the corrected point. The first correction direction is any direction other than the correction direction corresponding to the reference line. If the correction points in the correction point set have not been corrected, the correction points are corrected according to the start and end characteristics of the correction points, the characteristics of the edges constituting the correction points, and the reference line. The correction point set is cleared, and the operation of determining the correction point set is returned until the traversal of the folded corner point set is completed.

[0260] By replacing the corresponding corner points in the corner point set with the corrected points, the corrected hand-drawn graphic is obtained.

[0261] In some embodiments, the correction module 1203 is specifically used for:

[0262] If the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is not a curve, determine whether the hand-drawn graphic is a closed graphic.

[0263] When the hand-drawn drawing is a closed shape, the correction point is corrected according to the drawing direction and the first angle between the straight line containing the two sides constituting the correction point and the reference line.

[0264] When the hand-drawn graphic is not a closed shape, the intersection of the line containing the edge that forms the correction point and the reference line is determined as the corrected point.

[0265] In some embodiments, the correction module 1203 is specifically used for:

[0266] When all the first included angles are greater than or equal to the first included angle threshold, the intersection point of the straight line containing the two sides constituting the correction point and the reference straight line is determined, and the average value of the intersection points is determined as the corrected point.

[0267] If at least one of the first included angles is less than the first included angle threshold, the target edge that meets the preset conditions is determined from the two edges that constitute the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point.

[0268] In some embodiments, the correction module 1203 is specifically used for:

[0269] If the correction point is not an endpoint of the hand-drawn graphic, or if the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is a curve, determine whether both edges constituting the correction point are straight lines.

[0270] If at least one of the two sides constituting the correction point is not a straight line, the projection point of the correction point onto the reference line is determined as the corrected point.

[0271] When both sides constituting the correction point are straight lines, determine the points adjacent to the correction point in the set of corner points, the second distance between the adjacent points and the reference 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. The adjacent correction point is the point in the set of correction points that is adjacent to the correction point.

[0272] The correction point is corrected based on the second distance and the second angle between the line containing the first side and the reference line.

[0273] In some embodiments, the correction module 1203 is specifically used for:

[0274] If the second distance is less than the distance threshold and the second included angle is greater than or equal to the second included angle threshold, the target edge with preset conditions is determined from the two edges constituting the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point.

[0275] If the second distance is greater than or equal to the distance threshold, and / or the second included angle is smaller than the second included angle threshold, determine the third included angle between the straight line containing the two sides constituting the correction point and the reference straight line;

[0276] When all the third included angles are greater than or equal to the third included angle threshold, the average value of the intersection points of the straight lines containing the two sides constituting the correction point and the reference straight line is determined as the corrected point.

[0277] If at least one of the third included angles is less than the third included angle threshold, the projection point of the correction point onto the reference line is determined as the corrected point.

[0278] Figure 12 Each module in the illustrated device has the ability to implement Figures 1-11 The functions of each step and the corresponding technical effects are described briefly and will not be elaborated here.

[0279] Based on the same inventive concept, embodiments of this application also provide an electronic device, which can be a server. The following, in conjunction with... Figure 13 The electronic devices provided in the embodiments of this application will be described in detail.

[0280] like Figure 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), an application-specific integrated circuit (ASIC), or one or more integrated circuits that may be configured to implement the embodiments of this application.

[0282] Memory 1320 may include mass storage for data or instructions. For example, and not limitingly, memory 1320 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 1320 may include removable or non-removable (or fixed) media, or memory 1320 may be non-volatile solid-state memory. In one instance, memory 1320 may be read-only memory (ROM). In one instance, 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 flash memory, or a combination of two or more of these.

[0283] The processor 1310 reads and executes computer program instructions stored in memory 1320 to achieve... Figures 1-11 The method in the illustrated embodiment achieves... Figures 1-11 The corresponding technical effects achieved by the methods in the illustrated embodiments are described briefly and will not be elaborated further here.

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

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

[0286] Bus 1340 includes hardware, software, or both, that couples the various components of electronic device 1300 together. For example, and not as a limitation, bus 1340 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 1340 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.

[0287] After acquiring the set of corner points and the graphic features of the hand-drawn graphic, the electronic device can execute the graphic correction method in the embodiments of this application, thereby achieving a combination of... Figures 1-11 The described graphic correction method and Figure 12 The described graphic correction device.

[0288] Furthermore, in conjunction with the image correction methods described in the above embodiments, this application embodiment can provide a computer storage medium for implementation. This computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the image correction methods described in the above embodiments.

[0289] In addition, this 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-described image correction method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0290] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A graphic correction method, characterized in that, include: The corner point set and the graphic features of the hand-drawn graphic are obtained. The corner point set is obtained by processing the touch point set of the hand-drawn graphic collected during the graphic drawing process. The graphic features are determined based on the corner point set. Based on the graphic features, determine the set of correction points that need to be corrected from the set of corner points; Based on the set of correction points and the graphic features, a reference straight line is determined; The correction points in the correction point set are corrected according to the reference line to obtain the corrected hand-drawn graphic; The step of determining the reference line based on the set of correction points and the graphic features includes: Based on the aforementioned graphic features, determine the reference slope of the reference line; For each correction point in the set of correction points, the angle constituting the correction point and the length of the side constituting the correction point are determined according to the set of corner points. The weight of each correction point is determined based on the first weight of the angle corresponding to each correction point and the sum of the angles corresponding to all correction points in the correction point set, and the first weight of the length of the side corresponding to the correction point and the sum of the lengths of the sides corresponding to all correction points in the correction point set. When the slope of the reference line is the reference slope, the reference intercept of the reference line is determined according to the weight of each of the correction points.

2. The method according to claim 1, characterized in that, The step of determining the set of correction points to be corrected from the set of corner points based on the graphic features includes: The correction direction is determined based on the aforementioned graphic features; Determine the first distance from each corner point in the set of corner points to the reference line containing the correction direction; The set of correction points is determined from the set of corner points based on each of the first distances.

3. The method according to claim 2, characterized in that, Determining the correction direction based on the graphic features includes: When the hand-drawn graphic is a symmetrical graphic, the direction of the axis of symmetry of the hand-drawn graphic and / or the direction of the perpendicular line to the axis of symmetry are determined as the correction direction; In the case where the hand-drawn graphic is asymmetrical, the horizontal direction and / or the vertical direction of the horizontal direction are determined as the correction direction.

4. The method according to claim 2, characterized in that, Determining the first distance from each corner point in the set of corner points to the reference line containing the correction direction includes: For each corner point in the set of corner points, perform the following operations: Using the corner point as a reference point, a straight line passing through the corner point and parallel to the correction direction is determined as the reference straight line; Determine the first distance from other corner points to the reference line, wherein the other corner points are all corner points in the set of corner points other than the corner point itself.

5. The method according to claim 2, characterized in that, Determining the set of correction points from the set of corner points based on each of the first distances includes: If there exists a candidate distance that satisfies the first distance condition among each of the first distances, 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 based on the corner points corresponding to the candidate distance; If the remaining point set is not empty, a candidate straight line is determined based on the candidate point set and the graphic features. The remaining point set is the set of points in the corner point set excluding the candidate point set. The set of correction points is determined based on the second distance between each remaining point in the set of remaining points and the candidate line.

6. The method according to claim 5, characterized in that, The step of determining the correction point set based on the second distance between each remaining point in the remaining point set and the candidate line includes: If the second distance does not meet the second distance condition, the candidate point set is determined as the correction point set; If the second distance satisfies the second distance condition, determine whether the remaining point corresponding to the second distance satisfies the adjacent relationship with each candidate point in the candidate point set; If it is determined that the remaining point corresponding to the second distance does not satisfy the adjacency relationship with each candidate point in the candidate point set, the remaining point corresponding to the second distance is added to the candidate point set, and the updated candidate point set is determined as the correction point set; If the remaining point corresponding to the second distance satisfies the adjacency 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, characterized in that, When the slope of the reference line is the reference slope, determining the reference intercept of the reference line according to the weight of each correction point includes: Given that the slope of the reference line is the reference slope, determine the first intercept corresponding to each of the correction points; For each correction point, calculate the product of the weight of the correction point and the corresponding first intercept; The product values ​​of each of the correction points are summed, and the summation result is determined as the reference intercept.

8. The method according to claim 1, characterized in that, The step of correcting the correction points in the correction point set according to the reference line to obtain the corrected hand-drawn graphic includes: If the correction points in the set of correction points have been corrected along the first correction direction, the projection point of the correction point on the reference line is determined as the corrected point. The first correction direction is a direction other than the correction direction corresponding to the reference line. If the correction points in the set of correction points have not been corrected, the correction points are corrected according to the start and end characteristics of the correction points, the characteristics of the edges constituting the correction points, and the reference line. The set of correction points is cleared, and the operation of determining the set of correction points is returned until the traversal of the set of corner points is completed. The corrected hand-drawn graphic is obtained by replacing the corresponding corner points in the set of corner points with the corrected points.

9. The method according to claim 8, characterized in that, The step of correcting the correction point based on the start and end characteristics of the correction point, the characteristics of the edges constituting the correction point, and the reference line includes: If the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is not a curve, determine whether the hand-drawn graphic is a closed graphic. When the hand-drawn graphic is a closed graphic, the correction point is corrected according to the drawing direction and the first angle between the straight line containing the two sides constituting the correction point and the reference straight line. When the hand-drawn graphic is a non-closed graphic, the intersection of the straight line containing the edge constituting the correction point and the reference straight line is determined as the corrected point.

10. The method according to claim 9, characterized in that, The step of correcting the correction point based on the first angle between the straight line containing the two sides constituting the correction point and the reference straight line includes: When all the first included angles are greater than or equal to the first included angle threshold, the intersection point of the straight line containing the two sides constituting the correction point and the reference straight line is determined, and the average value of the intersection points is determined as the corrected point. If at least one of the first included angles is less than the first included angle threshold, a target edge that meets the preset condition is determined from the two edges constituting the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point.

11. The method according to claim 8, characterized in that, The step of correcting the correction point based on the start and end characteristics of the correction point, the characteristics of the edges constituting the correction point, and the reference line includes: If the correction point is not an endpoint of the hand-drawn graphic, or if the correction point is an endpoint of the hand-drawn graphic and the edge constituting the correction point is a curve, determine whether both edges constituting the correction point are straight lines. If 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 is determined as the corrected point. When both sides constituting the correction point are straight lines, the points adjacent to the correction point in the set of corner points, the second distance between the adjacent points 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 a preset relationship are determined. The adjacent correction point is the point in the set of correction points that is adjacent to the correction point. The correction point is corrected based on the second distance and the second angle between the straight line containing the first side and the reference straight line.

12. The method according to claim 11, characterized in that, The step of correcting the correction point based on the second distance and the second angle between the straight line containing the first side and the reference straight line includes: When the second distance is less than the distance threshold and the second included angle is greater than or equal to the second included angle threshold, a target edge with preset conditions is determined from the two edges constituting the correction point, and the intersection of the line containing the target edge and the reference line is determined as the corrected point. If the second distance is greater than or equal to the distance threshold, and / or the second included angle is less than the second included angle threshold, determine the third included angle between the straight line containing the two sides constituting the correction point and the reference straight line; When all the third included angles are greater than or equal to the third included angle threshold, the average value of the intersection points of the straight lines that constitute the two sides of the correction point and the reference straight line is determined as the corrected point. If at least one of the third included angles is less than the third included angle threshold, the projection point of the correction point on the reference line is determined as the corrected point.

13. A graphic correction device, characterized in that, include: Acquisition module, determination module, and calibration module; The acquisition module is used to acquire the corner point set and the graphic features of the hand-drawn graphic. The corner point set is obtained by processing the 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 determining module is used to determine a set of correction points that need to be corrected from the set of corner points based on the graphic features; and to determine a reference line based on the set of correction points and the graphic features. The determining module is used to determine a reference line based on the set of correction points and the graphic features, including: determining the reference slope of the reference line based on the graphic features; for each correction point in the set of correction points, determining the angle constituting the correction point and the length of the side constituting the correction point based on the set of corner points; determining the weight of each correction point based on the first weight of the angle corresponding to each correction point and the sum of the angles corresponding to all correction points in the set of correction points, and the first weight of the length of the side corresponding to the correction point and the sum of the lengths of the sides corresponding to all correction points in the set of correction points; and determining the reference intercept of the reference line based on the weight of each correction point if the slope of the reference line is the reference slope. The correction module is used to correct the correction points in the correction point set according to the reference line to obtain the corrected hand-drawn graphic.

14. An electronic device, characterized in that, include: processor; Memory is used to store computer program instructions; When the computer program instructions are executed by the processor, the method as described in any one of claims 1-12 is implemented.

Citation Information

Patent Citations

  • Scanning apparatus and method having image correction function

    CN101170627A

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

    CN113763505A