Rapid multi-gesture recognition method

Through the rapid multi-stroke gesture recognition method, the problems of resource consumption, data requirements and insufficient generalization ability in neural network gesture recognition technology are solved, and a lightweight and efficient gesture recognition system is realized, which is suitable for rapid prototyping and user interfaces. development.

CN118570820APending Publication Date: 2024-08-30合肥栈顶信息科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410690136.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-30
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing neural network gesture recognition technology has problems such as high resource consumption, large training data requirements, limited generalization ability, poor interpretability, and complex deployment and maintenance, making it difficult to effectively apply in rapid prototyping and user interface development.

Method used

A fast multi-pen gesture recognition method is adopted to design a recognizer that can automatically distinguish between one-dimensional and two-dimensional gestures by resampling, rotating, scaling, translating and normalizing gesture data, combined with a single template that automatically extends to gesture recognition of all pen sequence combinations. , supports direction invariance, and adopts speed optimization methods to achieve fast recognition.

Benefits of technology

A lightweight, efficient, easy to deploy and maintain gesture recognition system is implemented, which reduces data requirements, enhances generalization capabilities, supports direction invariance, and ensures real-time response, making it suitable for rapid prototyping and user interface development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FDA0004868184140000051
    Figure FDA0004868184140000051
  • Figure FDA0004868184140000024
    Figure FDA0004868184140000024
  • Figure FDA0004868184140000062
    Figure FDA0004868184140000062
Patent Text Reader

Abstract

The invention relates to the field of gesture recognition, and discloses a rapid multi-gesture recognition method, which comprises the following steps of: 1, carrying out resampling to obtain a resampling point set, and then processing a rounding error to obtain a point set P; 2, calculating an indication angle and rotating, and calculating to obtain a point set rotation RotateQ after rotation; 3, calculating a bounding box, and zooming to a specific size according to the bounding box of the point set; 4, setting a new reference point pt, and translating the point set P to a new centroid position pt; 5, converting the point set into a standardized vector array; a sixth step of combining the plurality of strokes into a continuous single stroke (points); according to the rapid multi-gesture recognition method and the lightweight algorithm, compared with a deep learning model, the lightweight gesture recognition algorithm is simpler, low in calculation cost and easy to deploy on equipment with limited resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of gesture recognition, and in particular to a fast multi-stroke gesture recognition method. Background Art

[0002] With the popularity of touch technology and stylus input devices, gesture recognition has become an important aspect in user interface design. Gesture recognition technology allows users to interact through simple gestures, providing an intuitive and natural way to control and navigate computer systems, mobile devices, smart home devices, etc.

[0003] The existing technical solutions mainly recognize gestures through neural networks, which use deep learning technology to achieve gesture recognition. The following are the steps of a basic neural network gesture recognition method:

[0004] 1. Data preparation: Collect gesture datasets, including gesture paths or images and corresponding labels (gesture categories). The dataset should have enough samples to cover various gesture categories and variations.

[0005] 2. Data preprocessing: Preprocess the gesture data, such as normalization, smoothing or image processing, to facilitate the training and recognition of the neural network.

[0006] 3. Network design: Design a neural network structure suitable for gesture recognition tasks. Common structures include convolutional neural networks (CNN), recurrent neural networks (RNN) or their variants, which are used to extract features from gesture data.

[0007] 4. Network training: Use gesture data sets to train the neural network. During the training process, the gesture data is input into the network, and the network parameters are optimized through the back propagation algorithm so that the network can accurately learn the characteristics and categories of gestures.

[0008] 5. Network evaluation: Use an independent test data set to evaluate the performance of the trained neural network. You can calculate indicators such as accuracy, recall, and F1 score to evaluate the effect of gesture recognition.

[0009] 6. Real-time recognition: Deploy the trained neural network to actual applications to achieve real-time gesture recognition. In real-time scenarios, input gesture data into the network and obtain the predicted category of gestures through the forward propagation algorithm.

