Touch track processing method, device, terminal, storage medium and program product

By interpolation of the touch track in the terminal and adding track sampling points, the problem of track sawtoothing when user gestures touch is solved, and a smoother touch track curve is achieved.

CN114494046BActive Publication Date: 2025-04-08BIGO TECH PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210023306.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-10
Publication Date
2025-04-08
Estimated Expiration
2042-01-10

AI Technical Summary

Technical Problem

During the terminal use, when the user gestures to touch, due to the low sampling frequency or fast movement speed, the number of sampling points of the touch track is insufficient, resulting in obvious serrated shapes in the finger track drawn by the track, and a smooth touch track curve cannot be generated.

Method used

By obtaining the angle value of the target angle formed by three adjacent track sampling points in the i-th touch track, it is determined whether it is less than the angle threshold. If it is less than, the midpoint interpolation process is performed on the i-th touch track, increasing the track sampling point, and thus improving the smoothness of the track.

Benefits of technology

By increasing the trajectory sampling points and reducing the angle of the target angle, the smoothness of the touch trajectory is significantly improved, jagged phenomenon is avoided, and the smoothness of the drawing is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494046B_ABST
    Figure CN114494046B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a touch trajectory processing method, device, terminal, storage medium and program product, belonging to the field of terminal technology. The method includes: obtaining the i-th touch trajectory, the i-th touch trajectory contains at least three trajectory sampling points, i is a positive integer; determining the target angle value corresponding to the target angle in the i-th touch trajectory, the target angle is composed of three adjacent trajectory sampling points in the i-th touch trajectory; in response to the target angle value being less than the angle threshold, performing midpoint interpolation processing on the i-th touch trajectory to obtain the processed i+1-th touch trajectory, the number of trajectory sampling points contained in the i+1-th touch trajectory is greater than the number of trajectory sampling points contained in the i-th touch trajectory. By adopting the touch trajectory processing method provided in the embodiments of the present application, the operating cost of the smoothing processing can be reduced while realizing the smoothing processing of the touch trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a touch trajectory processing method, device, terminal, storage medium and program product. Background Art

[0002] When using a terminal, a user may need to draw a track on the terminal screen, for example, drawing a terminal unlocking gesture, drawing a picture by hand, and other scenarios.

[0003] In the related art, the terminal will call back the touch sampling points at a certain frequency during the user's gesture touch process, and the sampling points that can be obtained per second are relatively limited; however, when the user moves quickly on the mobile phone screen and the movement amplitude is large, the touch trajectory length is longer, but the number of trajectory data points sampled per second does not increase with the growth of the trajectory length, resulting in the finger trajectory drawn by the sampling points having an obvious jagged shape, and a smooth touch trajectory curve cannot be generated. Summary of the invention

[0004] The embodiments of the present application provide a touch track processing method, device, terminal, storage medium and program product. The technical solution is as follows:

[0005] On the one hand, an embodiment of the present application provides a touch track processing method, the method comprising:

[0006] Obtaining an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer;

[0007] Determine a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track;

[0008] In response to the target angle value being less than the angle threshold, midpoint interpolation processing is performed on the i-th touch track to obtain an (i+1)-th touch track after processing, wherein the number of track sampling points included in the (i+1)-th touch track is greater than the number of track sampling points included in the i-th touch track.

[0009] On the other hand, an embodiment of the present application provides a touch track processing device, the device comprising:

[0010] An acquisition module, configured to acquire an i-th touch track, wherein the i-th touch track includes at least three track sampling points, and i is a positive integer;

[0011] a determination module, configured to determine a target angle value corresponding to a target angle in the i-th touch track, wherein the target angle is formed by three adjacent track sampling points in the i-th touch track;

[0012] The first processing module is configured to, in response to the target angle value being less than an angle threshold, perform midpoint interpolation processing on the i-th touch track to obtain an (i+1)-th touch track after processing, wherein the number of track sampling points included in the (i+1)-th touch track is greater than the number of track sampling points included in the i-th touch track.

[0013] On the other hand, an embodiment of the present application provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the touch trajectory processing method as described in the above aspect.

[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is loaded and executed by a processor to implement the touch trajectory processing method as described in the above aspect.

[0015] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the touch track processing method described in the above aspect.

[0016] The beneficial effects brought by the technical solution provided in the embodiments of the present application include at least:

[0017] In the embodiment of the present application, by obtaining the angle value of the target angle formed by three adjacent trajectory sampling points in the i-th touch trajectory, so that when the angle value is less than the angle threshold, the i-th touch trajectory is subjected to midpoint interpolation processing, so that the angle of the target angle in the i-th touch trajectory can be reduced by increasing the number of trajectory sampling points in the i-th touch trajectory, thereby improving the smoothness of the i-th touch trajectory; and the smoothing operation is relatively simple, and can be repeated for multiple times, thereby reducing the operating cost of the smoothing processing while achieving the smoothing processing of the touch trajectory. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A flow chart of a touch track processing method shown in an exemplary embodiment of the present application is shown;

[0019] Figure 2 A schematic diagram of a midpoint interpolation process is shown in an exemplary embodiment of the present application;

[0020] Figure 3 A flowchart of a touch track processing method according to another exemplary embodiment of the present application is shown;

[0021] Figure 4 A schematic diagram showing the smoothing effect of different area thresholds;

[0022] Figure 5 A schematic diagram showing the smoothing effect of different angle thresholds;

[0023] Figure 6 A flowchart of a touch track processing method according to another exemplary embodiment of the present application is shown;

[0024] Figure 7 A schematic diagram of a midpoint interpolation process is shown in another exemplary embodiment of the present application;

[0025] Figure 8 A structural block diagram of a touch trajectory processing device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0026] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0027] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0028] Please refer to Figure 1 , which shows a flow chart of a touch track processing method shown in an exemplary embodiment of the present application. The present application embodiment takes the method applied to a terminal as an example for explanation. The method includes:

[0029] Step 101 : obtaining an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer.

[0030] When using the terminal, users often need to draw arbitrary graphics through the terminal, such as in the gesture unlocking scenario, in the online drawing scenario using painting software, etc. When the user touches the terminal screen with a finger or a stylus, the terminal will call back the touch sampling points at a certain frequency, and then generate a touch trajectory based on the acquired touch sampling points to display it on the terminal screen.

[0031] In the process of generating the touch trajectory, if the terminal performance is poor and the sampling frequency of the touch sampling points is low; or if the user's finger or stylus moves quickly and with a large amplitude on the terminal screen, it will cause a large change amplitude between adjacent trajectory sampling points, and thus make the touch trajectory drawn according to the trajectory sampling points have an obvious sawtooth shape, resulting in a low smoothness of the drawn touch trajectory. Therefore, in a possible implementation manner, when the terminal generates the touch trajectory, in order to avoid the appearance of a sawtooth shape, the touch trajectory needs to be smoothed to improve the smoothness of the touch trajectory.

[0032] It should be noted that, in the process of generating the final touch trajectory, the initial touch trajectory may need to be smoothed multiple times; that is, when i=1, the i-th touch trajectory is the initial touch trajectory (the smoothing process provided by this embodiment is not performed), and when i=2, the i-th touch trajectory is the touch trajectory after one smoothing process, and so on. The i-th touch trajectory after the last smoothing process is determined as the final touch trajectory.

[0033] Step 102 : determining a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track.

[0034] If the touch track is jagged, it means that the track segments at the jagged part are not smoothly connected, that is, the angle formed by adjacent track segments is relatively small. For example, if the angle is a right angle, obvious jaggedness will appear. Therefore, in a possible implementation manner, to determine whether it is necessary to smooth the i-th touch track, it is necessary to obtain a target angle value corresponding to the target angle in the i-th touch track, and to determine whether the target angle value is small, so as to further determine whether smoothing is required.

[0035] According to the angle composition principle, the target angle in the ith touch track must be composed of three adjacent track sampling points in the ith touch track. It should be noted that the target angle can be any three adjacent track sampling points in the ith touch track.

[0036] Step 103, in response to the target angle value being less than the angle threshold, midpoint interpolation processing is performed on the i-th touch track to obtain an (i+1)-th touch track after processing, wherein the number of track sampling points included in the (i+1)-th touch track is greater than the number of track sampling points included in the i-th touch track.

[0037] In a possible implementation, an angle threshold is set. When it is determined that the target angle value is less than the angle threshold, it means that there may be obvious jagged shapes at the three adjacent trajectory sampling points in the i-th touch trajectory. In order to avoid this phenomenon, it is necessary to perform midpoint interpolation processing on the i-th touch trajectory. By increasing the number of trajectory sampling points in the i-th touch trajectory, the angle of the target angle in the i-th touch trajectory is reduced, thereby improving the smoothness of the i-th touch trajectory, and obtaining the i+1-th touch trajectory as the result of this smoothing processing.

[0038] The angle threshold may be set by the developer in the terminal, and different terminal models may correspond to different angle thresholds; schematically, the angle threshold may be 150 degrees.

[0039] It should be noted that after obtaining the (i+1)th touch track, step 102 and step 103 need to be repeatedly executed until the touch track meets a certain smoothness, for example, when there is no target angle less than the angle threshold, the touch track processing is stopped.

[0040] like Figure 2 As shown, it shows a schematic diagram of the midpoint interpolation processing process shown in an exemplary embodiment of the present application. Take the i-th touch track 201 including track sampling point A, track sampling point O and track sampling point B as an example, the angle threshold is 150 degrees; the angle formed by three adjacent track sampling points in the i-th touch track 201 is ∠AOB, and the angle value corresponding to ∠AOB is obviously smaller than the angle threshold, and it is determined that the i-th touch track 201 needs to be processed by midpoint interpolation; in the midpoint interpolation process, the track sampling point C is interpolated at the midpoint of the track segment AO, and the track sampling point D is interpolated at the midpoint of the track segment OB; then the track sampling point O is removed, and the track sampling point A, the track sampling point C, the track sampling point D and the track sampling point B constitute a new i+1-th touch track 202; obviously, the smoothness of the i+1-th touch track 202 is better than that of the i-th touch track 201.

