A motion-sensing tennis game method based on function fitting

By fitting trajectory data from motion-sensing devices using a cubic polynomial function, the type of racket swing is identified, solving the problems of insufficient recognition accuracy and generalization in existing motion-sensing tennis games, and achieving high-precision and efficient racket swing recognition.

CN116603237BActive Publication Date: 2025-10-31SHENZHEN HULE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310660291.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-05
Publication Date
2025-10-31
Estimated Expiration
2043-06-05

AI Technical Summary

Technical Problem

Existing motion-sensing tennis game solutions suffer from limited generalization performance and low recognition accuracy when recognizing racket swings. In particular, solutions based on the Kinetic architecture have poor adaptability to differences in different body structures, while solutions based on machine learning models suffer from gyroscope linear drift problems.

Method used

A method based on cubic polynomial function fitting is adopted to generate trajectory data of the motion sensing device in space from gyroscope data, and fit it into a swing function to identify the swing action type. The smoothing property of cubic polynomial function is used to reduce the influence of gyroscope drift and improve the recognition accuracy and generalization.

Benefits of technology

It improves the recognition accuracy and generalization of racket swing actions in motion-sensing tennis games, reduces the complexity of processing gyroscope data, and eliminates the need for large amounts of training data and complex parameter tuning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116603237B_ABST
    Figure CN116603237B_ABST
Patent Text Reader

Abstract

This invention discloses a motion-sensing tennis game method, apparatus, device, and computer-readable storage medium based on function fitting. The method includes: after the motion-sensing game is started, acquiring gyroscope data from the bound motion-sensing device; generating trajectory data of the motion-sensing device moving in space based on the gyroscope data; fitting the trajectory data into a preset cubic polynomial function to obtain a swing function; identifying the swing action type based on the swing function; and controlling the game character to perform the swing operation based on the identified action type. The motion-sensing tennis game method based on function fitting of this invention has advantages such as high action recognition accuracy, strong generalization, simplicity, and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motion-sensing game technology, and in particular to a motion-sensing tennis game method, apparatus, device, and computer-readable storage medium based on function fitting. Background Technology

[0002] Motion-sensing games are a type of game that uses the user's body movements to control the behavior of game characters and the progress of the game. Tennis games are a common type of motion-sensing game, where users control game characters to attack and defend by imitating tennis movements.

[0003] Currently, there are two main motion-sensing game solutions on the market:

[0004] 1. Based on the Kinetic architecture, it utilizes time-slot depth images and the human skeleton to determine the amplitude and direction of motion through a trajectory point model. 2. Based on machine learning models, it uses gyroscope data to train support vector machines and other models, and identifies user actions through an action recognition model.

[0005] Both of these approaches have drawbacks:

[0006] 1. Kinetic-based solutions have limited generalization performance due to significant differences in human anatomy. 2. Machine learning-based solutions have low recognition accuracy because gyroscopes suffer from linear drift, and different gyroscopes exhibit varying degrees of drift. Summary of the Invention

[0007] This application provides a motion-sensing tennis game method based on function fitting, aiming to improve the accuracy and generalization of ball-hitting action recognition in motion-sensing tennis games.

[0008] To achieve the above objectives, embodiments of this application provide a motion-sensing tennis game method based on function fitting, comprising:

[0009] After the motion-sensing game is launched, gyroscope data is obtained from the bound motion-sensing device;

[0010] The trajectory data of the motion sensing device moving in space is generated based on the gyroscope data;

[0011] The trajectory data is fitted into a preset cubic polynomial function to obtain the swing function;

[0012] The type of swing action is identified based on the swing function;

[0013] Control the game character to perform a racket swing based on the identified action type.

[0014] In one embodiment, generating trajectory data of the motion-sensing device moving in space based on the gyroscope data includes:

[0015] A grid map composed of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the game terminal where the motion-sensing game is played.

[0016] The position of the virtual rigid body in the grid map is updated based on the gyroscope data;

[0017] The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

[0018] In one embodiment, the expression for the preset cubic polynomial function is as follows:

[0019] y = ax 3 +bx 2 +cx+d;

[0020] In the formula, a, b, c, and d are the fitting parameters to be obtained for the fitting function.

[0021] In one embodiment, the trajectory data is fitted into a preset cubic polynomial function to obtain the swing function, including:

[0022] Based on the x-axis coordinates and the degree of the polynomial function in the coordinate data, construct a two-dimensional matrix X;