[0010] The advantages of the neural network gesture recognition method lie in its powerful feature learning ability and flexibility. Neural networks can automatically learn complex features in gesture data and can adapt to different gesture recognition tasks by adjusting the network structure and parameters. However, the neural network method also requires a large amount of labeled data and computing resources for training, and may be challenging for the recognition of small samples or specific gesture categories.

[0011] Therefore, the shortcomings of the prior art are as follows:

[0012] High resource consumption: Deep learning models, especially complex neural networks, often require a lot of computing resources, including significant GPU acceleration and large amounts of memory, which is a problem in mobile devices or embedded systems with limited resources.

[0013] Large amounts of training data: Deep learning models require large amounts of labeled training data to train the models. Collecting and labeling this data is time-consuming and expensive.

[0014] Limited generalization: A neural network model may perform well on the training data but may perform poorly on unseen gestures or variations unless it is adequately trained.

[0015] Poor interpretability: Deep learning models are often considered black-box models, and it is difficult to understand the decision-making process inside the model, which is a disadvantage in applications that require interpretability.

[0016] Complex deployment and maintenance: Once a model is deployed, updating and maintaining it requires retraining and may require specialized knowledge.

[0017] In view of these shortcomings of the prior art, the objects of the present invention include:

[0018] Simplify the algorithm: Develop a gesture recognizer with a simple algorithm that is easy to understand and implement, allowing for quick integration into user interface prototypes.

[0019] Reduced data requirements: Reduced training data requirements by enabling gesture recognition based on a single template that automatically scales to all pen sequence combinations.

[0020] Enhance generalization capabilities: Design recognizers that can automatically distinguish between one-dimensional and two-dimensional gestures to adapt to diverse interaction needs, and provide generalization capabilities to accommodate multiple gestures.

[0021] Provide direction invariance: support gesture input in different directions so that users do not have to worry about the specific direction of the input gesture.

[0022] Optimizing speed: By adopting two speed optimization methods, the rapidity of the recognition process is ensured, allowing the system to respond to user gesture input in real time.

[0023] In summary, the purpose of the present invention is to provide a multi-stroke gesture recognition method that is lightweight, efficient, easy to deploy and maintain, and has good generalization ability and explainability, so as to solve the application limitations of the prior art in rapid prototyping and user interface development. Summary of the invention

[0024] 1. Technical issues to be resolved

[0025] In view of the deficiencies in the prior art, the present invention provides a fast multi-stroke gesture recognition method to solve the above-mentioned problems.

[0026] (II) Technical solution

[0027] To achieve the above-mentioned purpose, the present invention provides the following technical solution: a fast multi-stroke gesture recognition method, comprising the following steps:

[0028] Step 1: Resample to obtain a set of resampled points, then process the rounding error to obtain a point set P;

[0029] Step 2: Calculate the indicated angle and rotate it to obtain the rotated point set RotateQ;

[0030] Step 3: Calculate the bounding box and scale it to a specific size according to the point set bounding box;

[0031] Step 4: Set a new reference point pt and translate the point set P to the new centroid position pt. For each point Pi, the coordinates (qxi, qyi) of the translated point Qi can be calculated as follows:

[0032] q xi =x i +p x -c x ,q yi =y i +p y -c y ;

[0033] Step 5: Convert the point set into a standardized vector array;

[0034] Step 6: Combine multiple strokes into a continuous single stroke points;

[0035] Step 7: Calculate the angle of the starting unit vector.

[0036] Preferably, the specific content of the first step is as follows:

[0037] S1: Calculate the path length L:

[0038]

[0039] Where Pi represents the i-th point on the path, Pi.X and Pi.Y represent the horizontal and vertical coordinates of the point respectively;

[0040] Calculate the resampling interval I:

[0041] Given the number of target points n, the resampling interval I is the path length L divided by n-1.

[0042]

[0043] S2: resampling point set:

[0044] Initialize the new point set Q and add the first point P1, and traverse the original point set P;

[0045] Let D be the current cumulative distance, initialized to 0. For each pair of adjacent points, for each pair of adjacent points P_{i-1} and P_i, calculate the distance between them, and calculate the distance d between them:

[0046]

