Real-time tennis ball speed calculation method and system based on sliding window
By using a sliding window-based method and smoothing of three-dimensional trajectory points and multi-frame data, the error and accuracy problems of ball speed calculation in tennis matches are solved, and more stable real-time ball speed calculation results are achieved.
Patent Information
- Application Number
- CN202511193059.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-12-05
AI Technical Summary
Existing technologies for real-time ball speed calculation in tennis matches are susceptible to single-frame errors, occlusion, and environmental interference, resulting in a high misjudgment rate. Furthermore, the limited field of view of a single-lens camera makes it difficult to cover multi-angle motion data, leading to insufficient accuracy.
A sliding window-based method is adopted, which filters valid three-dimensional coordinate points through a 35-frame first-in-first-out buffer, calculates Euclidean distance and inter-frame time interval to generate instantaneous velocity, and uses a 3-frame sliding window to average the velocity and filters out outliers through a threshold of 10-220km/h to output a smooth velocity.
It significantly improves the accuracy and robustness of ball speed calculation, reduces single-frame errors, adapts to complex scenarios of fast serves and multi-round rallies, and meets the real-time requirements of professional matches.
Smart Images

Figure CN121074080A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ball speed calculation technology, specifically to a real-time tennis ball speed calculation method and system based on a sliding window. Background Technology
[0002] Real-time ball velocity measurement in tennis matches is crucial for match analysis and officiating. Traditional methods rely on monocular vision systems for landing point localization. For example, a fixed camera captures court video, image preprocessing and frame differencing are used to detect the tennis ball's position, and then centroid localization and trajectory fitting are combined to determine the two-dimensional pixel coordinates. Such systems determine the landing point by analyzing sudden changes in ball velocity or extreme points in the trajectory, ultimately mapping the result to a three-dimensional court coordinate system. However, this approach has significant limitations. Ball velocity calculation relies solely on the pixel displacement between two adjacent frames, making it susceptible to noise errors caused by occlusion, camera shake, or lighting interference. Single-point velocity measurement lacks a multi-frame data smoothing mechanism, leading to a significant increase in misjudgment rates when the ball's path changes rapidly or is affected by environmental interference. Furthermore, the limited field of view of a monocular camera makes it difficult to cover multi-angle motion data, further restricting accuracy. There is an urgent need for a new method that can suppress noise and improve the robustness of real-time ball velocity calculation. Summary of the Invention
[0003] To address this issue, this invention provides a real-time tennis ball speed calculation method and system based on a sliding window, thereby solving the technical problem in existing technologies that avoid ball speed fluctuations caused by single-frame errors or occlusions, making it difficult to adapt to complex match scenarios such as fast serves or multi-round rallies.
[0004] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0005] According to a first aspect of the present invention, a method for calculating real-time tennis ball speed based on a sliding window is provided, the method being applied to a sliding window and comprising:
[0006] Store the three-dimensional trajectory point sequence of the tennis ball into a fixed-length first-in-first-out data buffer;
[0007] Traverse the buffer, filter out valid 3D coordinate points and generate a valid point sequence;
[0008] Calculate the Euclidean distance between two adjacent points in the effective point sequence, and generate instantaneous velocity by combining the inter-frame time interval;
[0009] The instantaneous velocity of multiple consecutive frames is averaged using a sliding window, and a smooth velocity value is output.
[0010] Abnormal speed values are filtered out by a preset speed threshold range, and the final ball speed data is output.
[0011] Furthermore, the data buffer has a fixed length of 35 frames.
[0012] Further, valid 3D coordinate points are selected, including:
[0013] Exclude coordinate points containing a preset invalid identifier value or a zero value, wherein the preset invalid identifier value is [-9999,-9999,-9999].
[0014] Furthermore, the inter-frame time interval is determined by a fixed acquisition frame rate of 60 frames / second, with a time difference of 16.67 milliseconds.
[0015] Furthermore, the expression for the instantaneous velocity is:
[0016]
[0017] Where (x1,y1,z1) and (x2,y2,z2) are the three-dimensional coordinates of adjacent points, and Δt is the time difference between frames.
[0018] Furthermore, the sliding window has 3 frames.
[0019] Furthermore, the preset speed threshold ranges from 10 km / h to 220 km / h.
[0020] According to a second aspect of the present invention, a real-time tennis ball speed calculation system based on a sliding window is provided, the system comprising:
[0021] The data buffer module is used to store the three-dimensional trajectory point sequence of the tennis ball into a fixed-length first-in-first-out data buffer.
[0022] The valid point filtering module is used to traverse the buffer, filter out valid three-dimensional coordinate points and generate a valid point sequence.
[0023] The instantaneous velocity calculation module is used to calculate the Euclidean distance between two adjacent points in the effective point sequence and generate the instantaneous velocity by combining the inter-frame time interval;
[0024] The sliding window averaging module is used to average the instantaneous velocity of multiple consecutive frames using a sliding window and output a smooth velocity value.
[0025] The threshold filtering module is used to filter abnormal speed values within a preset speed threshold range and output the final ball speed data.
[0026] The embodiments of the present invention have the following advantages:
[0027] This invention uses three-dimensional trajectory points as a foundation, employs a 35-frame first-in-first-out buffer for data buffering and filtering of valid points, calculates instantaneous velocity based on the Euclidean distance formula and inter-frame time interval, smooths the velocity curve through a 3-frame sliding window averaging, and filters outliers using a 10-220 km / h threshold to achieve ball speed calculation. The ball speed calculation is achieved through three-dimensional trajectory points, data buffering, valid point filtering, instantaneous velocity calculation, sliding window averaging, and threshold filtering. Compared to traditional single-point velocity measurement, this method improves accuracy by approximately 20% and reduces single-frame errors by utilizing a 3-frame sliding window and three-dimensional coordinate calculation; it enhances robustness in complex scenarios through data filtering, window averaging, and threshold filtering; the process is simple and computationally intensive, meeting the real-time requirements of professional competitions; and the fixed 35-frame buffer optimizes resources and avoids memory redundancy. Attached Figure Description
[0028] To more clearly illustrate the embodiments of the present invention or the technical solutions in 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 merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0029] The structures, proportions, sizes, etc. illustrated in this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed herein, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0030] Figure 1 This is a schematic diagram of the existing technology;
[0031] Figure 2 A schematic diagram of the logical structure of a real-time tennis ball speed calculation system based on a sliding window, provided for an embodiment of the present invention;
[0032] Figure 3 A flowchart illustrating a real-time tennis ball speed calculation method based on a sliding window, provided in an embodiment of the present invention;
[0033] Figure 4 This is a schematic diagram of the effective point determination process in a real-time tennis ball speed calculation method based on a sliding window provided in an embodiment of the present invention.
[0034] Figure 5 This diagram illustrates the traversal of valid points in a real-time tennis ball speed calculation method based on a sliding window, as provided in an embodiment of the present invention. Detailed Implementation
[0035] The following specific embodiments illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] The paper "Research on Tennis Landing Point Localization Based on Monocular Vision" proposes a method for tennis landing point localization based on monocular vision, intended to replace or supplement expensive professional landing point tracking systems that are difficult to deploy in low-cost environments. (Reference) Figure 1 Its core technologies include:
[0037] Camera calibration: Using the corner points of the field lines as calibration feature points, the camera's intrinsic and extrinsic parameters and the reflection parameters are solved; the calibration feature points are optimized based on the reprojection error.
[0038] Landing point tracking: By using a background model and tracking algorithm, the foreground target is identified, and the landing frame is determined based on the channel direction change of adjacent frames.
[0039] Landing point positioning: After mitigating the slight reflection of the landing point in the image, the projection model is applied, and the camera parameters are flipped to flip the landing point coordinates to the three-dimensional world coordinate system.
[0040] refer to Figure 1 This system monitors a tennis court using a fixed monocular camera. First, the image acquisition module continuously acquires video frames. The image preprocessing module performs grayscale conversion, noise reduction, and edge enhancement on the images. Then, the tennis ball detection module uses frame differencing to detect the position of the moving object (tennis ball) and extracts the ball's two-dimensional pixel coordinates within the image frames using centroid localization. Finally, the trajectory extraction module performs linear fitting on the ball's pixel positions in consecutive frames to establish a two-dimensional trajectory.
[0041] To determine whether the tennis ball has landed and is within bounds, the motion analysis module extracts the ball's motion trend and identifies possible landing frames based on a sharp drop in velocity or extreme points in the y-direction. Next, the court line detection module detects the edges in the image based on Hough transform and maps the landing pixel coordinates to the actual court coordinate range.
[0042] Finally, the landing point determination module compares the mapping result with the predefined field area and outputs the penalty result.
[0043] The aforementioned technology is primarily applicable to standard tennis court environments, using monocular vision to identify and determine the landing point of the tennis ball. It relies on stable image acquisition and processing algorithms, achieving a certain degree of automation in landing point detection. However, it is susceptible to noise interference in ball speed calculation; for example, if the ball is obstructed or the camera shakes, the speed estimation error can be significant. Because it relies solely on pixel displacement calculations between two frames, lacking multi-frame data smoothing and 3D correction, the misjudgment rate may further increase when the ball's trajectory changes rapidly or is affected by light reflection. Furthermore, the limited field of view of a single camera prevents it from capturing multi-angle data, further exacerbating the accuracy issues.
[0044] To address the aforementioned technical issues that prevent ball speed fluctuations caused by single-frame errors or occlusions from adapting to complex match scenarios involving fast serves or multi-round rallies.
[0045] This invention employs a three-frame sliding window averaging method and speed threshold filtering, which significantly reduces speed fluctuations and provides more stable and accurate real-time ball speed calculation results.
[0046] refer to Figure 2 This invention discloses a real-time tennis ball speed calculation system based on a sliding window. The system includes: a data buffer module 1; a valid point filtering module 2; an instantaneous speed calculation module 3; a sliding window average calculation module 4; and a threshold filtering module 5.
[0047] Data buffer: The 3D reconstruction results are stored in a buffer of fixed length 35 frames to ensure sufficient data points for fast calculations while limiting memory usage. The buffer uses a first-in, first-out (FIFO) mechanism to update and maintain the latest data.
[0048] Valid point filtering: Reference Figure 4 and Figure 5 The buffer is traversed to exclude invalid coordinates (such as [-9999,-9999,-9999] or [0,0,0]) to ensure that the calculation is based on reliable 3D points. Invalid points are usually caused by detection failures, the ball's position being outside the camera's capture range, or occlusion. The filtered sequence of valid points is used for subsequent calculations.
[0049] For a valid point sequence, the Euclidean distance between adjacent points is calculated using the vector norm. Combined with the inter-frame time interval (based on a fixed frame rate of 60 frames / second, approximately 16.67 milliseconds / frame), the instantaneous velocity is obtained.
[0050] To smooth the speed curve and reduce noise interference, a three-frame sliding window is used to calculate the average speed. Three consecutive frames are selected within the window, and the average speed is calculated and converted to kilometers per hour. Compared to single-point speed measurement, this method effectively suppresses abnormal fluctuations caused by obstructions or detection errors.
[0051] Set a reasonable threshold range for tennis speed (10 to 220 km / h) to filter out abnormal calculation results that are too high or too low, ensuring that the output speed conforms to the physical laws of tennis. The final speed is stored as the system state for display and recording on the interface.
[0052] Corresponding to the aforementioned real-time tennis ball speed calculation system based on a sliding window, this invention also discloses a real-time tennis ball speed calculation method based on a sliding window. The following details a real-time tennis ball speed calculation method based on a sliding window disclosed in this invention, in conjunction with the aforementioned real-time tennis ball speed calculation system based on a sliding window.
[0053] refer to Figure 3 This invention discloses a real-time tennis ball speed calculation method based on a sliding window. The method is applied to a sliding window and includes: storing a sequence of three-dimensional trajectory points of the tennis ball into a fixed-length first-in-first-out data buffer; traversing the buffer, filtering out valid three-dimensional coordinate points and generating a valid point sequence; calculating the Euclidean distance between adjacent points in the valid point sequence and generating instantaneous speed by combining it with the inter-frame time interval; averaging the instantaneous speed over multiple consecutive frames using the sliding window to output a smooth speed value; filtering out abnormal speed values through a preset speed threshold range and outputting the final ball speed data.
[0054] Furthermore, the data buffer has a fixed length of 35 frames.
[0055] Further, the effective three-dimensional coordinate points are filtered out, including: excluding coordinate points containing preset invalid identifier values or zero values, wherein the preset invalid identifier values are [-9999, -9999, -9999].
[0056] Furthermore, the inter-frame time interval is determined by a fixed acquisition frame rate of 60 frames / second, with a time difference of 16.67 milliseconds.
[0057] Furthermore, the expression for the instantaneous velocity is:
[0058]
[0059] Where (x1,y1,z1) and (x2,y2,z2) are the three-dimensional coordinates of adjacent points, and Δt is the time difference between frames.
[0060] Furthermore, the sliding window has 3 frames.
[0061] Furthermore, the preset speed threshold ranges from 10 km / h to 220 km / h.
[0062] In embodiments of the present invention, Kalman filters or two-order analysis models may also be considered for ball velocity time-order prediction to enhance vibration resistance in storm environments.
[0063] Compared to traditional single-point speed measurement methods, this invention significantly reduces noise interference and improves accuracy by approximately 20% through multi-frame sliding windows (3 frames) and threshold constraints (10-220 km / h). Traditional methods often suffer from ball speed fluctuations due to single-frame errors or occlusions, while this invention enhances the robustness of real-time ball speed calculation by utilizing multi-frame averaging and three-dimensional point coordinate data, adapting to complex match scenarios such as fast serves or multi-rallies. Furthermore, the method proposed in this invention offers high real-time performance, processing each frame of data in extremely short time, meeting the needs of professional matches.
[0064] Although the present invention has been described in detail above with general descriptions and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention fall within the scope of protection claimed by the present invention.
Claims
1. A real-time tennis ball speed calculation method based on sliding window, characterized in that, The method is applied to a sliding window, and comprises: storing a three-dimensional trajectory point sequence of a tennis ball in a fixed-length first-in-first-out data buffer; traversing the buffer to screen valid three-dimensional coordinate points and generate a valid point sequence; calculating the Euclidean distance between adjacent points in the valid point sequence and combining an inter-frame time interval to generate an instantaneous speed; using a sliding window to average the instantaneous speeds of continuous multiple frames to output a smoothed speed value; filtering abnormal speed values through a preset speed threshold range to output final ball speed data.
2. A real-time tennis ball speed calculation method based on sliding window as claimed in claim 1, wherein, The fixed length of the data buffer is 35 frames.
3. A real-time tennis ball speed calculation method based on sliding window as claimed in claim 2, wherein, The valid three-dimensional coordinate points are screened by: excluding coordinate points containing a preset invalid identification value or a zero value, wherein the preset invalid identification value is [-9999, -9999, -9999].
4. The real-time tennis ball speed calculation method based on sliding window of claim 1, wherein, The inter-frame time interval is determined by a fixed acquisition frame rate of 60 frames / s, and the time difference is 16.67 ms.
5. A sliding window based real-time tennis ball speed calculation method as claimed in claim 4, wherein, The expression of the instantaneous speed is: wherein (x1, y1, z1) and (x2, y2, z2) are the three-dimensional coordinates of adjacent points, and Δt is the inter-frame time difference.
6. A sliding window based real-time tennis ball speed calculation method as claimed in claim 5, wherein, The frame number of the sliding window is 3 frames.
7. A real-time tennis ball speed calculation method based on sliding window as claimed in claim 6, wherein, The preset speed threshold range is 10 km / h to 220 km / h.
8. A real-time tennis ball speed calculation system based on sliding window, characterized in that, The system comprises: a data buffering module for storing a three-dimensional trajectory point sequence of a tennis ball in a fixed-length first-in-first-out data buffer; an effective point screening module for traversing the buffer to screen valid three-dimensional coordinate points and generate a valid point sequence; an instantaneous speed calculation module for calculating the Euclidean distance between adjacent points in the valid point sequence and combining an inter-frame time interval to generate an instantaneous speed; a sliding window average calculation module for using a sliding window to average the instantaneous speeds of continuous multiple frames to output a smoothed speed value; a threshold filtering module for filtering abnormal speed values through a preset speed threshold range to output final ball speed data.
Citation Information
Patent Citations
Tennis ball speed estimation system based on sensor
CN110075494A
Vehicle detection method and system based on monocular vision and deep learning
CN114419547A
Ball landing ball mark size calculation method, device, equipment and medium
CN118351165A
Real-time basketball goal detection and identification method based on video input
CN119380250A
Badminton hitting speed calculation method and device, computer equipment and storage medium
CN119477979A
Cited By
Interactive tennis high-accuracy recognition system and method
CN121988010A
Tennis ball 3D track reconstruction method and device based on monocular vision
CN122156496A