[0023] Based on the y-axis coordinates in the coordinate data, construct a one-dimensional matrix Y;

[0024] Calculate the transpose of matrix X, XT;

[0025] Calculate the product matrix XTX of matrices XT and X;

[0026] Solving the linear equation XTX×C=XTY yields a one-dimensional matrix C, where the one-dimensional matrix C represents the coefficients of the polynomial function, i.e. the fitting parameters to be determined.

[0027] Output the swing function based on matrix C.

[0028] In one embodiment, identifying the swing action type based on the swing function includes:

[0029] Calculate the inflection point of the swing function;

[0030] The type of swing action is identified based on the distribution of the inflection points.

[0031] In one embodiment, calculating the inflection point of the swing function includes:

[0032] Taking the derivative of the swing function, we obtain the first derivative of the swing function: y′=3ax 2+2bx+c;

[0033] Let 3ax 2 Given +2bx+c=0, find the x-axis coordinates when the first derivative is 0;

[0034] Calculate the second derivative of the first derivative: y” = 6ax + 2b;

[0035] Substitute the x-axis coordinates into the second derivative to calculate the value of the second derivative, and obtain the maximum and minimum values ​​of the swing function based on the value of the second derivative;

[0036] The maximum and minimum values ​​of the swing function are taken as the inflection points of the swing function.

[0037] In one embodiment, identifying the swing action type based on the distribution of the inflection points includes:

[0038] If the swing function has two inflection points, and the x-axis coordinates of the two inflection points are both located in the interval [0, 1], then the current swing action is identified as a forehand swing action.

[0039] If the swing function has two inflection points but the x-axis coordinates of both inflection points are outside the interval [0, 1], or if the swing function has only one inflection point, then the current swing action is identified as a backhand swing action.

[0040] If the swing function has no inflection point, then the current swing action is identified as a serve swing action.

[0041] To achieve the above objectives, this application also proposes a motion-sensing tennis game device based on function fitting, comprising:

[0042] The acquisition module is used to acquire gyroscope data from the bound motion-sensing device after the motion-sensing game is launched;

[0043] The generation module is used to generate trajectory data of the motion sensing device moving in space based on the gyroscope data;

[0044] The fitting module is used to substitute the trajectory data into a preset cubic polynomial function to obtain the swing function;

[0045] The recognition module is used to identify the type of swing action based on the swing function;

[0046] The execution module is used to control the game character to perform a racket swing operation based on the recognized action type.

[0047] To achieve the above objectives, this application also proposes a motion-sensing tennis game device based on function fitting, including a memory, a processor, and a motion-sensing tennis game program based on function fitting stored in the memory and executable on the processor. When the processor executes the motion-sensing tennis game program based on function fitting, it implements the motion-sensing tennis game method based on function fitting as described in any of the above claims.

[0048] To achieve the above objectives, embodiments of this application also propose a computer-readable storage medium storing a motion-sensing tennis game program based on function fitting. When the motion-sensing tennis game program based on function fitting is executed by a processor, it implements the motion-sensing tennis game method based on function fitting as described in any of the preceding claims.

[0049] It is understood that the motion-sensing tennis game method based on function fitting in this application generates trajectory data of the motion-sensing device moving in space using gyroscope data, and then fits this trajectory data using a cubic polynomial function to obtain a swing function. Finally, based on this swing function, the user's swing action type is identified, and the game character is controlled to perform the corresponding swing operation. In this way, the smoothness of the cubic polynomial function can be utilized to reduce the impact of gyroscope drift on the accuracy of action recognition, thereby improving the recognition accuracy of swing actions in motion-sensing tennis games. At the same time, the cubic polynomial function can adapt to different types of swing actions and flexibly fit various shapes and curves. Therefore, by adjusting the coefficients and parameters of the function, it can adapt to different types of swing actions, thereby improving the generalization and accuracy of swing action recognition in motion-sensing tennis games. In addition, compared with more complex nonlinear functions or machine learning models, the cubic polynomial function fitting method does not require a large amount of training data and a complex training process, nor does it require complex parameter tuning. This reduces the complexity of processing gyroscope data in motion-sensing tennis games. It is evident that, compared to traditional motion-sensing game solutions, the motion-sensing tennis game method of this application has advantages such as high motion recognition accuracy, strong generalization, simplicity, and high efficiency. Attached Figure Description