[0047] If the cumulative distance D+d is greater than or equal to the interval I, insert a new point Qj:

[0048]

[0049]

[0050] Add the new point Qj to Q and reset D to 0. If D+d is less than I, the cumulative distance D increases by d.

[0051] S3: Dealing with rounding errors:

[0052] If the number of points in the new point set Q is less than n, the last point Pm in the original point set P is added to Q;

[0053] The final new point set Q will contain n points, each of which is evenly distributed on the original path;

[0054] The point set is resampled by the above calculation method, n and m are both 96, and the user's points are adopted as 96 new point sets.

[0055] Preferably, the specific content of the second step is as follows:

[0056] Given a set of points P = {P1, P2, ..., Pm}, where each point Pi has coordinates (xi, yi), the coordinates (CX, CY) of the geometric center C can be calculated as follows:

[0057]

[0058] Where m is the total number of points in the point set;

[0059] Calculate the indicated angle:

[0060] Calculate the angle θ between the vector from the first point P1 to the centroid C and the horizontal axis;

[0061] θ=arctan2(C Y -P1.Y,C X -P1.X)

[0062] Using this radian indicating the angle -θ, the coordinates (qxi, qyi) of the new position Qi after each point Pi is rotated about the center of mass C can be calculated by the following transformation:

[0063] g xi =(x i -C X )cos(α)-(y i -C Y )sin(α)+C X

[0064] q yi =(x i -C X )sin(α)+(y i -C Y )cos(α)+C Y

[0065] Where (xi, yi) is the coordinate of the original point Pi, and (qxi, qyi) is the coordinate of the new point Qi after rotation.

[0066] Preferably, the specific content of the third step is as follows:

[0067] Calculate bounding box;

[0068] For a point set P = {P1, P2, ..., Pn}, the calculation of the bounding box can be expressed as:

[0069] minX=min(x l , x2, ..., x n )

[0070] minY=min(y1,y2,...,y n )

[0071] maxX=max(x1,x2,...,x n )

[0072] maxY=max(y1,y2,...,y n );

[0073] The width and height of the bounding box are:

[0074] Width=maxX-minX, Height=maxY-minY;

[0075] Determine whether the gesture is 1D or 2D by comparing the width and height of the bounding box:

[0076]

[0077] If uniformly is true, the gesture is considered one-dimensional, otherwise it is considered two-dimensional;

[0078] To scale a point set:

[0079] For each point Pi, the coordinates (qxi, qyi) of the scaled point Qi can be calculated as follows:

[0080] If the gesture is one-dimensional:

[0081]

[0082] If the gesture is 2D:

[0083]

[0084] The ratio1D range is 0.20-0.35, and the default value is 0.25.

[0085] Preferably, the specific content of the fifth step is as follows:

[0086] Calculate the vector:

[0087] Let point set P = {P0, P1, ..., Pn}, and we want to calculate the vector →v from P0 to Pindex, which can be expressed as:

[0088]

[0089] Where (x0, y0) is the coordinate of point P0, (xindex, yindex) is the coordinate of point Pindex;

[0090] Calculate the length of a vector:

[0091] The length (or magnitude) of a vector →v can be calculated using the Euclidean distance formula:

[0092]

[0093] Normalize a vector:

[0094] Normalizing the vector →v to the unit vector →u, whose length is 1, can be expressed as:

[0095]

[0096] →u is a unit vector version of →v, maintaining the direction of →v but with a length of 1;

[0097] The index is set to one eighth of the total number of points, that is, if the total number of points is N, then index = N / 8.

[0098] Preferably, the specific content of the sixth step is as follows:

[0099] The stroke set S = {S1, S2, ..., Sm}, where each stroke Si contains a series of points P = {Pi1, Pi2, ..., Pin}, then the combination operation can be expressed as:

[0100]

[0101] Where Pcombined is the set of all stroke points.

[0102] Preferably, the specific content of the seventh step is as follows:

[0103] For the candidate gesture and each single stroke in the template, calculate the angle between their starting unit vectors. If the starting unit vector of the candidate gesture is →v1 and the starting unit vector of the single stroke in the template is →v2, then the angle can be calculated by the dot product of the vectors and obtained by the inverse cosine function:

[0104]

[0105] If θ≤AngleSimilarityThreshold (30 degrees in radians), continue comparing;

[0106] Calculate distance;

[0107] Update Best Bets:

[0108] Then, the algorithm compares the calculated distance d with the best distance b found previously. If d is smaller, the best distance b and the corresponding template index u are updated:

[0109]

[0110] Where i is the index of the current template gesture in the template collection;

[0111] The algorithm continuously updates the best matching template until all templates are traversed;

[0112] No match:

[0113]

[0114] Among them, t0 is the time when recognition starts, and t1 is the time when recognition ends;

[0115] When a matching template is found, the name of the template is returned along with the match score calculated according to the algorithm used:

[0116]

[0117] Where b is the minimum distance between the candidate gesture and the best matching template, HalfDiagonal is half of the diagonal of the gesture recognition space (used to normalize the distance score), and u is the index of the best matching template. Preferably, the distance is calculated using any of the following methods:

[0118] Method 1:

[0119] Calculate the optimal cosine distance between two vectors, which can be expressed as:

[0120]

[0121] Among them, ai and bi are the components of the candidate gesture and template vectors, respectively;

[0122] Method 2: If the Protractor method is not used, the distance d is calculated by golden section search, and the formula is as follows:

[0123]

[0124] DistanceAtAngleDistanceAtAngle is the path distance between the candidate gesture point and the template gesture point after rotating the candidate gesture point at a specific angle.

[0125] (III) Beneficial effects

[0126] Compared with the prior art, the present invention provides a fast multi-stroke gesture recognition method, which has the following beneficial effects:

[0127] 1. The fast multi-stroke gesture recognition method, lightweight algorithm: The present invention proposes a lightweight gesture recognition algorithm, which is simpler, has low computational cost, and is easy to deploy on resource-constrained devices compared to deep learning models.

[0128] 2. The fast multi-pen gesture recognition method reduces data requirements: By supporting gesture recognition based on a single template that is automatically expanded to all pen sequence combinations, the present invention greatly reduces the demand for training data and reduces the workload of data collection and annotation.

[0129] 3. The fast multi-stroke gesture recognition method enhances generalization capability: The present invention designs a recognizer that can automatically distinguish between one-dimensional and two-dimensional gestures, and enhances the model's generalization capability for new gestures through a specific algorithm, so that the model can better adapt to the user's diverse interaction needs.

[0130] 4. The fast multi-stroke gesture recognition method has direction invariance: the present invention supports direction invariance, and the user does not need to worry about the input direction of the gesture, thereby improving the flexibility of gesture recognition and user experience.

[0131] 5. The fast multi-stroke gesture recognition method optimizes speed: By adopting a specific speed optimization method, the present invention ensures the rapidity of the gesture recognition process, thereby enabling the system to respond to user gesture input in real time.

[0132] 6. The fast multi-stroke gesture recognition method is easy to deploy and maintain: Due to the simple algorithm, the gesture recognition system of the present invention is easier to deploy on various devices and is also convenient for maintenance and updating.

[0133] 7. The fast multi-stroke gesture recognition method is suitable for rapid prototyping: The gesture recognition method of the present invention is suitable for rapid prototyping and user interface development because it simplifies the gesture recognition process, allowing developers to quickly integrate and test gesture control functions. DETAILED DESCRIPTION

[0134] The technical solutions in the embodiments of the present invention are described clearly and completely. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0135] A fast multi-stroke gesture recognition method comprises the following steps:

[0136] Assume that the point set of the gesture input by the user is points. Recognition is performed through the following steps.

[0137] 1. Gesture preprocessing

[0138] 1. Resampling

[0139] Calculate the path length L:

[0140] The path length L is the sum of the distances between adjacent pairs of points on a path consisting of a series of points P1, P2, ..., Pm.

[0141]

[0142] Where Pi represents the i-th point on the path, and Pi.X and Pi.Y represent the horizontal and vertical coordinates of the point respectively.

