A touch point trajectory based matching method
By pre-collecting and real-time collecting graphic trajectories from the touchscreen, a grid model library is established. By cyclically comparing the trajectories in the model library that have been removed, the problem of poor matching of complex graphic trajectories on the touchscreen is solved, and more efficient graphic recognition and matching is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- E SURFING VIDEO MEDIA CO LTD
- Filing Date
- 2022-09-09
- Publication Date
- 2026-07-24
Smart Images

Figure CN115576475B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer software algorithm processing technology, and specifically relates to a matching method based on touch point trajectory. Background Technology
[0002] Touchscreens currently occupy a dominant position in electronic digital products, from smartphones and tablets to large-screen touch-interactive tables. Smartphones and tablets have cultivated users' habits of using touch operation, transitioning from the era of physical buttons to the touch era. In addition to simple clicks and swipes, touch operations may also require complex dragging operations, such as circular, triangular, and other custom graphic trajectories. Current methods for calculating the trajectory of the current touch and matching it with trajectories in a model library are not yet perfect, resulting in unsatisfactory matching results. Therefore, we need to propose a matching method based on touch point trajectories to address these problems. Summary of the Invention
[0003] The purpose of this invention is to provide a matching method based on touch point trajectories. First, the coordinate data of the graphic trajectory is pre-collected and collected in real-time to establish a model library of graphics to be matched. The area to be identified is divided into a uniform grid of squares. The comparison model library and matching model are then established sequentially. Next, when the user finishes inputting the graphic on the touchscreen, the trajectory points are marked by a grid. All trajectories in the eliminated model library are compared sequentially, and the graphic with the smallest value is the one to be matched. This method enables graphic recognition and matching within the touchscreen program, thus solving the problems mentioned in the background art.
[0004] To achieve the above objectives, the present invention adopts the following technical solution:
[0005] A matching method based on touch point trajectories includes the following steps:
[0006] S1. Collect coordinate trajectory data. Perform pre-collection and real-time collection of coordinate data of graphic trajectory to obtain pre-collected coordinate trajectory data and real-time collected coordinate trajectory data.
[0007] S2. Establish a model. First, divide the pre-collected coordinate trajectory data and the real-time collected coordinate trajectory data into grids. Then, confirm the position of the coordinate trajectory in the grid and mark it as 1 in the grid it passes through. Establish a comparison model library and a matching model.
[0008] S3. Preliminarily exclude mismatched results by removing data from the comparison model library that is obviously mismatched with the matching model, and obtain the excluded model library.
[0009] S4. Loop comparison: Loop the removed model library with the matching model. Compare all trajectories in the removed model library in turn, and find the graphic with the smallest comparison value as the matching graphic.
[0010] Preferably, the pre-collected coordinate trajectory data in step S1 is obtained within a specified range on the touch screen after the user has finished inputting the graphic path drawn by the user, and the information of the path collection points is saved.
[0011] Preferably, in step S2, the area to be identified is divided into uniform square grids during grid division. The number of grids is represented by m×n. The graphic trajectory points to be identified are placed in the m×n grids, and the grid parts passed through by the graphic trajectory are marked as 1. The comparison model library and matching model to be matched are established in sequence, and the comparison is awaited.
[0012] Preferably, when establishing the comparison model library, all graphics that need to be matched are parsed in a grid. First, the recognition area is divided into m×n grids, and the cells that the graphic path passes through are marked as 1, and other cells that have not been passed through are marked as 0. All graphic paths that need to be matched are parsed in a grid in sequence and then stored in the comparison library.
[0013] Preferably, when the matching model is established, the recognition area is divided into m×n grids, the cells traversed by the graphic path are marked as 1, and other untraversed cells are marked as 0. The result is stored as a temporary image path map, waiting to be compared with the data in the model library one by one.
[0014] Preferably, the preliminary elimination of mismatch results in step S3 is as follows: when collecting data, calculate the number of grids occupied by a single graphic, represented by CC. Iteratively compare the CC of all graphics in the model library with the CC of the user-input graphic. Set the judgment threshold T as the percentage of the CC of the user-input graphic, i.e., T = user-input CC × p, where p ranges from 0.1 to 0.9. A larger p value means more data is eliminated and the matching efficiency is higher. When the CC value in the model library is less than the preset threshold, it is determined that the graphic in the model library is mismatched and is removed, thus obtaining the model library that has been removed.
[0015] Preferably, the cyclic comparison in step S4 is performed after the user finishes inputting the graphic on the touch screen. At the same time, a grid is created to mark the trajectory points, and all trajectories in the model library are compared in turn. The graphic with the smaller comparison value is the matching graphic.
[0016] Preferably, the cyclic comparison involves comparing the user-drawn graphical path grid data with each grid data in the removed model library. The corresponding grid p' in the user-drawn graphical grid is subtracted from the existing grid p in the removed model library. The subtraction result for each grid is d = p - p'. All subtracted values are then summed.
[0017] s = d1 + d2 + d3 + ... + d(m × n),
[0018] By comparing all the trajectories in the removed template library in turn, the smallest value is the matching graphic.
[0019] The touch point trajectory matching method proposed in this invention has the following advantages compared with the prior art:
[0020] 1. This invention primarily involves pre-collecting and real-time collecting the coordinate data of graphic trajectories, establishing a model library of graphics to be matched, dividing the area to be identified into a uniform grid of squares, and sequentially establishing the comparison model library and matching model to be matched. Secondly, when the user finishes inputting the graphic on the touchscreen, the same grid is established to mark the trajectory points, and all trajectories in the model library that have been removed are compared sequentially. The graphic with the smallest value is the one to be matched. In this way, graphic recognition and matching can be achieved in the touchscreen program, which improves the matching effect between the current touch trajectory and the trajectory in the model library to a certain extent. Attached Figure Description
[0021] Figure 1 This is a flowchart of the present invention;
[0022] Figure 2 This is a schematic diagram of the process of the present invention;
[0023] Figure 3 This is a schematic diagram illustrating the principle of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The specific embodiments described herein are merely used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] This invention provides, for example Figure 1-2 The method shown includes the following steps:
[0026] S1. Collect coordinate trajectory data. Perform pre-collection and real-time collection of coordinate data of graphic trajectory to obtain pre-collected coordinate trajectory data and real-time collected coordinate trajectory data.
[0027] The pre-collected coordinate trajectory data is obtained within a specified range on the touch screen after the user has finished inputting the graphic path drawn by the user, and the information of the path collection points is saved.
[0028] S2. Establish a model. First, divide the pre-collected coordinate trajectory data and the real-time collected coordinate trajectory data into grids. Then, confirm the position of the coordinate trajectory in the grid and mark it as 1 in the grid it passes through. Establish a comparison model library and a matching model.
[0029] During grid division, the area to be identified is divided into uniform square grids, with the number of grids represented by m×n. The graphic trajectory points to be identified are placed in the m×n grid. The larger the values of m and n, the finer the division. The grid portion traversed by the graphic trajectory is marked as 1. The required comparison model library and matching model are built in sequence, and then compared.
[0030] When the comparison model library is established, all the graphics that need to be matched are parsed into a grid. First, the recognition area is divided into m×n grids. The cells that the graphic path passes through are marked as 1, and other cells that have not been passed through are marked as 0. All the graphic paths that need to be matched are parsed into a grid in this way and then stored in the comparison library.
[0031] When the matching model is established, the recognition area is divided into m×n grids. The cells that the graphic path passes through are marked as 1, and other cells that have not been passed through are marked as 0. The result is stored as a temporary image path map, which is then compared with the data in the model library one by one.
[0032] S3. Preliminarily exclude mismatched results by removing data from the comparison model library that is obviously mismatched with the matching model, and obtain the excluded model library.
[0033] The preliminary steps for eliminating mismatches are as follows: When collecting data, calculate the number of grids occupied by a single graphic, represented by CC. Iteratively compare the CC of all graphics in the model library with the CC of the user-input graphic. Set the judgment threshold T as the percentage of the CC of the user-input graphic, i.e., T = user-input CC × p, where p ranges from 0.1 to 0.9. A larger p value results in more data being eliminated and higher matching efficiency. When the CC value in the model library is less than the preset threshold, it is determined that the graphic in the model library is mismatched and is removed, thus obtaining the model library that has been removed.
[0034] S4. Loop comparison: Loop the removed model library with the matching model. Compare all trajectories in the removed model library in turn, and find the graphic with the smallest comparison value as the matching graphic.
[0035] The cyclic comparison involves creating a grid to mark the trajectory points after the user finishes inputting a graphic on the touchscreen, comparing all trajectories in the model library sequentially, and finding the graphic with the smaller comparison value.
[0036] The cyclic comparison involves comparing the user-drawn graphical path grid data with each grid data in the removed model library. It subtracts the corresponding grid p' from the user-drawn graphical grid data from the existing grid data in the removed model library. The subtraction result for each grid is d = p - p'. The subtracted values for all grids are then summed.
[0037] s = d1 + d2 + d3 + ... + d(m × n),
[0038] By comparing all the trajectories in the removed template library in turn, the smallest value is the matching graphic.
[0039] like Figure 3 As shown in the image, A represents the path template that has been removed from the template library, and B represents the user-input image path. The black block has a value of 1, and the blank block has a value of 0. Subtracting the two images, A and B, from each other, the minimum value is the best matching result.
[0040] In summary, by first pre-collecting and real-time collecting the coordinate data of the graphic trajectory, a model library of graphics to be matched is established. The area to be identified is divided into a uniform square grid, and the comparison model library and matching model to be matched are established in turn. Then, when the user finishes inputting the graphic on the touch screen, the trajectory points are marked by the same grid. All trajectories in the model library that have been removed are compared in turn, and the graphic with the smallest value is the matching graphic. In this way, graphic recognition and matching judgment can be realized in the touch screen program, which improves the matching effect between the current touch trajectory and the trajectory in the model library to a certain extent. The method provided by this invention is hardware-independent, so it has strong versatility and can be used in different touch programs.
[0041] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A matching method based on touch point trajectory, characterized in that: Includes the following steps: S1. Collect coordinate trajectory data. Perform pre-collection and real-time collection of coordinate data of graphic trajectory to obtain pre-collected coordinate trajectory data and real-time collected coordinate trajectory data. S2. Model building: First, the pre-collected coordinate trajectory data and the real-time collected coordinate trajectory data are divided into grids. Then, the position of the coordinate trajectory in the grid is confirmed, and the grids it passes through are marked as 1. A comparison model library and a matching model are built. When dividing the grid, the area to be identified is divided into uniform square grids, and the number of grids is represented by m×n. The graphic trajectory points to be identified are placed in the m×n grids, and the grid parts passed through by the graphic trajectory are marked as 1. The comparison model library and the matching model to be matched are built in sequence, and the comparison model library is awaited for comparison. When the comparison model library is built, all graphics to be matched are parsed by grid. First, the identification area is divided into m×n grids. The cells passed through by the graphic path are marked as 1, and other cells not passed through are marked as 0. All graphic paths to be matched are parsed by grid in sequence and then stored in the comparison library. S3. Preliminarily exclude mismatched results by removing data from the comparison model library that is obviously mismatched with the matching model, and obtain the excluded model library. S4. Loop comparison: Loop comparison between the removed model library and the matching model. Compare all trajectories in the removed model library in turn, and find the graphic with the smallest comparison value as the matching graphic. The cyclic comparison involves comparing the user-drawn graphical path grid data with each grid data in the removed model library. It subtracts the corresponding grid p' from the user-drawn graphical grid data from the existing grid data in the removed model library. The subtraction result for each grid is d = p - p'. All subtraction results are then summed. s= d1 + d2 +d3 + … + d(m×n), By comparing all the trajectories in the removed template library in turn, the smallest value is the matching graphic.
2. The matching method based on touch point trajectory according to claim 1, characterized in that: The pre-collected coordinate trajectory data mentioned in step S1 is obtained within a specified range on the touch screen after the user has finished inputting the graphic path drawn by the user, and the information of the path collection points is saved.
3. The matching method based on touch point trajectory according to claim 2, characterized in that: When the matching model is established, the recognition area is divided into m×n grids. The cells that the graphic path passes through are marked as 1, and other cells that have not been passed through are marked as 0. The result is stored as a temporary image path map, which is then compared with the data in the model library one by one.
4. The matching method based on touch point trajectory according to claim 3, characterized in that: The preliminary elimination of mismatch results in step S3 is as follows: When collecting data, calculate the number of grids occupied by a single graphic, represented by CC. Iteratively compare the CC of all graphics in the model library with the CC of the user-input graphic. Set the judgment threshold T as the percentage of the CC of the user-input graphic, i.e., T = user-input CC × p, where p ranges from 0.1 to 0.
9. A larger p value means more data is eliminated and the matching efficiency is higher. When the CC value in the model library is less than the preset threshold, it is determined that the graphic in the model library is mismatched and is removed, thus obtaining the model library that has been removed.
5. The matching method based on touch point trajectory according to claim 4, characterized in that: The cyclic comparison mentioned in step S4 is to create a grid to mark the trajectory points when the user finishes inputting the graphic on the touch screen, and then compare all the trajectories in the model library in turn, and find the graphic with the smaller comparison value.