[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the structures shown in these drawings without creative effort.

[0051] Figure 1 This is a block diagram of a module structure of an embodiment of the motion-sensing tennis game device based on function fitting of the present invention;

[0052] Figure 2This is a flowchart illustrating an embodiment of the motion-sensing tennis game method based on function fitting of the present invention.

[0053] Figure 3 This is a block diagram of a module structure of an embodiment of the motion-sensing tennis game device based on function fitting of the present invention.

[0054] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0055] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0056] To better understand the above technical solutions, exemplary embodiments of this disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of this disclosure to those skilled in the art.

[0057] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The quantifier "a" or "an" preceding a component does not exclude the presence of a plurality of such components. The invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of "first," "second," and "third," etc., does not indicate any order and can be interpreted as names.

[0058] like Figure 1 As shown, Figure 1 This is a schematic diagram of the hardware operating environment server 1 (also called a motion-sensing tennis game device based on function fitting) involved in the embodiment of the present invention.

[0059] The server in this embodiment of the invention includes devices with display functions such as "Internet of Things devices", smart air conditioners, smart lights, smart power supplies with network connectivity, AR / VR devices with network connectivity, smart speakers, autonomous vehicles, PCs, smartphones, tablets, e-book readers, and portable computers.

[0060] like Figure 1 As shown, the server 1 includes: a memory 11, a processor 12, and a network interface 13.

[0061] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the server 1, such as the hard disk of the server 1. In other embodiments, the memory 11 can also be an external storage device of the server 1, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the server 1.

[0062] Furthermore, the memory 11 may include both internal storage units of the server 1 and external storage devices. The memory 11 can be used not only to store application software and various types of data installed on the server 1, such as the code of the motion-sensing tennis game program 10 based on function fitting, but also to temporarily store data that has been output or will be output.

[0063] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 11 or process data, such as executing a motion-sensing tennis game program 10 based on function fitting.

[0064] The network interface 13 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface), which is typically used to establish communication connections between the server 1 and other electronic devices.

[0065] The network can be the Internet, a cloud network, a Wi-Fi network, a Personal Area Network (PAN), a Local Area Network (LAN), and / or a Metropolitan Area Network (MAN). Various devices in the network environment can be configured to connect to the communication network according to various wired and wireless communication protocols. Examples of such wired and wireless communication protocols may include, but are not limited to, at least one of the following: Transmission Control Protocol and Internet Protocol (TCP / IP), User Datagram Protocol (UDP), Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), ZigBee, EDGE, IEEE 802.11, Li-Fi, 802.16, IEEE 802.11s, IEEE 802.11g, multi-hop communication, wireless access points (APs), device-to-device communication, cellular communication protocols, and / or Bluetooth communication protocols, or combinations thereof.

[0066] Optionally, the server may also include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be referred to as a screen or display unit, used to display information processed in server 1 and to display a visual user interface.

[0067] Figure 1 Only server 1, which includes components 11-13 and a motion-sensing tennis game program 10 based on function fitting, is shown. Those skilled in the art will understand that... Figure 1 The structure shown does not constitute a limitation on server 1 and may include fewer or more components than shown, or combine certain components, or have different component arrangements.

[0068] In this embodiment, the processor 12 can be used to call the motion-sensing tennis game program based on function fitting stored in the memory 11 and perform the following operations:

[0069] After the motion-sensing game is launched, gyroscope data is obtained from the bound motion-sensing device;

[0070] The trajectory data of the motion sensing device moving in space is generated based on the gyroscope data;

[0071] The trajectory data is fitted into a preset cubic polynomial function to obtain the swing function;

[0072] The type of swing action is identified based on the swing function;

[0073] Control the game character to perform a racket swing based on the identified action type.

[0074] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0075] A grid map composed of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the game terminal where the motion-sensing game is played.

[0076] The position of the virtual rigid body in the grid map is updated based on the gyroscope data;

[0077] The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

[0078] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0079] The predefined expression for the cubic polynomial function is as follows:

[0080] y = ax 3 +bx 2 +cx+d;

[0081] In the formula, a, b, c, and d are the fitting parameters to be obtained for the fitting function.

[0082] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0083] Based on the x-axis coordinates and the degree of the polynomial function in the coordinate data, construct a two-dimensional matrix X;

[0084] Based on the y-axis coordinates in the coordinate data, construct a one-dimensional matrix Y;

[0085] Calculate the transpose of matrix X, XT;