[0143] Calculate the resampling interval I:

[0144] Given the number of target points n, the resampling interval I is the path length L divided by n-1.

[0145]

[0146] Resampling point set:

[0147] Initialize a new point set Q and add the first point P1. Traverse the original point set P and insert new points if necessary.

[0148] Let D be the current cumulative distance, initialized to 0. For each pair of adjacent points. For each pair of adjacent points P_{i-1} and P_i, calculate the distance between them and calculate the distance d between them:

[0149]

[0150] If the cumulative distance D+d is greater than or equal to the interval I, insert a new point Qj:

[0151]

[0152]

[0153] Add the new point Qj to Q and reset D to 0. If D+d is less than I, then the cumulative distance D is increased by d.

[0154] Dealing with rounding errors:

[0155] If the number of points in the new point set Q is less than n, the last point Pm in the original point set P is added to Q.

[0156] The final new point set Q will contain n points, each of which is evenly distributed on the original path.

[0157] The point set is resampled by the above calculation method, n and m are both 96, and the user's points are adopted as 96 new point sets.

[0158] 2. Calculate the indicated angle and rotate

[0159] Calculate the geometric center (center of mass):

[0160] The geometric center (center of mass) is the average position of a set of points. Given a set of points P = {P1, P2, ..., Pm}, where each point Pi has coordinates (xi, yi), the coordinates (CX, CY) of the geometric center C can be calculated as follows:

[0161]

[0162] Where m is the total number of points in the point set

[0163] Calculate the indicated angle:

[0164] Calculate the angle between the vector from the first point P1 to the centroid C and the horizontal axis. This angle θ can be calculated using the atan2 function, which is defined as the inverse tangent of the vertical and horizontal differences between the two points:

[0165] θ=arctan 2(C Y -P1.Y,C X -P1.X)

[0166] Using this radian indicating the angle -θ, the coordinates (qxi, qyi) of the new position Qi after each point Pi is rotated about the center of mass C can be calculated by the following transformation:

[0167] g xi =(x i -C X )cos(α)-(y i -C Y )sin(α)+C X

[0168] g yi =(x i -C X )sin(α)+(y i -C Y )cos(α)+C Y

[0169] Where (xi, yi) is the coordinate of the original point Pi, (qxi, qyi) is the coordinate of the new point Qi after rotation. The rotated point set RotateQ is obtained through the above calculation.

[0170] 3. Scale to a specific size according to the point set bounding box

[0171] Calculate bounding box

[0172] For a point set P = {P1, P2, ..., Pn}, the calculation of the bounding box can be expressed as:

[0173] minX=min(x1, x2, ..., x n )

[0174] minY=min(y1,y2,...,y n )

[0175] maxX=max(x1,x2,...,x n )

[0176] maxY=max(y1,y2,...,y n )

[0177] The width and height of the bounding box are:

[0178] Width=maxX-minX,Height=maxY-minY

[0179] Determine if it is a 1D or 2D gesture:

[0180] By comparing the width and height of the bounding box, we can determine whether the gesture is one-dimensional or two-dimensional:

[0181]

[0182] If uniformly is true, the gesture is considered one-dimensional; otherwise it is considered two-dimensional.

[0183] To scale a point set:

[0184] For each point Pi, the coordinates (qxi, qyi) of the scaled point Qi can be calculated as follows:

[0185] If the gesture is one-dimensional:

[0186]

[0187] If the gesture is 2D:

[0188]

[0189] The ratio1D range is 0.20-0.35, and the default value is 0.25.

[0190] In this way, each point Pi in the rotated point set P is scaled to a new point set ScaleQ, where the bounding box size of Q is uniformly adjusted to 250. For one-dimensional gestures, its aspect ratio remains unchanged; for two-dimensional gestures, the aspect ratio may be changed to fill the target size.

[0191] 4. Translation point set

[0192] Set a new reference point pt with coordinates (px, py). We need to translate the point set P to the new centroid position pt.

[0193] For each point Pi, the coordinates (qxi, qyi) of the translated point Qi can be calculated as follows:

