A method, device and equipment for determining a line break point, and a storage medium
By sampling, grouping, and merging the sampling points of hand-drawn lines, and using the curvature of the target point to determine the inflection point, the problem of inaccurate inflection point judgment of hand-drawn lines is solved, and the accuracy of inflection point determination is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN HONGHE INNOVATION INFORMATION TECH CO LTD
- Filing Date
- 2022-12-14
- Publication Date
- 2026-04-14
AI Technical Summary
In existing technologies, the determination of the inflection points of hand-drawn lines is inaccurate, resulting in a significant deviation between the processed result and the lines that the user actually wants to draw.
The hand-drawn lines are sampled by a preset sampling frequency, grouped according to the distance between adjacent sampling points, and the sampling points within the group are merged. The curvature of the target point is used to determine the inflection point of the hand-drawn lines.
This improves the accuracy of inflection points, avoids misjudgments caused by large curvature fluctuations due to excessively small sampling point distances, and ensures that the adjusted results are consistent with user expectations.
Smart Images

Figure CN116228552B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for determining the inflection points of a line. Background Technology
[0002] With the widespread use of touchscreens, hand-drawing software and whiteboard software are also becoming increasingly popular. For example, lines can be drawn by hand using these software programs. However, due to hand instability, it's difficult to draw truly straight lines or smooth curves. In such cases, certain techniques are needed to adjust the hand-drawn lines.
[0003] Currently, the main approach is to divide the line into multiple segments at points with obvious bends, based on the degree of curvature, and then smooth or fit each segment individually. However, due to inaccurate judgment of the inflection points in hand-drawn lines, the processed result deviates significantly from the lines the user actually intended to draw.
[0004] Application Content
[0005] This application provides a method, apparatus, device, and storage medium for determining the inflection points of lines, which can accurately determine the inflection points of hand-drawn lines.
[0006] In a first aspect, embodiments of this application provide a method for determining the inflection point of a line, including:
[0007] The first sampling point is obtained by sampling the hand-drawn lines according to the preset sampling frequency;
[0008] The first sampling points are grouped according to the distance between adjacent first sampling points;
[0009] For each group, the first sampling points are merged based on the location information of the first sampling point within the group to obtain the first target point;
[0010] Determine the inflection point of the hand-drawn lines based on the curvature of the first target point.
[0011] Secondly, embodiments of this application provide a device for determining line inflection points, comprising:
[0012] The sampling module is used to sample hand-drawn lines according to a preset sampling frequency to obtain the first sampling point;
[0013] The grouping module is used to group the first sampling points according to the distance between adjacent first sampling points;
[0014] The merging module is used to merge the first sampling points within each group based on the location information of the first sampling point in the group, so as to obtain the first target point.
[0015] The determination module is used to determine the inflection point of the hand-drawn lines based on the curvature of the first target point.
[0016] Thirdly, embodiments of this application provide an electronic device, including:
[0017] processor;
[0018] Memory is used to store computer program instructions;
[0019] A touchscreen is used to receive and display hand-drawn lines.
[0020] When computer program instructions are executed by the processor, the method described in the first aspect is implemented.
[0021] Fourthly, embodiments of this application provide 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.
[0022] The method, apparatus, device, and storage medium for determining line inflection points provided in this application embodiment sample hand-drawn lines according to a preset sampling frequency to obtain first sampling points. The first sampling points are grouped according to the distance between adjacent first sampling points. For each group, the first sampling points are merged based on the position information of the first sampling points within the group to obtain a first target point. The inflection point of the hand-drawn line is determined based on the curvature of the first target point. In other words, this application embodiment utilizes the distance between sampling points to merge them, achieving a smoothing process for the sampling points. Therefore, when determining the inflection point of the hand-drawn line based on the curvature of the target point, it avoids misjudging the inflection point due to large curvature fluctuations caused by excessively small distances between sampling points, thus improving the accuracy of inflection point determination. Attached Figure Description
[0023] 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.
[0024] Figure 1 A flowchart illustrating a method for determining line inflection points provided in an embodiment of this application;
[0025] Figure 2 A flowchart illustrating another method for determining line inflection points provided in an embodiment of this application;
[0026] Figure 3 A schematic diagram of a hand-drawn line drawing provided for an embodiment of this application;
[0027] Figure 4 A schematic diagram of a curve and corresponding inflection points provided for an embodiment of this application;
[0028] Figure 5 A schematic diagram of a polyline and its corresponding inflection points provided in an embodiment of this application;
[0029] Figure 6 A structural diagram of a line inflection point determination device provided in an embodiment of this application;
[0030] Figure 7 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0031] 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.
[0032] 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.
[0033] As mentioned above, when drawing lines by hand, the instability of the hand makes it impossible to draw true straight lines or smooth curves. Therefore, certain methods are needed to adjust the lines drawn by hand.
[0034] When adjusting hand-drawn lines, inaccurate judgment of the inflection points of the hand-drawn lines leads to a significant deviation between the adjusted result and the user's actual desired result.
[0035] In order to accurately determine the inflection points of hand-drawn lines and ensure that the adjusted result is consistent with the user's actual desired result, this application provides a method, apparatus, device and storage medium for determining the inflection points of lines.
[0036] The method for determining line inflection points provided in this application will be described below with reference to specific embodiments. The method for determining line inflection points provided in this application can be applied to smart devices with data processing and touch functions, such as interactive tablets and other interactive devices.
[0037] Figure 1 A flowchart illustrating a method for determining line inflection points provided in an embodiment of this application. Figure 1 As shown, the method for determining the inflection point of the line may include the following steps:
[0038] S110. Sample the hand-drawn lines according to the preset sampling frequency to obtain the first sampling point.
[0039] S120. Group the first sampling points according to the distance between adjacent first sampling points.
[0040] S130. For each group, merge the first sampling points according to the location information of the first sampling point in the group to obtain the first target point.
[0041] S140. Determine the inflection point of the hand-drawn lines based on the curvature of the first target point.
[0042] This embodiment of the application samples hand-drawn lines according to a preset sampling frequency to obtain first sampling points. The first sampling points are then grouped based on the distance between adjacent first sampling points. For each group, the first sampling points are merged based on their position information to obtain a first target point. The inflection point of the hand-drawn line is then determined based on the curvature of the first target point. In other words, this embodiment of the application utilizes the distance between sampling points to merge them, achieving a smoothing process for the sampling points. This avoids misjudging inflection points caused by large curvature fluctuations due to excessively small distances between sampling points when determining the inflection point of the hand-drawn line based on the curvature of the target point, thus improving the accuracy of inflection point determination.
[0043] The above steps are explained in detail below:
[0044] In S110, the preset sampling frequency can be determined based on the system operating speed.
[0045] For example, when a user draws a hand-drawn line, the hand-drawn line can be sampled in real time at a preset sampling frequency to obtain the first sampling point and its spatial coordinates. Alternatively, the hand-drawn line can be sampled at a preset sampling frequency after the drawing is completed to obtain the first sampling point and its spatial coordinates.
[0046] For example, hand-drawn lines can be drawn using a stylus or finger.
[0047] In S120, the distance between adjacent first sampling points can be the Euclidean distance between adjacent first sampling points, or it can be called the L2 distance.
[0048] It should be understood that if the distance between the first sampling points is small, the curvature will fluctuate greatly when the curvature is determined based on the distance between the first sampling points in the future, which may easily lead to misjudgment. In order to avoid this situation, the embodiments of this application group the first sampling points based on the distance between adjacent first sampling points.
[0049] For example, the first sampling points can be grouped in the following way:
[0050] The sampling rate is determined based on the distance between adjacent first sampling points;
[0051] The first sampling points are grouped according to the sampling ratio.
[0052] For example, m = int(r / R0) + 1, where m is the sampling rate, int() indicates rounding to the integer part, R0 is the threshold, and the value of R0 is related to factors such as the sampling frequency and resolution of the touchscreen. For example, if the sampling frequency is high, the value of R0 should be smaller; if the resolution is high, the value of R0 should be larger. In practical applications, fine-tuning can be made on this basis to more accurately determine the inflection points of the hand-drawn lines. r is the average distance between adjacent first sampling points.
[0053] For example, if m is greater than 1, the sampling points can be grouped into groups of m, starting from the first sampling point, with the last group potentially having fewer than m sampling points. If m = 1, then each sampling point forms a group.
[0054] This application embodiment groups the sampling points based on the distance between adjacent sampling points, so that the sampling points can be merged based on each group in the future, avoiding large curvature fluctuations caused by the small distance between sampling points, which could lead to misjudgment of inflection points.
[0055] In S130, for each group, the first sampling point within that group is merged, which can avoid large curvature fluctuations caused by the small distance between adjacent sampling points, thus affecting the determination of the inflection point.
[0056] For example, the average of the coordinates of each first sampling point in each group can be taken, and the point corresponding to the average value can be recorded as the first target point. The location information here can be the spatial coordinates of each first sampling point.
[0057] In S140, for example, the curvature determination process can be triggered after a certain number of first sampling points have been sampled, or after a preset time interval, or after a stroke has ended, to determine the curvature of the first target point.
[0058] For example, prior to S140, the curvature of the first target point can be determined as follows:
[0059] For each first target point, based on the position information of the second and third target points before the first target point, and the position information of the fourth and fifth target points after the first target point, determine the first tangent vector with the first target point as the tangent point;
[0060] According to the preset tangent vector turning angle formula, the turning angle from the first tangent vector to the second tangent vector is determined. The second tangent vector is the tangent vector adjacent to the first tangent vector. The second tangent vector takes the second target point as the tangent point, and the second target point is adjacent to the first target point.
[0061] The ratio of the turning angle to the first distance is determined as the curvature of the first target point, and the first distance is the distance between the tangent points of the first and second tangent vectors.
[0062] For example, the second target point and the third target point can be points located before the first target point and sequentially adjacent to the first target point. For instance, if the first target point is the third target point, then the second target point and the third target point can be the first target point and the second target point, respectively.
[0063] For example, if the first target point is the first target point, the second target point and the third target point are also the first target point; if the first target point is the second target point, the second target point and the third target point can both be the first target point.
[0064] The fourth and fifth target points can be points located after the first target point and sequentially adjacent to it. For example, the first target point can be the second target point, and the fourth and fifth target points can be the third and fourth target points, respectively. If the third and fourth target points do not exist, or if the fourth target point does not exist, they can be merged forward. For example, if the fourth target point does not exist, the third target point can be used as the fourth and fifth target points.
[0065] For example, the starting point of the first tangent vector can be determined based on the position information of the second and third target points, and the ending point of the first tangent vector can be determined based on the position information of the fourth and fifth target points.
[0066] For example, based on the positional information of the second and third target points, the midpoint between them can be determined as the starting point of the first tangent vector. Similarly, based on the positional information of the fourth and fifth target points, the midpoint between them can be determined as the ending point of the first tangent vector. This yields the tangent vector with the first target point as the tangent point.
[0067] The second tangent vector is the tangent vector with the second target point as the tangent point. The second target point is adjacent to the first target point. According to the preset tangent vector turning angle formula, the turning angle from the first tangent vector to the second tangent vector can be determined.
[0068] For example, the preset tangent vector rotation formula can be in the following form:
[0069] θ=cos -1 [v1*v2 / (|v1|*|v2|)]
[0070] Where θ is the turning angle from the first tangent vector to the second tangent vector, v1 represents the first tangent vector, and v2 represents the second tangent vector.
[0071] The curvature of the first target point can be determined by the angle between the first tangent vector and the second tangent vector, and the distance between the corresponding tangent points of the two tangent vectors.
[0072] For example, curvature = rotation angle / arc length between the corresponding tangent points of the two tangent vectors. To simplify the calculation, for example, the arc length between the two tangent points can be approximated as the Euclidean distance between the two tangent points.
[0073] The embodiments of this application determine the curvature of the corresponding target point based on the tangent vectors corresponding to adjacent target points and the distance between adjacent target points, providing a basis for subsequent inflection point determination.
[0074] Once the curvature of the first target point is determined, the inflection point of the hand-drawn line can be determined based on the curvature of the first target point.
[0075] For example, if the curvature of the first target point is greater than a set threshold, the first target point can be determined to be the inflection point of the hand-drawn line; otherwise, the first target point can be determined not to be the inflection point of the hand-drawn line.
[0076] Once the inflection points are determined, the curve can be segmented based on these inflection points, for example.
[0077] It should be understood that when the curvature of a target point is greater than a preset threshold, the curvature of surrounding target points is usually also greater than the preset threshold. To improve the accuracy of inflection points, target points with curvature greater than the preset threshold can be merged to reduce the number of inflection points. Here, an inflection point is a target point with curvature greater than the preset threshold.
[0078] Based on this, in some embodiments, the above-described S140 may include the following steps:
[0079] S1401. When the curvature is greater than the first preset curvature, determine the distance between the sixth target point and the seventh target point. The sixth target point and the seventh target point are the first target points with curvature greater than the first preset curvature and adjacent to each other.
[0080] S1402. If the distance is less than the first distance threshold, delete the target point with smaller curvature between the sixth and seventh target points to obtain the third point sequence.
[0081] S1403. Determine the inflection points of the hand-drawn lines based on the curvature of each target point in the third point sequence.
[0082] The above process will be explained in detail below:
[0083] In S1401, for example, the first preset curvature is related to factors such as the resolution and sampling frequency of the touch screen, and the specific value can be set based on experience.
[0084] The sixth and seventh target points can be any adjacent target points with a curvature greater than a first preset curvature. For example, the distance between the sixth and seventh target points can be determined based on the sampling points between the two target points. For example, the distance between the two target points can be obtained by determining the sum of the lengths of the broken lines connecting all adjacent sampling points. The length of the broken line connecting adjacent sampling points can be approximated as the arc length between adjacent sampling points.
[0085] In S1402, the magnitude of the first distance threshold is related to factors such as the size of the touchscreen, the screen resolution, the total length of the hand-drawn lines, and the average distance between adjacent sampling points. For example, it can be the larger of 1 / 100 of the total length of the hand-drawn lines and 1 / 100 of the screen resolution value. For example, the first distance threshold can also be related to a specific application; for instance, if tracking fine handwriting is required, the first distance threshold should be set smaller.
[0086] When the distance between two adjacent points is less than a first distance threshold, for example, points with smaller curvature can be deleted. For instance, if the curvature of the seventh target point is smaller than that of the sixth target point, then the seventh target point can be deleted. After a target point is deleted, the distance between two adjacent target points needs to be re-determined until the distance between any two target points is greater than or equal to the first distance threshold, and the remaining target points are recorded as the third point sequence.
[0087] In S1403, each target point in the third point sequence is a candidate inflection point. Based on the curvature of each target point, the target inflection point, which is also the inflection point of the hand-drawn line, can be determined.
[0088] In this embodiment, points with large curvature are filtered out, and points with smaller curvature are deleted when the distance between two adjacent points is less than a first distance threshold. This reduces the number of inflection points and avoids their influence on the true inflection points, thus making the final determined inflection points more accurate.
[0089] For example, S1403 above may include the following steps:
[0090] For each eighth target point in the third point sequence, determine the mean curvature of the target points whose distance from the eighth target point is less than or equal to the second distance threshold;
[0091] The inflection point of the hand-drawn line is determined based on the ratio of the curvature of the eighth target point to the mean curvature.
[0092] The eighth target point is any target point in the third point sequence. For example, target points within a certain range from the eighth target point can be determined on both sides. Specifically, target points to the left of the eighth target point and within a distance of S / 6 to S / 2 from the eighth target point, and target points to the right of the eighth target point and within a distance of S / 6 to S / 2 from the eighth target point, can be determined respectively. The mean curvature is then obtained based on the curvature of the target points on both sides. Here, S is the total length of the hand-drawn lines.
[0093] The inflection point of the hand-drawn line can be determined by the ratio of the curvature of the eighth target point to the mean value of that curvature.
[0094] For example, if the ratio of the curvature of the eighth target point to the mean of that curvature is greater than a set threshold, the eighth target point can be determined to be an inflection point; otherwise, the eighth target point is determined not to be an inflection point; or...
[0095] If the product of the ratio of the curvature of the eighth target point to the mean of that curvature and the curvature of the eighth target point is greater than a certain threshold, the eighth target point can be determined to be an inflection point; otherwise, the eighth target point is determined not to be an inflection point.
[0096] In this embodiment, after filtering out some inflection points with curvature greater than a first preset curvature, the method further determines whether the inflection point is an inflection point based on the ratio of the curvature of the remaining inflection points to the mean curvature, thereby reducing the interference of other inflection points and improving the accuracy of the final result.
[0097] Figure 2 A flowchart of another method for determining line inflection points provided in an embodiment of this application is shown below. Figure 2 As shown, the method for determining the inflection point of the line may include the following steps:
[0098] S210. Sample the hand-drawn lines according to the preset sampling frequency to obtain the first sampling point.
[0099] S220. Group the first sampling points according to the distance between adjacent first sampling points.
[0100] S230. For each group, merge the first sampling points within the group to obtain the first merged point.
[0101] The location information of the first merging point is determined based on the average of the location information of each first sampling point within the group.
[0102] S240, Determine the distance between adjacent first merge points.
[0103] S250. If the distance is less than or equal to the preset distance, remove the first target merging point to obtain the first target point.
[0104] The first target merging point is any one of the adjacent first merging points.
[0105] S260. Determine the inflection point of the hand-drawn lines based on the curvature of the first target point.
[0106] Among them, S210-S220, S260 and Figure 1 The processes S110-S120 and S140 are the same. Please refer to the descriptions of S110-S120 and S140 for details. For the sake of brevity, they will not be repeated here.
[0107] The following is about Figure 2 The other steps are explained in detail below:
[0108] In S230, for example, the point corresponding to the average coordinates of each first sampling point within the group can be recorded as the first merging point, and the average coordinates of each first sampling point can be recorded as the location information of the first merging point. In this way, one group corresponds to one first merging point.
[0109] In S240, for example, the distance between adjacent first merging points can be the Euclidean distance between adjacent first merging points.
[0110] In S250, it should be understood that if the distance between two adjacent merging points is small, the curvature may fluctuate greatly when determining the curvature based on that distance, thus misjudging it as an inflection point. Therefore, these merging points can be merged.
[0111] For example, when the distance between two adjacent merged points is less than or equal to a preset distance, the two merged points are considered to be basically overlapping, and one of the merged points can be deleted. The preset distance can be set to 1 / 100 of the average distance, where the average distance is the average distance between adjacent first sampling points.
[0112] In this embodiment of the application, when the distance between two adjacent merging points is less than or equal to a preset distance, one of the merging points is deleted. This can avoid large curvature fluctuations caused by the distance between the two merging points being too small, which would affect the determination of the final inflection point.
[0113] It should be understood that due to factors such as hand instability, the actual hand-drawn lines may contain jagged points, but not inflection points. To reduce the impact of jagged points, in some embodiments, the above-mentioned S250 may include the following steps:
[0114] If the distance is less than or equal to the preset distance, the first target merging point is removed to obtain the first point sequence;
[0115] For each merging point in the first point sequence, based on the first angle formed by the line connecting the merging point and the second merging point and the line connecting the second merging point and the third merging point, and the second angle formed by the line connecting the second merging point and the third merging point and the line connecting the third merging point and the fourth merging point, it is determined whether the second merging point and the third merging point are sawtooth points. The second merging point, the third merging point, and the fourth merging point are the merging points in the first point sequence that are located after the merging point and are sequentially adjacent.
[0116] If the second and third merging points are determined to be sawtooth points, merge the second and third merging points to obtain the second point sequence.
[0117] For each merge point in the second point sequence, the merge point is filtered based on the fifth and sixth merge points to obtain the first target point. The fifth and sixth merge points are adjacent to the merge point.
[0118] For example, the first merging point includes four points A, B, C, and D. If the distance between points A and B is less than or equal to a preset distance, point A or point B can be deleted. Taking the deletion of point A as an example, the distance between B and C is then determined, and so on, until the last point is traversed.
[0119] Assuming that the distances between BC and CD are both greater than the preset distances, B, C, and D can be recorded as the first point sequence for subsequent calculations.
[0120] For example, refer to Figure 3 Taking point A as an example, the second, third, and fourth merging points can be points B, C, and D, respectively. The first angle is the angle formed by AB and BC, and the second angle is the angle formed by BC and CD.
[0121] If both ∠ABC and ∠BCD are acute angles, then points B and C can be identified as zigzag points. Given that points B and C are zigzag points, they can be merged. For example, the midpoint of BC can be used to replace points B and C. Then, starting from point B, the trend of the three merged points after point B is analyzed, and so on, to merge all the zigzag points on the hand-drawn line.
[0122] If at least one of ∠ABC and ∠BCD is not an acute angle, we can start from point B and perform an operation similar to that at point A, that is, without merging points B and C.
[0123] It should be noted that when analyzing the trends of the three merged points, the newly merged point is not considered. For example, for point B, when analyzing the trends of the three merged points after point B, the midpoint of the newly generated BC is not considered.
[0124] In this embodiment of the application, for each merging point in the first point sequence, the trend of the subsequent three merging points can be analyzed, and when both the first angle and the second angle are acute angles, the corresponding sawtooth points are merged. This can avoid the influence of sawtooth points on the turning point and improve the accuracy of the turning point.
[0125] In some embodiments, the points obtained by the above processing can also be filtered, and the filtered merged points can be recorded as the first target points. This achieves smoothing processing of the first target points and improves the accuracy of the turning points.
[0126] For example, for each merge point in the second point sequence, the merge points can be filtered based on the fifth and sixth merge points to obtain the first target point.
[0127] For example, for the merging point (Xb, Yb), the filtered result is Xnb = (Xa + 2*Xb + Xc) / 4, Ynb = (Ya + 2*Yb + Yc) / 4. Here, (Xnb, Ynb) are the coordinates of the filtered merging point (Xb, Yb), which are also the coordinates of the first target point. Points (Xa, Ya) and (Xc, Yc) are the preceding and following merging points of point (Xb, Yb), respectively.
[0128] For example, refer to Figures 4-5 , Figure 4 This refers to the identification results of the inflection points when the hand-drawn lines are curved. Figure 5 This refers to the identification results of the inflection points when the hand-drawn lines are polylines. Figure 4 and Figure 5 As can be seen, the solution of this application embodiment can accurately identify corners as long as there are obvious pen stroke marks at the corners, and it does not depend on the angle of the corner.
[0129] Once the inflection points are determined, hand-drawn lines can be drawn based on these points, providing a foundation for subsequent segmented processing such as automatic correction or smoothing, thus improving the accuracy of the subsequent processing results.
[0130] Based on the same inventive concept, this application also provides a device for determining line inflection points, which is described below in conjunction with... Figure 6 The device for determining line inflection points provided in the embodiments of this application will be described in detail.
[0131] Figure 6 This is a structural diagram of a device for determining the inflection point of a line, provided in an embodiment of this application.
[0132] like Figure 6 As shown, the device for determining the inflection point of the line may include:
[0133] Sampling module 610 is used to sample hand-drawn lines according to a preset sampling frequency to obtain the first sampling point;
[0134] The grouping module 620 is used to group the first sampling points according to the distance between adjacent first sampling points;
[0135] The merging module 630 is used to merge the first sampling points in each group according to the location information of the first sampling points in the group to obtain the first target point;
[0136] The determination module 640 is used to determine the inflection point of the hand-drawn lines based on the curvature of the first target point.
[0137] This embodiment of the application samples hand-drawn lines according to a preset sampling frequency to obtain first sampling points. The first sampling points are then grouped based on the distance between adjacent first sampling points. For each group, the first sampling points are merged based on their position information to obtain a first target point. The inflection point of the hand-drawn line is then determined based on the curvature of the first target point. In other words, this embodiment of the application utilizes the distance between sampling points to merge them, achieving a smoothing process for the sampling points. This avoids misjudging inflection points caused by large curvature fluctuations due to excessively small distances between sampling points when determining the inflection point of the hand-drawn line based on the curvature of the target point, thus improving the accuracy of inflection point determination.
[0138] In some embodiments, the merging module 630 includes:
[0139] The merging unit is used to merge the first sampling points within each group to obtain the first merged point. The location information of the first merged point is determined based on the average of the location information of each first sampling point within the group.
[0140] A determining unit is used to determine the distance between adjacent first merging points;
[0141] The elimination unit is used to eliminate the first target merging point when the distance is less than or equal to a preset distance, so as to obtain the first target point. The first target merging point is any one of the adjacent first merging points.
[0142] In some embodiments, the rejection unit is specifically used for:
[0143] If the distance is less than or equal to the preset distance, the first target merging point is removed to obtain the first point sequence;
[0144] For each merging point in the first point sequence, based on the first angle formed by the line connecting the merging point and the second merging point and the line connecting the second merging point and the third merging point, and the second angle formed by the line connecting the second merging point and the third merging point and the line connecting the third merging point and the fourth merging point, it is determined whether the second merging point and the third merging point are sawtooth points. The second merging point, the third merging point, and the fourth merging point are the merging points in the first point sequence that are located after the merging point and are sequentially adjacent.
[0145] If the second and third merging points are determined to be sawtooth points, merge the second and third merging points to obtain the second point sequence.
[0146] For each merge point in the second point sequence, the merge point is filtered based on the fifth and sixth merge points to obtain the first target point. The fifth and sixth merge points are adjacent to the merge point.
[0147] In some embodiments, the determining module 640 is further configured to, before determining the inflection point of the hand-drawn line based on the curvature of the first target point, determine, for each first target point, a first tangent vector with the first target point as the tangent point based on the position information of the second and third target points before the first target point and the position information of the fourth and fifth target points after the first target point;
[0148] According to the preset tangent vector turning angle formula, the turning angle from the first tangent vector to the second tangent vector is determined. The second tangent vector is the tangent vector adjacent to the first tangent vector. The second tangent vector takes the second target point as the tangent point, and the second target point is adjacent to the first target point.
[0149] The ratio of the turning angle to the first distance is determined as the curvature of the first target point, and the first distance is the distance between the tangent points of the first and second tangent vectors.
[0150] In some embodiments, the determining module 640 is specifically used for:
[0151] If the curvature is greater than the first preset curvature, determine the distance between the sixth target point and the seventh target point. The sixth target point and the seventh target point are the first target points with curvature greater than the first preset curvature and adjacent to each other.
[0152] If the distance is less than the first distance threshold, delete the target points with smaller curvature between the sixth and seventh target points to obtain the third point sequence;
[0153] The inflection points of the hand-drawn lines are determined based on the curvature of each target point in the third point sequence.
[0154] In some embodiments, the determining module 640 is specifically used for:
[0155] For each eighth target point in the third point sequence, determine the mean curvature of the target points whose arc length is less than or equal to the preset arc length.
[0156] The inflection point of the hand-drawn line is determined based on the ratio of the curvature of the eighth target point to the mean curvature.
[0157] In some embodiments, the grouping module 620 is specifically used for:
[0158] The sampling rate is determined based on the distance between adjacent first sampling points;
[0159] The first sampling points are grouped according to the sampling ratio.
[0160] Figure 6 Each module in the illustrated device has the ability to implement Figures 1-5 The functions of each step and the corresponding technical effects are described briefly and will not be elaborated here.
[0161] Based on the same inventive concept, embodiments of this application also provide an electronic device, such as an interactive flat panel, tablet computer, laptop computer, handheld computer, etc. The following describes... Figure 7 The electronic devices provided in the embodiments of this application will be described in detail.
[0162] like Figure 7 As shown, the electronic device may include a processor 710, a memory 720 for storing computer program instructions, and a touch screen 730.
[0163] The processor 710 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0164] Memory 720 may include mass storage for data or instructions. For example, and not limitingly, memory 720 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 720 may include removable or non-removable (or fixed) media, or memory 720 may be non-volatile solid-state memory. In one instance, memory 720 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.
[0165] The touch screen 730 can receive and display the user's hand-drawn lines. Of course, the user can also perform other functions through the touch screen 730, which is not limited in this embodiment.
[0166] The processor 710 reads and executes computer program instructions stored in the memory 720 to achieve... Figures 1-5 The method in the illustrated embodiment achieves... Figures 1-5 The corresponding technical effects achieved by the methods in the illustrated embodiments are described briefly and will not be elaborated further here.
[0167] In one example, the electronic device may also include a communication interface 740 and a bus 750. Wherein, as... Figure 7 As shown, the processor 710, memory 720, touch screen 730, and communication interface 740 are connected via bus 750 and communicate with each other.
[0168] The communication interface 740 is mainly used to realize communication between various modules, devices and / or equipment in the embodiments of this application.
[0169] Bus 750 includes hardware, software, or both, that couples the components of an electronic device together. For example, and not as a limitation, bus 750 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 750 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.
[0170] After sampling hand-drawn lines according to a preset sampling frequency and obtaining the first sampling point, the electronic device can execute the line inflection point determination method in this embodiment of the application, thereby achieving a combination of... Figures 1-5 The method for determining the inflection points of the described lines and Figure 6 A device for determining the inflection points of the described lines.
[0171] Furthermore, in conjunction with the line inflection point determination method 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 line inflection point determination methods in the above embodiments.
[0172] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0173] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0174] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0175] The aspects of embodiments of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to create a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0176] 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 method for determining the inflection point of a line, characterized in that, include: The first sampling point is obtained by sampling the hand-drawn lines according to the preset sampling frequency; The first sampling points are grouped according to the distance between adjacent first sampling points; For each group, the first sampling points are merged according to the location information of the first sampling points within the group to obtain the first target point; The inflection point of the hand-drawn line is determined based on the curvature of the first target point; The step of grouping the first sampling points according to the distance between adjacent first sampling points includes: The sampling rate is determined based on the distance between adjacent first sampling points; The first sampling points are grouped in chronological order according to the sampling multiplier.
2. The method according to claim 1, characterized in that, For each group, merging the first sampling points according to the position information of the first sampling points within the group to obtain the first target point includes: For each group, the first sampling points within the group are merged to obtain a first merged point. The location information of the first merged point is determined based on the average of the location information of each first sampling point within the group. Determine the distance between adjacent first merge points; If the distance is less than or equal to a preset distance, the first target merging point is eliminated to obtain the first target point, which is any one of the adjacent first merging points.
3. The method according to claim 2, characterized in that, The step of eliminating the first target merging point to obtain the first target point when the distance is less than or equal to the preset distance includes: If the distance is less than or equal to a preset distance, the first target merging point is removed to obtain the first point sequence; For each merging point in the first point sequence, based on the first angle formed by the line connecting the merging point and the second merging point and the line connecting the second merging point and the third merging point, and the second angle formed by the line connecting the second merging point and the third merging point and the line connecting the third merging point and the fourth merging point, it is determined whether the second merging point and the third merging point are sawtooth points. The second merging point, the third merging point, and the fourth merging point are merging points in the first point sequence that are located after the merging point and are sequentially adjacent to it. If the second and third merging points are determined to be sawtooth points, merge the second and third merging points to obtain the second point sequence. For each merge point in the second point sequence, the merge point is filtered according to the fifth and sixth merge points to obtain the first target point, wherein the fifth and sixth merge points are adjacent to the merge point.
4. The method according to claim 1, characterized in that, Before determining the inflection point of the hand-drawn line based on the curvature of the first target point, the method further includes: For each first target point, based on the position information of the second and third target points before the first target point, and the position information of the fourth and fifth target points after the first target point, a first tangent vector with the first target point as the tangent point is determined; According to the preset tangent vector turning angle formula, the turning angle from the first tangent vector to the second tangent vector is determined. The second tangent vector is the tangent vector adjacent to the first tangent vector. The second tangent vector takes the second target point as the tangent point, and the second target point is adjacent to the first target point. The ratio of the turning angle to the first distance is determined as the curvature of the first target point, where the first distance is the distance between the tangent points of the first tangent vector and the tangent points of the second tangent vector.
5. The method according to claim 1, characterized in that, Determining the inflection point of the hand-drawn line based on the curvature of the first target point includes: If the curvature is greater than the first preset curvature, the distance between the sixth target point and the seventh target point is determined. The sixth target point and the seventh target point are first target points with curvature greater than the first preset curvature and adjacent to each other. If the distance is less than the first distance threshold, delete the target point with the smaller curvature between the sixth and seventh target points to obtain the third point sequence; The inflection points of the hand-drawn lines are determined based on the curvature of each target point in the third point sequence.
6. The method according to claim 5, characterized in that, The step of determining the inflection points of the hand-drawn lines based on the curvature of each target point in the third point sequence includes: For each eighth target point in the third point sequence, determine the mean curvature of the target points whose distance from the eighth target point is less than or equal to the second distance threshold; The inflection point of the hand-drawn line is determined based on the ratio of the curvature of the eighth target point to the mean curvature.
7. A device for determining the inflection point of a line, characterized in that, include: The sampling module is used to sample hand-drawn lines according to a preset sampling frequency to obtain the first sampling point; The grouping module is used to group the first sampling points according to the distance between adjacent first sampling points; The merging module is used to merge the first sampling points in each group according to the location information of the first sampling points in the group to obtain the first target point; The determining module is used to determine the inflection point of the hand-drawn line based on the curvature of the first target point; The grouping module is specifically used for: The sampling rate is determined based on the distance between adjacent first sampling points; The first sampling points are grouped in chronological order according to the sampling multiplier.
8. An electronic device, characterized in that, include: processor; Memory is used to store computer program instructions; A touchscreen is used to receive and display hand-drawn lines. When the computer program instructions are executed by the processor, the method as described in any one of claims 1-6 is implemented.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, the method as described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Space abnormal extreme value unbiased isogram drawing method
CN103995944A
Computer image drawing optimization method
CN105160696A