[0086] Calculate the product matrix XTX of matrices XT and X;

[0087] Solving the linear equation XTX×C=XTY yields a one-dimensional matrix C, where the one-dimensional matrix C represents the coefficients of the polynomial function, i.e. the fitting parameters to be determined.

[0088] Output the swing function based on matrix C.

[0089] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0090] Calculate the inflection point of the swing function;

[0091] The type of swing action is identified based on the distribution of the inflection points.

[0092] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0093] Taking the derivative of the swing function, we obtain the first derivative of the swing function: y′=3ax 2 +2bx+c;

[0094] Let 3ax 2 Given +2bx+c=0, find the x-axis coordinates when the first derivative is 0;

[0095] Calculate the second derivative of the first derivative: y” = 6ax + 2b;

[0096] Substitute the x-axis coordinates into the second derivative to calculate the value of the second derivative, and obtain the maximum and minimum values ​​of the swing function based on the value of the second derivative;

[0097] The maximum and minimum values ​​of the swing function are taken as the inflection points of the swing function.

[0098] In one embodiment, the processor 12 can be used to invoke a function-fitting-based motion-sensing tennis game program stored in the memory 11 and perform the following operations:

[0099] If the swing function has two inflection points, and the x-axis coordinates of the two inflection points are both located in the interval [0, 1], then the current swing action is identified as a forehand swing action.

[0100] If the swing function has two inflection points but the x-axis coordinates of both inflection points are outside the interval [0, 1], or if the swing function has only one inflection point, then the current swing action is identified as a backhand swing action.

[0101] If the swing function has no inflection point, then the current swing action is identified as a serve swing action.

[0102] Based on the hardware architecture of the aforementioned motion-sensing tennis game device based on function fitting, an embodiment of the motion-sensing tennis game method based on function fitting of the present invention is proposed. The motion-sensing tennis game method based on function fitting of the present invention aims to improve the accuracy and generalization of hitting motion recognition in motion-sensing tennis games.

[0103] Reference Figure 2 , Figure 2 This is an embodiment of the motion-sensing tennis game method based on function fitting of the present invention. The motion-sensing tennis game method based on function fitting includes the following steps:

[0104] S10. After the motion-sensing game starts, obtain gyroscope data from the bound motion-sensing device.

[0105] This particular motion-sensing game is a motion-sensing tennis game, a virtual reality game based on motion-sensing technology. It uses special sensors and equipment to allow players to experience tennis in a realistic way. Compared to traditional game controllers or keyboards, motion-sensing tennis games capture the player's real movements and postures, translating them into tennis actions within the game.

[0106] Alternatively, the motion-sensing tennis game can be a web-based web game, an HTML5-based mini-program, or a standalone app.

[0107] Motion-sensing devices are a type of device used to capture, recognize, and translate a player's body movements. They typically include sensors, controllers, and related hardware components, and are designed for use in conjunction with interactive experience technologies such as video games, virtual reality, and augmented reality. In the technical solution of this application, the motion-sensing device collects the user's motion data, which includes three-axis angular velocity data and three-axis acceleration data.

[0108] Alternatively, the motion-sensing devices used in the technical solutions of this application may include, but are not limited to, mobile phones, wristbands, watches, rings, game controllers, wrist straps, etc., equipped with gyroscopes.

[0109] Furthermore, a gyroscope measures the orientation and angular velocity of a device by sensing the force and acceleration of rotation and turning, outputting gyroscope data. Gyroscopes typically provide data output along three axes (X, Y, Z). For each axis, the gyroscope provides a continuously changing value representing the rate of rotation or angular change along that axis. These values ​​are usually expressed in units of angular velocity (e.g., degrees per second) or units of angle (e.g., degrees).

[0110] Optionally, the motion-sensing device can be connected to the game terminal via USB, Bluetooth, or 2.4G. The game terminal refers to the terminal that runs motion-sensing games, which can be a mobile terminal such as a mobile phone, tablet, laptop, or handheld console, or a fixed terminal such as a desktop computer or home console.

[0111] After the motion-sensing tennis game is launched, the game terminal can obtain data from the gyroscope of the motion-sensing device based on the connection protocol with the motion-sensing device.

[0112] S20. Generate trajectory data of the motion sensing device moving in space based on the gyroscope data.

[0113] Among these, trajectory data is used to record the motion trajectory of the motion sensing device in space, in order to represent the user's tennis motion trajectory.