[0194] q xi =x i +p x -c x ,q yi =y i +p y -c y

[0195] In this way, the TranslateTo function translates each point Pi in the original scaled point set to a new point set TransteQ, where the center of mass of Q is located at the given point as the origin (0, 0). This process is geometrically equivalent to moving the entire point set as a whole to the origin.

[0196] 5. Other calculations

[0197] Start Unit Vector (startUnitVector): Calculate the vector from the first point points[0] of the translated point set to the point points[index] at the specified index index, and normalize the vector to a unit vector. Here, index is one eighth of the total number of points, which is used to find a representative direction in gesture recognition. This process can be expressed as the following steps:

[0198] Calculate the vector:

[0199] Let point set P = {P0, P1, ..., Pn}, and we want to calculate the vector →v from P0 to Pindex. This can be expressed as:

[0200]

[0201] Where (x0, y0) is the coordinate of point P0, and (xindex, yindex) is the coordinate of point Pindex.

[0202] Calculate the length of a vector:

[0203] The length (or magnitude) of a vector →v can be calculated using the Euclidean distance formula:

[0204]

[0205] Normalize a vector:

[0206] Normalizing the vector →v to the unit vector →u, whose length is 1, can be expressed as:

[0207]

[0208] Here, →u is a unit vector version of →v that retains the direction of →v but has a length of 1.

[0209] The index is set to one eighth of the total number of points, that is, if the total number of points is N, then index = N / 8. In this way, we can use the above steps to calculate the unit vector from P0 to PN / 8.

[0210] Vector: Convert each point in the translated point set into a vector and normalize these vectors so that their total length (modulus) is 1. Used for gesture recognition so that the similarity of two gestures can be compared efficiently. Here are the process steps:

[0211] Initialize variables: Initialize cosine and sine values. Here, since the angle is 0 (COS(0)=1, sin(0)=0), the cosine value COS is 1.0 and the sine value sin is 0.0.

[0212] Calculate the new coordinates after rotation: For each point Pi in the point set P = {P1, P2, ..., Pn}, calculate the new coordinates after rotation (newXi, newYi). Since the rotation angle here is 0, the rotated coordinates are actually the same as the original coordinates. However, we still express it according to the rotation formula:

[0213] newX i =x i ·cos(0)-y i sin(0)=x i

[0214] newY i =y i ·cos(0)+x i sin(0)=y i

[0215] Where (xi, yi) are the original coordinates of point Pi.

[0216] Compute the square of the vector and its magnitude and sum the squares of all new coordinates:

[0217]

[0218] Compute the magnitude of a vector:

[0219] Compute the square root of the sum of the squares obtained in the previous step to get the magnitude of the vector:

[0220]

[0221] Normalize a vector:

[0222] Divide each new coordinate by the magnitude of the vector to normalize the vector:

[0223]

[0224]

[0225] In this way, for each point Pi, a new pair of coordinates (vector, vector+1) is generated, which constitute the standardized vector.

[0226] Finally, this is the normalized vector array. The total length (modulus) of this array is 1, because the sum of the squares of all the new coordinates is divided by the square root of the sum of their own squares during the normalization process.

[0227] Through the above steps, the point set is converted into a standardized vector array for similarity comparison in gesture recognition.

[0228] 2. Matching user gestures with a set of predefined multi-stroke templates

[0229] 1. Combined strokes:

[0230] Combine multiple strokes into a continuous single stroke points. If we have a stroke set S = {S1, S2, ..., Sm}, where each stroke Si contains a series of points P = {Pi1, Pi2, ..., Pin}, then the combination operation can be expressed as:

[0231]

[0232] Where Pcombined is the set of all stroke points.

[0233] 2. Calculate the angle of the starting unit vector:

[0234] For the candidate gesture and each single stroke in the template, calculate the angle between their starting unit vectors. If the starting unit vector of the candidate gesture is →v1 and the starting unit vector of the single stroke in the template is →v2, then the angle can be calculated by the dot product of the vectors and the inverse cosine function:

[0235]