[0041] To sum up, in the embodiment of the present application, by obtaining the angle value of the target angle formed by three adjacent trajectory sampling points in the i-th touch trajectory, so that when the angle value is less than the angle threshold, the i-th touch trajectory is subjected to midpoint interpolation processing, so that the angle of the target angle in the i-th touch trajectory can be reduced by increasing the number of trajectory sampling points in the i-th touch trajectory, thereby improving the smoothness of the i-th touch trajectory; and the smoothing operation is relatively simple, and can be repeated for multiple times, thereby reducing the operating cost of the smoothing process while achieving the smoothing process of the touch trajectory.

[0042] In the process of performing midpoint interpolation processing on the i-th touch trajectory, the angle of the original three adjacent trajectory sampling points may be too small, resulting in too many interpolation times of the three adjacent trajectory sampling points, so that the actual distance between the three adjacent trajectory sampling points is already very narrow, but still does not meet the angle threshold, and needs to continue interpolation; and the drawing in the terminal device is in pixels. If the distance between two adjacent trajectory sampling points or the area formed by three adjacent trajectory sampling points is already less than the unit pixel, interpolation cannot be performed again. Therefore, in a possible implementation manner, it is necessary to jointly determine whether it is necessary to continue midpoint interpolation processing on the three adjacent trajectory sampling points based on the angle threshold and the interpolation condition.

[0043] Please refer to Figure 3 , which shows a flow chart of a touch track processing method shown in another exemplary embodiment of the present application. The present application embodiment takes the method applied to a terminal as an example for explanation. The method includes:

[0044] Step 301 : obtaining an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer.

[0045] Step 302: determine a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track.

[0046] The implementation of step 301 and step 302 can refer to step 101 and step 102, and the embodiment of the present application will not be described in detail here.

[0047] by Figure 2 For example, the process of determining the target angle value corresponding to the target angle ∠AOB may include the following steps:

[0048] 1. Determine vector OA and vector OB.

[0049] In a possible implementation, a coordinate system is constructed for the i-th touch track to determine the coordinate representation corresponding to each track sampling point in the i-th touch track.

[0050] Schematically, if the coordinate corresponding to the trajectory sampling point A is expressed as A(x1, y1), the coordinate corresponding to the trajectory sampling point O is expressed as O(x2, y2), and the coordinate corresponding to the trajectory sampling point B is expressed as B(x3, y3); then the vector OA can be expressed as OA = (x1-x2, y1-y2); the vector OB can be expressed as OB = (x3-x2, y3-y2).

[0051] 2. Determine the length L corresponding to vector OA and vector OB OA and L OB .

[0052] After the vector representations corresponding to the vector OA and the vector OB are determined, the length of the vector can be determined based on the vector representations.

[0053] In an illustrative example, the length of the vector OA can be expressed as:

[0054] L OA =sqrt[(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)](1)

[0055] Among them, L OA Represents the length of vector OA, and the sqrt() function represents the arithmetic square root.

[0056] Similarly, the length of vector OB can be expressed as:

[0057] L OB =sqrt[(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)](2)

[0058] 3. Determine the dot product of vector OA and vector OB.

[0059] Since the dot product of two vectors is related to the angle between the two vectors, the angle value can be determined by calculating the dot product between the two vectors.

[0060] In an illustrative example, the dot product of vector OA and vector OB can be expressed as:

[0061] P=(x1-x2)*(x3-x2)+(y1-y2)*(y3-y2)(3)

[0062] 4. Determine cos∠AOB.

[0063] OA·OB=|OA|*|OB|*cos∠AOB, therefore, after determining |OA|, |OB| and OA·OB, cos∠AOB can be determined; in an exemplary example, cos∠AOB=P / (L OA *L OB ).

[0064] 5. Determine the target angle value of the target angle.

[0065] Once the cosine value corresponding to the target angle is determined, the target angle value corresponding to the target angle can be obtained through the inverse cosine function.

[0066] In an illustrative example, the target angle value of the target angle can be expressed as:

[0067] ∠AOB=acos(cos∠AOB)*180 / PI(4)

[0068] Among them, PI represents pi, and acos() function represents the arc cosine function.

[0069] Substituting formula (1) to formula (3) into formula (4), the target angle value of the target included angle can be expressed as:

[0070] ∠AOB=acos{[(x1-x2)*(x3-x2)+(y1-y2)*(y3-y2)] / {[sqrt[(x1-x2)*(x1-x2) +(y1-y2)*(y1-y2)]]*[sqrt[(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2)]})*180 / PI.

[0071] Step 303: in response to the target angle value being less than the angle threshold and three adjacent trajectory sampling points satisfying the interpolation condition, midpoint interpolation processing is performed on the i-th touch trajectory to obtain the processed (i+1)-th touch trajectory, where the interpolation condition includes at least one of an area condition and a length condition.

[0072] In the process of performing midpoint interpolation processing on the i-th touch trajectory, the angle of the original three adjacent trajectory sampling points may be too small, resulting in too many interpolation times of the three adjacent trajectory sampling points, so that the actual distance between the three adjacent trajectory sampling points is already very narrow, but still does not meet the angle threshold, and interpolation needs to be continued; and the drawing in the terminal device is in pixels. If the distance between two adjacent trajectory sampling points or the area formed by three adjacent trajectory sampling points is already less than the unit pixel, it is obviously impossible to interpolate again. Therefore, in a possible implementation, an interpolation condition is also set, and it is necessary to comprehensively judge whether it is necessary to continue midpoint interpolation processing on the three adjacent trajectory sampling points according to the angle threshold and the interpolation condition. That is to say, when it is determined that the target angle value is less than the angle threshold, it is necessary to further judge whether the three adjacent trajectory sampling points meet the interpolation condition. If the interpolation condition is met, it means that interpolation can continue. In order to improve the smoothness of the i-th touch trajectory, the i-th touch trajectory is subjected to midpoint interpolation processing.

[0073] If the three trajectory sampling points can be processed by midpoint interpolation, the distance between two adjacent trajectory sampling points must be at least greater than or equal to 3 pixel values, or the triangle formed by the three adjacent trajectory sampling points must contain at least 9 unit pixels. Therefore, in a possible implementation, the interpolation condition can be set to include at least one of an area condition and a length condition.

[0074] Optionally, since the drawing of the terminal device is in pixels, the thresholds in the area condition and the length condition are also measured in screen pixels.

[0075] Taking the interpolation condition as an area condition as an example, in an exemplary example, step 303 may include step 303A and step 303B.

[0076] Step 303A: in response to the target angle value being less than the angle threshold, determining a target area corresponding to a target triangle, where the target triangle is composed of three adjacent trajectory sampling points.

[0077] In a possible implementation, when it is determined that the target angle value formed by three adjacent trajectory sampling points is less than the angle threshold, it is also necessary to determine the target area of ​​the target triangle formed by the three adjacent trajectory sampling points, and then determine whether midpoint interpolation processing can be performed on the three trajectory sampling points.

[0078] Since the terminal device draws in pixels, determining the target area of ​​the target triangle can be understood as determining the target number of pixels contained in a single screen pixel in the target triangle; schematically, the target area of ​​the target triangle can be 12 pixels.

[0079] Optionally, the area of ​​the target triangle may be calculated by using Region, RegionIterator, and Path. In an exemplary example, the process of calculating the area of ​​the target triangle may be:

[0080]

[0081] Step 303B: in response to the target area being greater than the area threshold, midpoint interpolation processing is performed on the i-th touch track to obtain an (i+1)-th touch track after processing.

[0082] In a possible implementation, when it is determined that the target area is greater than the area threshold, it means that the three adjacent trajectory sampling points meet the interpolation condition, and the midpoint interpolation processing can continue to be performed on the three adjacent trajectory sampling points to obtain the processed (i+1)th touch trajectory; conversely, when it is determined that the target area is less than the area threshold, it means that the three adjacent trajectory sampling points do not meet the interpolation condition, and the midpoint interpolation processing cannot be performed on the three adjacent trajectory sampling points.

[0083] Since the target area is measured in screen pixels, in a possible implementation, after determining the number of target pixels corresponding to the unit screen pixels contained in the target triangle, the number of target pixels is compared with the number threshold. If the number of target pixels is greater than the number threshold, it means that the three adjacent track sampling points meet the interpolation condition, and the midpoint interpolation process is performed on the i-th touch track to obtain the processed (i+1)-th touch track. On the contrary, if the number of target pixels is less than the number threshold, it means that the three adjacent track sampling points do not meet the interpolation condition, and the midpoint interpolation process is not performed on the three adjacent track sampling points.

[0084] In an illustrative example, the area threshold may be 9 pixels, that is, the quantity threshold is 9.

[0085] Optionally, if the i-th touch trajectory is ABCDEF, when it is determined that ∠ABC is less than the angle threshold, but the three adjacent trajectory sampling points ABC do not meet the interpolation condition, the midpoint interpolation processing of the trajectory sampling point ABC is stopped; ∠BCD can continue to be judged, if ∠BCD is less than the angle threshold, and the three adjacent trajectory sampling points BCD meet the interpolation condition, the midpoint interpolation processing is performed on the trajectory sampling point BCD to obtain the i+1-th touch trajectory.

[0086] Optionally, during the actual interpolation process, the parameter value of the area threshold can be dynamically adjusted according to actual needs. When the angle threshold is constant, the smaller the area threshold, the greater the number of interpolations and the better the curve smoothing effect.

[0087] like Figure 4 As shown, it shows a schematic diagram of the smoothing effect of different area thresholds. The initial touch track 401 contains 42 track sampling points, and the angle threshold is set to 175 degrees; when the area threshold is set to 100 pixels, the initial touch track 401 is interpolated and smoothed to obtain the first target touch track 402, and the first target touch track 402 contains 105 track sampling points, and the number of interpolation is 63; when the area threshold is set to 9 pixels, the initial touch track 401 is interpolated and smoothed to obtain the second target touch track 403, and the second target touch track 403 contains 177 track sampling points, and the number of interpolation is 135; by comparing the first target touch track 402 and the second target touch track 403, it can be clearly seen that when the angle threshold is the same, the smaller the area threshold, the more interpolation points, but the better the smoothing effect.

[0088] Optionally, similar to the area threshold, in the actual interpolation process, the parameter value of the angle threshold can also be dynamically adjusted according to actual needs. When the area threshold is constant, the larger the angle threshold, the more interpolations there are and the better the curve smoothing effect.

[0089] like Figure 5As shown, it shows a schematic diagram of the smoothing effect of different angle thresholds. The initial touch track 501 contains 42 track sampling points, and the area threshold is set to 9 pixels; when the angle threshold is set to 150 degrees, the initial touch track 501 is interpolated and smoothed to obtain the first target touch track 502, which contains 57 track sampling points and the number of interpolations is 15; when the angle threshold is set to 175 degrees, the initial touch track 501 is interpolated and smoothed to obtain the second target touch track 503, which contains 177 track sampling points and the number of interpolations is 135; by comparing the first target touch track 502 and the second target touch track 503, it can be clearly seen that when the area threshold is the same, the larger the angle threshold, the more interpolation points, but the better the smoothing effect.

[0090] Taking the interpolation condition as a length condition as an example, in an exemplary example, step 303 may also include step 303C and step 303D.

[0091] Step 303C, in response to the target angle value being less than the angle threshold, determining a first segment length corresponding to the first trajectory segment and a second segment length corresponding to the second trajectory segment, wherein the first trajectory segment and the second trajectory segment are composed of three adjacent trajectory sampling points.

[0092] In a possible implementation, when it is determined that the target angle value is less than the angle threshold, the segment lengths of adjacent trajectory segments formed by three adjacent trajectory sampling points are determined, that is, the first segment length corresponding to the first trajectory segment and the second segment length corresponding to the second trajectory segment are determined to determine whether midpoint interpolation processing can also be performed on the three adjacent trajectory sampling points.

[0093] Optionally, the line segment lengths respectively corresponding to the first trajectory line segment and the second trajectory line segment may be in units of a single screen pixel; schematically, the first line segment length of the first trajectory line segment may be 6 pixels, and the second line segment length of the second trajectory line segment may be 8 pixels.

[0094] Step 303D: in response to the first line segment length and the second line segment length both being greater than a length threshold, midpoint interpolation processing is performed on the i-th touch track to obtain an (i+1)-th touch track after processing, where the length threshold is in units of a single screen pixel.

[0095] In a possible implementation, a length threshold is provided in the terminal. After determining the first line segment length corresponding to the first trajectory line segment and the second line segment length corresponding to the second trajectory line segment, the first line segment length and the second line segment length can be compared with the length threshold respectively. If it is determined that both the first line segment length and the second line segment length are greater than the length threshold, it indicates that the three adjacent trajectory points meet the interpolation condition, and the midpoint interpolation processing can be performed on the i-th touch trajectory to obtain the processed (i+1)-th touch trajectory; conversely, if it is determined that the line segment length of at least one trajectory line segment in the first trajectory line segment and the second trajectory line segment is less than the length threshold, it indicates that the three adjacent trajectory sampling points do not meet the interpolation condition, and the midpoint interpolation processing of the three adjacent trajectory sampling points is stopped.

[0096] The length threshold is in units of a single screen pixel. Schematically, the length threshold may be 3 pixels.

[0097] Optionally, during the actual interpolation process, the parameter value of the length threshold can be dynamically adjusted according to actual needs. When the angle threshold is constant, the smaller the length threshold, the greater the number of interpolations and the better the curve smoothing effect.

[0098] Optionally, if the i-th touch trajectory contains more than three trajectory sampling points, when the first group of three adjacent trajectory sampling points does not meet the interpolation condition, it can be re-determined whether the target angle formed by the second group of three adjacent trajectory sampling points is less than the angle threshold. If it is less than the angle threshold, it is determined whether the second group of three adjacent trajectory sampling points meets the interpolation condition. If it meets the interpolation condition, midpoint interpolation processing is performed on it to obtain the processed i+1-th touch trajectory.

[0099] Step 304 , in response to the target angle value being less than the angle threshold and the three adjacent trajectory sampling points not satisfying the interpolation condition, stopping the midpoint interpolation processing on the three adjacent trajectory sampling points.

[0100] In a possible implementation, when it is determined that the target angle is less than the angle threshold and the three adjacent trajectory sampling points do not meet the interpolation condition, the midpoint interpolation process for the three adjacent trajectory sampling points is stopped.

[0101] Optionally, if the i-th touch track also includes other three adjacent track sampling points, the angle threshold and interpolation condition need to be re-judged. If the interpolation condition is met, midpoint interpolation processing is performed on the three adjacent track sampling points to obtain the (i+1)-th touch track.

[0102] Optionally, if, except for the three adjacent tracks, there are no other target angles in the i-th touch track whose angle values ​​are less than the angle threshold, or if there are target angles whose angle values ​​are less than the angle threshold but do not meet the interpolation condition, it indicates that the smoothing processing of the i-th touch track is completed, and the midpoint interpolation processing of the i-th touch track is stopped.

[0103] Optionally, if the angle values ​​of the target angle formed by any three adjacent trajectory sampling points in the i-th touch trajectory are all greater than the angle threshold, it means that the smoothness of the i-th touch trajectory is good, and the midpoint interpolation processing of the i-th touch trajectory is stopped.

[0104] In this embodiment, by comprehensively determining whether to perform midpoint interpolation processing on the i-th touch track through the angle threshold and the interpolation condition, it can be avoided that the interpolation cannot be performed due to the distance between adjacent track sampling points being too small or the area of ​​the triangle formed by three adjacent track sampling points being too low; while ensuring that the actual smoothing processing effect is good, it avoids the circular calculation caused by the drawing accuracy, thereby improving the smoothing processing efficiency.

[0105] In the process of performing midpoint interpolation processing on the touch trajectory, in addition to adding trajectory sampling points in the touch trajectory, the vertices corresponding to the target angle in the original touch trajectory are also removed, thereby achieving a smoothing effect of the touch trajectory.

[0106] Please refer to Figure 6 , which shows a flow chart of a touch track processing method shown in another exemplary embodiment of the present application. The present application embodiment takes the method applied to a terminal as an example for explanation. The method includes:

[0107] Step 601: Obtain an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer.

[0108] Step 602: determine a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track.

[0109] The implementation of step 601 and step 602 can refer to the above embodiment, and this embodiment will not be described in detail here.

[0110] Step 603 : in response to the target angle value being less than the angle threshold, determining a first track segment and a second track segment constituting a target angle in the i-th touch track.

[0111] In a possible implementation, during the midpoint interpolation process, it is necessary to interpolate the two sides constituting the target angle separately, that is, to interpolate the first trajectory segment and the second trajectory segment separately. Therefore, when it is determined that the target angle value is less than the angle threshold, the first trajectory segment and the second trajectory segment constituting the target angle in the i-th touch trajectory are first determined, and then the position of the newly added trajectory sampling point is determined.

[0112] Optionally, when it is determined that the target angle value is less than the angle threshold and three adjacent trajectory sampling points meet the interpolation condition, the midpoint interpolation operation shown in this embodiment is performed.

[0113] like Figure 7 As shown, it shows a schematic diagram of the midpoint interpolation processing process shown in another exemplary embodiment of the present application. The i-th touch track 701 includes track sampling point A, track sampling point O and track sampling point B; ∠AOB is less than the angle threshold, then the first track segment AO and the second track segment OB need to be midpoint interpolated.

[0114] Step 604: perform midpoint interpolation on the first trajectory segment to obtain a first interpolation sampling point.

[0115] In the midpoint interpolation process, the midpoint of the first track segment is determined as the first interpolation sampling point, and then the first interpolation sampling point is inserted into the touch track.

[0116] by Figure 2 For example, in an exemplary example, the first interpolation sampling point C can be expressed as:

[0117] C(x4, y4)=(x1*0.5+x2*0.5,y1*0.5+y2*0.5)

[0118] Step 605: Perform midpoint interpolation on the second trajectory segment to obtain a second interpolation sampling point.

[0119] Similarly, in the process of performing midpoint interpolation processing on the second trajectory segment, the midpoint of the second trajectory segment is determined as the second interpolation sampling point, so that the second interpolation sampling point is inserted into the touch trajectory.

[0120] by Figure 2 For example, in an exemplary example, the second interpolation sampling point D can be expressed as:

[0121] D(x5,y5)=(x3*0.5+x2*0.5,y3*0.5+y2*0.5)

[0122] It should be noted that, in the actual processing process, step 504 and step 605 may be executed simultaneously, or step 604 may be executed first and then step 605; or step 605 may be executed first and then step 604, and the embodiments of the present application do not constitute a limitation on this.

[0123] Step 606: Generate an (i+1)th touch track based on the first interpolation sampling point, the second interpolation sampling point and three adjacent track sampling points.

[0124] In a possible implementation, after the first interpolation sampling point and the second interpolation sampling point are acquired, the first interpolation sampling point and the second interpolation sampling point are inserted into the i-th touch track, thereby generating the (i+1)-th touch track.

[0125] Since the purpose of adding interpolation sampling points is to reduce the degree of aliasing, when inserting the first interpolation sampling point and the second interpolation sampling point into the i-th touch track, the original vertices need to be removed; in an exemplary example, step 606 may include step 606A and step 606B.

[0126] Step 606A, removing the target trajectory sampling point from the three adjacent trajectory sampling points to obtain two adjacent trajectory sampling points, where the target trajectory sampling point is the vertex corresponding to the target angle.

[0127] Taking the touch trajectory AOB as an example, if the first interpolation sampling point C is inserted between AO and the second interpolation sampling point D is inserted between OB, in order to smooth the touch trajectory, point O needs to be removed and the first interpolation sampling point and the second interpolation sampling point need to be connected. Therefore, in a possible implementation, the target trajectory sampling point among the three adjacent trajectory sampling points, that is, the vertex corresponding to the target angle, is removed, and then the i+1th touch trajectory is generated based on the remaining two trajectory sampling points and the newly added interpolation sampling points.

[0128] Step 606B: Generate the (i+1)th touch track based on the first interpolation sampling point, the second interpolation sampling point and two adjacent track sampling points.

[0129] In a possible implementation, the first interpolation sampling point and the second interpolation sampling point are connected, and one end of the first interpolation sampling point is connected to an original track sampling point, and one end of the second interpolation sampling point is connected to another original track sampling point, so as to generate the (i+1)th touch track.

[0130] like Figure 7As shown, taking the angle threshold of 150 degrees as an example, for the i-th touch track 701, since ∠AOB is less than the angle threshold, it is necessary to perform midpoint interpolation processing on it, then interpolate sampling point C at the midpoint of AO, interpolate sampling point D at the midpoint of OB, remove the track sampling point O, connect ACDB, and generate the i+1-th touch track 702; for the i-th touch track 702, since ∠ACD is still less than the angle threshold, it is also necessary to perform midpoint interpolation processing on it, then interpolate sampling point E at the midpoint of AC, interpolate sampling point F at the midpoint of CD, remove the track sampling point C, connect AEFDB, and generate the i+2-th touch track 703; for the i+2-th touch track In the trace 703, since ∠AEF and ∠EFD are both greater than the angle threshold, there is no need to perform midpoint interpolation processing on them, while ∠FDB is less than the angle threshold, it is necessary to perform midpoint interpolation processing on them, then the sampling point G is interpolated at the midpoint of FD, the sampling point H is interpolated at the midpoint of DB, and the trace sampling point D is removed, and AEFGHB is connected to generate the i+3 touch trace 704; since each angle in the i+3 touch trace 704 is greater than the angle threshold, it means that the smoothing processing of the i+3 touch trace 704 is completed; the i-th touch trace 701 to the i+3 touch trace 704 undergo three midpoint interpolation processings, which can obviously improve the smoothness of the original touch trace.

[0131] In this embodiment, the midpoint of the first trajectory segment is used as the first interpolation sampling point, the midpoint of the second trajectory segment is used as the second interpolation sampling point, the first interpolation sampling point and the second interpolation sampling point are connected, and the vertices are removed so that a new interpolation sampling point is added to the i-th touch trajectory, thereby achieving the purpose of smoothing the i-th touch trajectory.

[0132] Please refer to Figure 8 , which shows a structural block diagram of a touch track processing device provided by an exemplary embodiment of the present application. The device can be implemented as all or part of a computer device through software, hardware, or a combination of both. The device includes:

[0133] An acquisition module 801 is used to acquire an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer;

[0134] A determination module 802 is used to determine a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track;

[0135] The first processing module 803 is used for performing midpoint interpolation processing on the i-th touch track in response to the target angle value being less than the angle threshold, to obtain an (i+1)-th touch track after processing, wherein the number of track sampling points included in the (i+1)-th touch track is greater than the number of track sampling points included in the i-th touch track.

[0136] Optionally, the first processing module 803 includes:

[0137] a trajectory processing unit, configured to, in response to the target angle value being less than the angle threshold and the three adjacent trajectory sampling points satisfying an interpolation condition, perform midpoint interpolation processing on the i-th touch trajectory to obtain the processed i+1-th touch trajectory, wherein the interpolation condition includes at least one of an area condition and a length condition.

[0138] Optionally, the interpolation condition is the area condition;

[0139] The trajectory processing unit is further used for:

[0140] In response to the target angle value being less than the angle threshold, determining a target area corresponding to a target triangle, the target triangle being formed by the three adjacent trajectory sampling points;

[0141] In response to the target area being greater than an area threshold, midpoint interpolation processing is performed on the i-th touch track to obtain the processed (i+1)-th touch track.

[0142] Optionally, the trajectory processing unit is further used for:

[0143] Determining a target number of pixels in the target triangle that contains a single screen pixel;

[0144] The trajectory processing unit is further used for:

[0145] In response to the target pixel quantity being greater than a quantity threshold, midpoint interpolation processing is performed on the i-th touch track to obtain the processed (i+1)-th touch track.

[0146] Optionally, the interpolation condition is the length condition;

[0147] The trajectory processing unit is further used for:

[0148] In response to the target angle value being less than the angle threshold, determining a first line segment length corresponding to a first trajectory line segment and a second line segment length corresponding to the second trajectory line segment, wherein the first trajectory line segment and the second trajectory line segment are formed by the three adjacent trajectory sampling points;

[0149] In response to the first line segment length and the second line segment length being both greater than a length threshold, midpoint interpolation processing is performed on the i-th touch track to obtain the processed (i+1)-th touch track, where the length threshold is in units of a single screen pixel.

[0150] Optionally, the device further comprises:

[0151] The second processing module is configured to stop performing midpoint interpolation processing on the three adjacent trajectory samples in response to the target angle value being less than the angle threshold and the three adjacent trajectory sampling points not satisfying the interpolation condition.

[0152] Optionally, the first processing module 803 includes:

[0153] A determining unit, configured to determine a first track segment and a second track segment constituting the target angle in the i-th touch track;

[0154] A first interpolation unit, configured to perform midpoint interpolation on the first trajectory segment to obtain a first interpolation sampling point;

[0155] A second interpolation unit, configured to perform midpoint interpolation on the second trajectory segment to obtain a second interpolation sampling point;

[0156] A generating unit is configured to generate the (i+1)th touch track based on the first interpolation sampling point, the second interpolation sampling point and the three adjacent track sampling points.

[0157] Optionally, the generating unit is further used for:

[0158] Removing the target trajectory sampling point from the three adjacent trajectory sampling points to obtain two adjacent trajectory sampling points, wherein the target trajectory sampling point is the vertex corresponding to the target angle;

[0159] The (i+1)th touch trajectory is generated based on the first interpolation sampling point, the second interpolation sampling point and the two adjacent trajectory sampling points.

[0160] Optionally, the device further comprises:

[0161] The third processing module is configured to stop performing midpoint interpolation processing on the i-th touch track in response to the target angle value being greater than the angle threshold.

[0162] In the embodiment of the present application, by obtaining the angle value of the target angle formed by three adjacent trajectory sampling points in the i-th touch trajectory, so that when the angle value is less than the angle threshold, the i-th touch trajectory is subjected to midpoint interpolation processing, so that the angle of the target angle in the i-th touch trajectory can be reduced by increasing the number of trajectory sampling points in the i-th touch trajectory, thereby improving the smoothness of the i-th touch trajectory; and the smoothing operation is relatively simple, and can be repeated for multiple times, thereby reducing the operating cost of the smoothing processing while achieving the smoothing processing of the touch trajectory.

[0163] In an exemplary embodiment, a terminal is also provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the touch trajectory processing method performed by the terminal as provided in the above embodiment.

[0164] An embodiment of the present application further provides a computer-readable storage medium, which stores at least one instruction, and the at least one instruction is loaded and executed by a processor to implement the touch track processing method described in the above embodiments.

[0165] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a terminal reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the terminal executes the touch track processing method provided in various optional implementations of the above aspects.

[0166] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.

[0167] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A touch track processing method, characterized in that: The method comprises: Obtaining an i-th touch track, where the i-th touch track includes at least three track sampling points, and i is a positive integer; Determine a target angle value corresponding to a target angle in the i-th touch track, where the target angle is formed by three adjacent track sampling points in the i-th touch track; In response to the target angle value being less than the angle threshold and the three adjacent trajectory sampling points satisfying an interpolation condition, midpoint interpolation is performed on a first trajectory segment and a second trajectory segment constituting the target angle in the i-th touch trajectory to obtain a first interpolation sampling point and a second interpolation sampling point, respectively, wherein the interpolation condition includes at least one of an area condition and a length condition; Removing the target trajectory sampling point from the three adjacent trajectory sampling points to obtain two adjacent trajectory sampling points, wherein the target trajectory sampling point is the vertex corresponding to the target angle; Based on the first interpolation sampling point, the second interpolation sampling point and the two adjacent trajectory sampling points, a processed (i+1)th touch trajectory is obtained, and the number of trajectory sampling points included in the (i+1)th touch trajectory is greater than the number of trajectory sampling points included in the (i)th touch trajectory.

2. The method according to claim 1, characterized in that The interpolation condition is the area condition; The method further comprises: In response to the target angle value being less than the angle threshold, determining a target area corresponding to a target triangle, the target triangle being formed by the three adjacent trajectory sampling points; In response to the target area being greater than an area threshold, it is determined that the three adjacent trajectory sampling points satisfy the interpolation condition.

3. The method according to claim 2, characterized in that The determining of the target area corresponding to the target triangle includes: Determining a target number of pixels in the target triangle that contains a single screen pixel; In response to the target area being greater than an area threshold, determining that the three adjacent trajectory sampling points satisfy the interpolation condition includes: In response to the target pixel quantity being greater than a quantity threshold, it is determined that the three adjacent trajectory sampling points satisfy the interpolation condition.

4. The method according to claim 1, characterized in that: The interpolation condition is the length condition; The method further comprises: In response to the target angle value being less than the angle threshold, determining a first line segment length corresponding to a first trajectory line segment and a second line segment length corresponding to a second trajectory line segment, wherein the first trajectory line segment and the second trajectory line segment are formed by the three adjacent trajectory sampling points; In response to the first line segment length and the second line segment length both being greater than a length threshold, it is determined that the three adjacent trajectory sampling points meet the interpolation condition, where the length threshold is in units of a single screen pixel.

5. The method according to claim 1, characterized in that The method further comprises: In response to the target angle value being less than the angle threshold and the three adjacent trajectory sampling points not satisfying the interpolation condition, the midpoint interpolation processing of the three adjacent trajectory samples is stopped.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: In response to the target angle value being greater than the angle threshold, stopping the midpoint interpolation process on the i-th touch track.

7. A touch track processing device, characterized in that: The device comprises: An acquisition module, configured to acquire an i-th touch track, wherein the i-th touch track includes at least three track sampling points, and i is a positive integer; a determination module, configured to determine a target angle value corresponding to a target angle in the i-th touch track, wherein the target angle is formed by three adjacent track sampling points in the i-th touch track; a first processing module, configured to, in response to the target angle value being less than an angle threshold and the three adjacent trajectory sampling points satisfying an interpolation condition, perform midpoint interpolation on a first trajectory segment and a second trajectory segment constituting the target angle in the i-th touch trajectory to obtain a first interpolation sampling point and a second interpolation sampling point, respectively, wherein the interpolation condition includes at least one of an area condition and a length condition; Removing the target trajectory sampling point from the three adjacent trajectory sampling points to obtain two adjacent trajectory sampling points, wherein the target trajectory sampling point is the vertex corresponding to the target angle; Based on the first interpolation sampling point, the second interpolation sampling point and the two adjacent trajectory sampling points, a processed (i+1)th touch trajectory is obtained, and the number of trajectory sampling points included in the (i+1)th touch trajectory is greater than the number of trajectory sampling points included in the (i)th touch trajectory.

8. A terminal, characterized in that: The terminal includes a processor and a memory, wherein at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor to implement the touch track processing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the touch trajectory processing method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the touch trajectory processing method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Touch screen based gesture recognition method and system

    CN104102450A

  • Touch-remote-controller-based gesture recognition method and device

    CN106658123A