[0114] Specifically, gyroscope data can be converted into spatial coordinate values ​​using methods such as rotation matrices and quaternion algorithms. These spatial coordinate values ​​can then be mapped to time series data to generate trajectory data of the motion sensing device in space.

[0115] It is worth noting that when converting gyroscope data, we can preprocess the data, such as filtering, interpolation, and normalization, to improve the quality and usability of the data.

[0116] S30. Substitute the trajectory data into a preset cubic polynomial function to obtain the swing function.

[0117] Among these, the preset cubic polynomial function is a mathematical function model selected based on the specific needs and design of the motion-sensing tennis game. Its essence is the mathematical expression of the tennis racket swing motion. In other words, the swing function obtained by fitting the trajectory data from the motion-sensing device is the mathematical expression of the user's current swing motion.

[0118] S40. Identify the swing action type based on the swing function.

[0119] In motion-sensing tennis games, we can define the following swing motion types: forehand, backhand, and serve. Each motion type can be described by different swing patterns and characteristics.

[0120] Specifically, after obtaining the swing function that represents the user's current swing action, we can extract some key features from the swing function, such as speed changes, angle changes, and acceleration changes, in order to identify the type of swing action the user is currently performing.

[0121] Understandably, cubic polynomial functions possess a smoothing property, which helps reduce the influence of noise and oscillations in swing data, thereby minimizing the impact of gyroscope drift on motion recognition accuracy. Thus, although the degree of drift may vary among different gyroscopes, fitting with a cubic polynomial function can approximately capture the overall trend of the gyroscope data, resulting in a better fit for data variations within a smaller range. Therefore, fitting with a cubic polynomial function can, to some extent, balance the influence of different gyroscope drift levels, improving recognition accuracy.

[0122] Meanwhile, cubic polynomial functions can adapt to different types of swing motions and flexibly fit various shapes and curves. This allows it to handle variations in different swing motions, such as swings with different speeds, angles, or forces. By adjusting the coefficients and parameters of the function, it can adapt to different types of swing motions, thereby improving the generalization and accuracy of recognition.

[0123] Furthermore, compared to more complex nonlinear functions or machine learning models, cubic polynomial function fitting is computationally simple and efficient. It does not require large amounts of training data or complex training processes, nor does it require complex parameter tuning. This makes cubic polynomial function fitting easier to implement and apply, reducing the complexity of processing gyroscope data.

[0124] S50: Control the game character to perform a swing operation based on the recognized action type.

[0125] Specifically, in motion-sensing tennis games, there are corresponding game operation commands for each type of swing motion. For example, a forehand shot can be mapped to a forward swing in the game; a backhand shot can be mapped to a side swing in the game.

[0126] Based on this, after determining the type of swing motion performed by the user, the corresponding game operation instructions can be passed to the game character for execution. This can be achieved through interaction with the game engine or controller, such as through programming interfaces or controller input, to pass instructions to the game system. In this way, the user's swing motion can be reproduced.

[0127] It is understood that the motion-sensing tennis game method based on function fitting in this application generates trajectory data of the motion-sensing device moving in space using gyroscope data, and then fits this trajectory data using a cubic polynomial function to obtain a swing function. Finally, based on this swing function, the user's swing action type is identified, and the game character is controlled to perform the corresponding swing operation. In this way, the smoothness of the cubic polynomial function can be utilized to reduce the impact of gyroscope drift on the accuracy of action recognition, thereby improving the recognition accuracy of swing actions in motion-sensing tennis games. At the same time, the cubic polynomial function can adapt to different types of swing actions and flexibly fit various shapes and curves. Therefore, by adjusting the coefficients and parameters of the function, it can adapt to different types of swing actions, thereby improving the generalization and accuracy of swing action recognition in motion-sensing tennis games. In addition, compared with more complex nonlinear functions or machine learning models, the cubic polynomial function fitting method does not require a large amount of training data and a complex training process, nor does it require complex parameter tuning. This reduces the complexity of processing gyroscope data in motion-sensing tennis games. It is evident that, compared to traditional motion-sensing game solutions, the motion-sensing tennis game method of this application has advantages such as high motion recognition accuracy, strong generalization, simplicity, and high efficiency.

[0128] In some embodiments, generating trajectory data of the motion-sensing device moving in space based on the gyroscope data includes:

[0129] S21. Generate a grid map composed of multiple grid cells and a virtual rigid body that matches the motion-sensing device on the game terminal executing the motion-sensing game.

[0130] Among these, a grid map is an image representation method that divides space into regular grid units. It divides the entire space into discrete small regions, each region called a grid unit, which can be square, rectangular, or other shapes. Each grid unit has a unique identifier and coordinates to represent its position within the entire map. In the technical solution of this application, the grid map is used to represent the layout of a game scene. Each grid unit can correspond to a fixed-size region or grid, used to record the position of a virtual rigid body in the game.

[0131] Specifically, after the motion-sensing tennis game starts, a grid map can be constructed based on preset initialization parameters. This grid map can be a two-dimensional map (such as a planar map) or a three-dimensional map (such as a stereoscopic scene). It is worth noting that, according to the preset initialization parameters, the size of each grid cell and the coordinate values ​​of each grid cell are determined at the same time as the grid map is generated.

[0132] Furthermore, a rigid body refers to an object in the physical world that has a fixed shape and mass and does not deform or bend. A virtual rigid body is a virtual model with corresponding physical properties. In the technical solution of this application, the virtual rigid body is used to record the movement trajectory of the motion sensing device in a grid map.

[0133] S22. Update the position of the virtual rigid body in the grid map based on the gyroscope data.

[0134] Specifically, gyroscope data can be converted into coordinate values ​​of a grid map using methods such as equations of motion and integration methods (e.g., Euler's method or Runge-Kutta's method), thereby updating the position of the virtual rigid body in the grid map.

[0135] S23. Record the coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map as the trajectory data.

[0136] Specifically, a data structure can be created to store the coordinate data of the mesh cells traversed by the virtual rigid body. Data structures such as arrays, lists, and matrices can be used to represent the trajectory data. During gameplay, the coordinate values ​​of the mesh cells where the virtual rigid body is located can be recorded into the trajectory data structure based on the time sequence, serving as the trajectory data of the motion-sensing device in space.

[0137] It is understandable that the above scheme, by representing the trajectory data of the motion-sensing device as processed grid coordinates, can convert a continuous sequence of coordinates into a discrete sequence of grid cells. This removes minute variations between adjacent coordinates, reducing data redundancy and duplication, thereby optimizing data representation and storage, and improving the efficiency of motion trajectory calculation.

[0138] In some embodiments, the expression for the preset cubic polynomial function is as follows:

[0139] y = ax 3 +bx 2 +cx+d;

[0140] In the formula, a, b, c, and d are the fitting parameters to be obtained for the fitting function.

[0141] Specifically, x represents the x-axis coordinate of a grid cell in the grid map, y represents the y-axis coordinate of a grid cell in the grid map, and a, b, c, and d are the corresponding coefficients and constants.

[0142] It is worth noting that the design of this application is not limited to this. In other embodiments, the cubic polynomial function can also be set as y=a(xh)^3+k, y=a(xh)^3+b(xh)^2+c(xh)+d, y=a(xh)(xp)(xq), etc.

[0143] In some embodiments, fitting the trajectory data into a preset cubic polynomial function yields a swing function, including:

[0144] S31. Construct a two-dimensional matrix X based on the x-axis coordinates and the degree of the polynomial function in the coordinate data.

[0145] Specifically, assuming there are n coordinate data points, the size of matrix X is n × (degree + 1). Each row corresponds to an x-axis coordinate, and each column corresponds to the power of a polynomial function.

[0146] For example, for a cubic polynomial function, if there are 3 coordinate data points (x1, x2, x3), then matrix X can be represented as:

[0147] X = [

[0148] [x1^3, x1^2, x1, 1],

[0149] [x2^3, x2^2, x2, 1],

[0150] [x3^3, x3^2, x3, 1]

[0151] ].

[0152] S32. Construct a one-dimensional matrix Y based on the y-axis coordinates in the coordinate data.

[0153] Specifically, the size of matrix Y is n×1, where each row corresponds to a y-axis coordinate.

[0154] For example, corresponding to the y-axis coordinates (y1, y2, y3) of the three coordinate data points mentioned above, the matrix Y can be represented as:

[0155] Y = [

[0156] [y1],

[0157] [y2],

[0158] [y3]

[0159] ].

[0160] S33. Calculate the transpose matrix XT of matrix X.

[0161] Specifically, the size of XT is (number of times + 1) × n.

[0162] S34. Calculate the product matrix XTX of matrices XT and X.