[0236] If θ≤AngleSimilarityThreshold (30 degrees of radians), that is, the directions of the two vectors are close enough, we will continue to compare.

[0237] Calculate distance:

[0238] Distances are calculated using one of two methods:

[0239] Protractor: Calculates the optimal cosine distance between two vectors, which can be expressed as:

[0240]

[0241] Among them, ai and bi are the components of the candidate gesture and template vectors respectively.

[0242] Golden Section Search: If the Protractor method is not used, the distance d is calculated by the golden section search. This process involves finding the angle θ that minimizes the distance between the two gestures within a given angle range. The mathematical formula is as follows:

[0243]

[0244] DistanceAtAngleDistanceAtAngle is the path distance between the candidate gesture point and the template gesture point after rotating the candidate gesture point at a specific angle.

[0245] Update Best Bets:

[0246] The algorithm then compares the calculated distance d with the best distance b found previously. If d is smaller, the best distance b and the corresponding template index u are updated:

[0247]

[0248] Where i is the index of the current template gesture in the template collection.

[0249] Through the above steps, the algorithm continuously updates the best matching template until all templates are traversed. Eventually, b will contain the minimum distance between the template gesture that is most similar to the candidate gesture, and u will point to the index of the template gesture in the template collection.

[0250] No match:

[0251] When no matching template is found:

[0252]

[0253] Among them, t0 is the time when recognition starts, and t1 is the time when recognition ends.

[0254] Found a match:

[0255] When a matching template is found, the name of the template is returned along with the match score calculated according to the algorithm used:

[0256]

[0257] Where b is the minimum distance between the candidate gesture and the best matching template, HalfDiagonal is half of the diagonal of the gesture recognition space (used to normalize the distance score), and u is the index of the best matching template.

[0258] The match score is converted from the distance b. If the Protractor algorithm is used, the score is 1.0-b; if the Protractor algorithm is not used, the score is 1.0-b / HalfDiagonal. This ensures that the score is between 0 and 1, where 1 indicates a perfect match and 0 indicates no match.

[0259] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A fast multi-stroke gesture recognition method, characterized in that: The following steps are involved: Step 1: Resample to obtain a set of resampled points, then process the rounding error to obtain a point set P; Step 2: Calculate the indicated angle and rotate it to obtain the rotated point set RotateQ; Step 3: Calculate the bounding box and scale it to a specific size according to the point set bounding box; Step 4: Set a new reference point pt and translate the point set P to the new centroid position pt. For each point Pi, the coordinates (qxi, qyi) of the translated point Qi can be calculated as follows: q xi =x i +p x -c x ,q yi =y i +p y -c y ; Step 5: Convert the point set into a standardized vector array; Step 6: Combine multiple strokes into a continuous single stroke points; Step 7: Calculate the angle of the starting unit vector.

2. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific content of the first step is as follows: S1: Calculate the path length L: Where Pi represents the i-th point on the path, Pi.X and Pi.Y represent the horizontal and vertical coordinates of the point respectively; Calculate the resampling interval I: Given the number of target points n, the resampling interval I is the path length L divided by n-1; S2: resampling point set: Initialize the new point set Q and add the first point P1, and traverse the original point set P; Let D be the current cumulative distance, initialized to 0, and for each pair of adjacent points, for each pair of adjacent points P_{i-1} and P_i, calculate the distance between them and calculate the distance d between them: If the cumulative distance D+d is greater than or equal to the interval I, insert a new point Qj: Add the new point Qj to Q and reset D to 0. If D+d is less than I, the cumulative distance D increases by d. S3: Dealing with rounding errors: If the number of points in the new point set Q is less than n, the last point Pm in the original point set P is added to Q; The final new point set Q will contain n points, each of which is evenly distributed on the original path; The point set is resampled by the above calculation method, n and m are both 96, and the user's points are adopted as 96 new point sets.

3. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific contents of the second step are as follows: Given a set of points P = {P1, P2, ..., Pm}, where each point Pi has coordinates (xi, yi), the coordinates (CX, CY) of the geometric center C can be calculated as follows: Where m is the total number of points in the point set; Calculate the indicated angle: Calculate the angle θ between the vector from the first point P1 to the centroid C and the horizontal axis; θ=arctan 2(C Y -P1.Y,C X -P1.X) Using this radian indicating the angle -θ, the coordinates (qxi, qyi) of the new position Qi after each point Pi is rotated about the center of mass C can be calculated by the following transformation: q xi =(x i -C X )cos(α)-(y i -C Y )sin(a)+C X q yi =(x i -C X )sin(α)+(y i -C Y )cos(α)+C Y Where (xi, yi) is the coordinate of the original point Pi, and (qxi, qyi) is the coordinate of the new point Qi after rotation.

4. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific contents of the third step are as follows: Calculate bounding box; For a point set P = {P1, P2, ..., Pn}, the calculation of the bounding box can be expressed as: minX=min(x1,x2,...,x n ) minY=min(y1,y2,...,y n ) maxX=max(x1,x2,...,x n ) maxY=max(y1,y2,...,y n ); The width and height of the bounding box are: Width=maxX-minX, Height=maxY-minY; Determine whether the gesture is 1D or 2D by comparing the width and height of the bounding box: If uniformly is true, the gesture is considered one-dimensional, otherwise it is considered two-dimensional; To scale a point set: For each point Pi, the coordinates (qxi,qyi) of the scaled point Qi can be calculated as follows: If the gesture is one-dimensional: If the gesture is 2D: The ratio1D range is 0.20-0.35, and the default value is 0.

25.

5. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific content of the fifth step is as follows: Calculate the vector: Let point set P = {P0, P1, ..., Pn}, and we want to calculate the vector →v from P0 to Pindex, which can be expressed as: Where (x0, y0) is the coordinate of point P0, (xindex, yindex) is the coordinate of point Pindex; Calculate the length of a vector: The length (or magnitude) of a vector →v can be calculated using the Euclidean distance formula: Normalize a vector: Normalizing the vector →v to the unit vector →u, whose length is 1, can be expressed as: →u is a unit vector version of →v, maintaining the direction of →v but with a length of 1; The index is set to one eighth of the total number of points, that is, if the total number of points is N, then index = N / 8.

6. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific content of the sixth step is as follows: The stroke set S = {S1, S2, ..., Sm}, where each stroke Si contains a series of points P = {Pi1, Pi2, ..., Pin}, then the combination operation can be expressed as: Where Pcombined is the set of all stroke points.

7. The method for fast multi-stroke gesture recognition according to claim 1, characterized in that: The specific content of the seventh step is as follows: For the candidate gesture and each single stroke in the template, calculate the angle between their starting unit vectors. If the starting unit vector of the candidate gesture is →v1 and the starting unit vector of the single stroke in the template is →v2, then the angle can be calculated by the dot product of the vectors and obtained by the inverse cosine function: If θ≤AngleSimilarityThreshold (30 degrees in radians), continue comparing; Calculate distance; Update Best Bets: Then, the algorithm compares the calculated distance d with the best distance b found previously. If d is smaller, the best distance b and the corresponding template index u are updated: Where i is the index of the current template gesture in the template collection; The algorithm continuously updates the best matching template until all templates are traversed; No match: Among them, t0 is the time when recognition starts, and t1 is the time when recognition ends; When a matching template is found, the name of the template is returned along with the match score calculated according to the algorithm used: Where b is the minimum distance between the candidate gesture and the best matching template, HalfDiagonal is half of the diagonal of the gesture recognition space (used to normalize the distance score), and u is the index of the best matching template.

8. The method for fast multi-stroke gesture recognition according to claim 7, characterized in that: Calculate the distance using any of the following methods: Method 1: Calculate the optimal cosine distance between two vectors, which can be expressed as: Among them, ai and bi are the components of the candidate gesture and template vectors, respectively; Method 2: If the Protractor method is not used, the distance d is calculated by golden section search, and the formula is as follows: DistanceAtAngleDistanceAtAngle is the path distance between the candidate gesture point and the template gesture point after rotating the candidate gesture point at a specific angle.