[0163] Specifically, XTX = XT × X.

[0164] S35. Solve the linear equation XTX×C=XTY to obtain a one-dimensional matrix C, where the one-dimensional matrix C represents the coefficients of the polynomial function, i.e. the fitting parameters to be found.

[0165] Specifically, C = inv(XTX) × XT × Y, where inv(XTX) represents the inverse matrix of XTX.

[0166] S36. Output the swing function based on matrix C.

[0167] Specifically, the swing function can be expressed as: y=C[0]*x^3+C[1]*x^2+C[2]*x+C[3]. Where C[0], C[1], C[2], and C[3] are elements in matrix C.

[0168] It is understandable that, through the above steps S31-S36, the least squares method can be used to fit a cubic polynomial function.

[0169] In some embodiments, identifying the swing action type based on the swing function includes:

[0170] S41. Calculate the inflection point of the swing function.

[0171] In some embodiments, calculating the inflection point of the swing function includes:

[0172] S411. Differentiate the swing function to obtain the first derivative of the swing function: y′=3ax 2 +2bx+c.

[0173] S412, let 3ax2 Given +2bx+c=0, find the x-axis coordinates when the first derivative is 0.

[0174] Specifically, solving the above equations yields the x-axis coordinates when the first derivative is zero, i.e., the x-axis coordinates of the inflection point.

[0175] S413. Calculate the second derivative of the first derivative: y”=6ax+2b.

[0176] S414. Substitute the x-axis coordinates into the second derivative, calculate the value of the second derivative, and obtain the maximum and minimum values ​​of the swing function based on the value of the second derivative;

[0177] Specifically, substitute the x-axis coordinate where the first derivative is zero into the y-coordinate to obtain the value of the corresponding second derivative.

[0178] Furthermore, if the value of the second derivative is greater than zero, then the corresponding x-axis coordinate is the minimum point of the swing function.

[0179] If the value of the second derivative is less than zero, then the corresponding x-axis coordinate is the maximum point of the swing function.

[0180] S415. The maximum and minimum values ​​of the swing function are taken as the inflection points of the swing function.

[0181] Finally, the maximum and minimum points of the swing function will be found, and these points will be used as inflection points.

[0182] S42. Identify the swing action type based on the distribution of the inflection points.

[0183] Specifically, by analyzing the distribution of inflection points, different types of swing motions can be identified.

[0184] In some embodiments, identifying the swing type based on the distribution of the inflection points includes:

[0185] S421. If the swing function has two inflection points, and the x-axis coordinates of the two inflection points are both located in the interval [0, 1], then the current swing action is identified as a forehand swing action.

[0186] If the swing function has two extreme values, namely the maximum and the minimum, then it means that the swing function has two inflection points.

[0187] S422. If the swing function has two inflection points but the x-axis coordinates of both inflection points are outside the interval [0, 1], or if the swing function has only one inflection point, then the current swing action is identified as a backhand swing action.

[0188] If the swing function has only one extreme value, it means that the swing function has only one inflection point.

[0189] S423. If the swing function has no inflection point, then the current swing action is identified as a serve swing action.

[0190] If the swing function has no extreme values, it means that the swing function has no inflection point.

[0191] It is understandable that identifying the type of swing action based on the distribution of inflection points is a simple and effective method that can greatly save the terminal's computing resources and improve the game's running speed.

[0192] In addition, refer to Figure 3 This invention also proposes a motion-sensing tennis game device based on function fitting, the motion-sensing tennis game device based on function fitting comprising:

[0193] The acquisition module 110 is used to acquire gyroscope data from the bound motion-sensing device after the motion-sensing game is started;

[0194] The generation module 120 is used to generate trajectory data of the motion sensing device moving in space based on the gyroscope data;

[0195] The fitting module 130 is used to substitute the trajectory data into a preset cubic polynomial function to obtain the swing function;

[0196] The recognition module 140 is used to identify the type of swing action based on the swing function;

[0197] The execution module 150 is used to control the game character to perform a swing operation based on the recognized action type.

[0198] The steps for implementing each functional module of the motion-sensing tennis game device based on function fitting can be referred to in the various embodiments of the motion-sensing tennis game method based on function fitting of the present invention, and will not be repeated here.

[0199] Furthermore, this invention also proposes a computer-readable storage medium, which can be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable storage medium includes a motion-sensing tennis game program 10 based on function fitting. The specific implementation of the computer-readable storage medium of this invention is largely the same as the specific implementation of the motion-sensing tennis game method based on function fitting and the server 1 described above, and will not be repeated here.

[0200] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0201] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0202] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0203] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0204] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0205] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A motion-sensing tennis game method based on function fitting, characterized in that, include: After the motion-sensing game is launched, gyroscope data is obtained from the bound motion-sensing device; The trajectory data of the motion sensing device moving in space is generated based on the gyroscope data; The trajectory data is fitted into a preset cubic polynomial function to obtain the swing function; The type of swing action is identified based on the swing function; The game character is controlled to perform a racket swing based on the identified action type; among which... The type of swing action is identified based on the swing function, including: Calculate the inflection point of the swing function; Identify the type of swing action based on the distribution of the inflection points; Identifying the swing motion type based on the distribution of the inflection points includes: If the swing function has two inflection points, and the x-axis coordinates of the two inflection points are both within the interval [0,1], then the current swing action is identified as a forehand swing action. If the swing function has two inflection points but the x-axis coordinates of both inflection points are outside the interval [0,1], or if the swing function has only one inflection point, then the current swing action is identified as a backhand swing action. If the swing function has no inflection point, then the current swing action is identified as a serve swing action.

2. The motion-sensing tennis game method based on function fitting as described in claim 1, characterized in that, Based on the gyroscope data, trajectory data of the motion-sensing device's movement in space is generated, including: A grid map composed of multiple grid cells and a virtual rigid body matching the motion-sensing device are generated on the game terminal where the motion-sensing game is played. The position of the virtual rigid body in the grid map is updated based on the gyroscope data; The coordinate data of the grid cells that the virtual rigid body passes through during its movement in the grid map are recorded as the trajectory data.

3. The motion-sensing tennis game method based on function fitting as described in claim 1, characterized in that, The predefined expression for the cubic polynomial function is as follows: ; In the formula, a, b, c, and d are the fitting parameters to be obtained for the fitting function.

4. The motion-sensing tennis game method based on function fitting as described in claim 3, characterized in that, The trajectory data is fitted into a preset cubic polynomial function to obtain the swing function, including: Construct a two-dimensional matrix X based on the x-axis coordinates and the degree of the polynomial function in the coordinate data; Construct a one-dimensional matrix Y based on the y-axis coordinates in the coordinate data; Calculate the transpose of matrix X, XT; Calculate the product matrix XTX of matrices XT and X; Solving the linear equation XTX×C=XTY yields a one-dimensional matrix C, where the one-dimensional matrix C represents the coefficients of the polynomial function, i.e. the fitting parameters to be determined. Output the swing function based on matrix C.

5. The motion-sensing tennis game method based on function fitting as described in claim 3, characterized in that, Calculating the inflection point of the swing function includes: Differentiating the swing function yields its first derivative: ; make Find the x-axis coordinates when the first derivative is 0; Calculate the second derivative of the first derivative: ; Substitute the x-axis coordinates into the second derivative to calculate the value of the second derivative, and obtain the maximum and minimum values ​​of the swing function based on the value of the second derivative; The maximum and minimum values ​​of the swing function are taken as the inflection points of the swing function.

6. A motion-sensing tennis game device based on function fitting, used to implement the motion-sensing tennis game method based on function fitting as described in any one of claims 1-5, characterized in that, The motion-sensing tennis game device based on function fitting includes: The acquisition module is used to acquire gyroscope data from the bound motion-sensing device after the motion-sensing game is launched; The generation module is used to generate trajectory data of the motion sensing device moving in space based on the gyroscope data; The fitting module is used to substitute the trajectory data into a preset cubic polynomial function to obtain the swing function; The recognition module is used to identify the type of swing action based on the swing function; The execution module is used to control the game character to perform a racket swing operation based on the recognized action type.

7. A motion-sensing tennis game device based on function fitting, characterized in that, The system includes a memory, a processor, and a motion-sensing tennis game program based on function fitting stored in the memory and executable on the processor. When the processor executes the motion-sensing tennis game program based on function fitting, it implements the motion-sensing tennis game method based on function fitting as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a motion-sensing tennis game program based on function fitting, which, when executed by a processor, implements the motion-sensing tennis game method based on function fitting as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Method and system to analyze sports motions using motion sensors of mobile device

    CN104023799A

  • Acceleration motion identify method and system thereof

    WO2011003218A1