Method, device and equipment for measuring tennis ball speed based on monocular camera and medium
By combining a monocular camera with a vertical collision surface and utilizing image correction and mapping technology, the high cost and difficulty of tennis ball speed measurement have been solved, achieving accurate ball speed measurement.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2026-03-13
AI Technical Summary
Existing methods for measuring tennis ball speed suffer from high equipment maintenance costs, technical difficulties, and inaccurate measurement accuracy. In particular, when using light curtain emitters, gyroscope sensors, and high-speed camera arrays, the equipment is prone to damage and the modeling time is long, which cannot meet the measurement needs of the general public.
Using a monocular camera combined with a vertically positioned collision surface, the system acquires the initial time and collision time data of the tennis ball within the camera's field of view through image correction mapping and reality mapping. It then calculates the tennis ball's displacement and time to measure the ball's speed.
It reduces the cost and technical difficulty of measuring tennis ball speed, provides more accurate ball speed data, and is suitable for the needs of the general public.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of tennis ball speed measurement, and in particular to a method, apparatus, device, and medium for measuring tennis ball speed based on a monocular camera. Background Technology
[0002] Tennis, a ball sport, has been loved by people since its inception. Gradually, tennis has become integrated into people's lives and has become one of the mainstream sports. With the rise of tennis, the measurement of tennis ball speed has gradually become a hot topic of interest for tennis users.
[0003] In the field of ball speed measurement, the common method is to use light curtain emitters, gyroscope sensors, infrared emitters, binocular cameras, and high-speed camera arrays to calculate the ball's speed by calculating the time difference between two preset positions and combining it with its fixed displacement. However, the above methods have disadvantages such as large data scale, difficulty in data processing, poor accuracy, and long technology development cycle.
[0004] Specifically, tennis ball speed measurement methods can be broadly categorized into low-cost and high-cost approaches. Low-cost methods utilize gyroscope sensors, typically fixed to the top of the racket, the handle, or the player's wrist. However, this can obstruct the user's grip, resulting in a poor experience. Furthermore, when the gyroscope sensor is positioned at the top or handle, it is prone to detaching due to the high-speed swing of the racket, leading to damage and inaccurate speed measurements. High-cost methods, such as light curtain generators, binocular cameras, and high-speed camera arrays, require significant maintenance costs after a tennis ball impact, necessitating multi-dimensional data modeling. This modeling process is time-consuming and technically challenging, failing to meet the public's requirements for tennis ball speed measurement.
[0005] In conclusion, with the increasing popularity of tennis, there is an urgent need for a method in the field of tennis ball speed measurement that is low in equipment maintenance costs, not technically difficult, and has relatively accurate measurement precision. Summary of the Invention
[0006] To reduce the cost of tennis ball speed measurement and improve its accuracy, this invention provides a method, apparatus, device, and medium for measuring tennis ball speed using a monocular camera. The method involves continuously capturing images of a tennis ball entering the camera's field of view using a monocular camera, selecting the initial entry time and the collision time with the collision surface. Simultaneously, image correction mapping and image-to-realization mapping are performed on the images captured by the monocular camera to obtain the displacement data of the tennis ball from its first entry into the camera's field of view to its collision with the collision surface. Finally, the tennis ball speed data is obtained based on the displacement data and the time data. This method for measuring tennis ball speed requires only a monocular camera and a vertically positioned collision surface, significantly reducing the cost of measurement. It also has low maintenance costs, low technical difficulty, and provides relatively accurate tennis ball speed data, meeting the public's demand for tennis ball speed measurement.
[0007] Firstly, the method for measuring tennis ball speed based on a monocular camera provided by the present invention adopts the following technical solution:
[0008] Equipment installation: A rectangular collision surface is set vertically, and a monocular camera is set up so that the furthest line of the monocular camera's shooting range forms an angle with the collision surface;
[0009] Coordinate and time point acquisition: Acquire the initial time data of the tennis ball first appearing in the shooting range of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface;
[0010] Image mapping includes image correction mapping and image reality mapping;
[0011] Image correction mapping corrects images captured by a monocular camera into rectangular corrected mapping images;
[0012] Image-to-real-world mapping restores the corrected-mapped image to a real-world map of the same size as the collision surface;
[0013] Tennis ball speed calculation: The motion displacement data of the tennis ball is calculated based on the real-world image mapping from the moment the tennis ball first appears in the field of view of the monocular camera until the tennis ball collides with the collision surface. The motion time data of the tennis ball is obtained based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera. The tennis ball speed data is obtained based on the motion displacement data and the motion time data.
[0014] Preferably, the acquisition of coordinates and time points includes:
[0015] When the tennis ball appears within the field of view of the monocular camera C, the monocular camera captures an image of the tennis ball and obtains an image sequence [P1, P2, ..., P...]. n Simultaneously, it records the initial time data of when the tennis ball first enters the shooting range of the monocular camera;
[0016] For the image sequence [P1, P2, ..., P n Each image undergoes RGB value normalization across its three color channels, converting it to the HSV color space.
[0017] Key pixels are obtained through preset threshold filtering, contour extraction is performed, and the tennis ball center relative to the image sequence [P1, P2, ..., P] is obtained through filtering. n The pixel coordinates of [p1, p2, ..., p] are used to obtain the coordinate sequence [p1, p2, ..., p]. n ];
[0018] Using the coordinate sequence [p1, p2, ..., p n ]; Obtain the collision pixel coordinates and collision time data when the tennis ball collides.
[0019] Preferably, the image correction mapping includes:
[0020] Acquire the four raw coordinate data of the image captured by the monocular camera and the corrected coordinate data of the four raw coordinate data in the corrected mapping image;
[0021] Establish a 3×3 perspective transformation matrix to describe the mapping relationship between the image to be corrected and the corrected image;
[0022] A calculation equation is established based on four original coordinate data, four corrected coordinate data, and a 3×3 perspective transformation matrix, and all parameters of the 3×3 perspective transformation matrix in the equation are calculated.
[0023] Corrected collision coordinates of the tennis ball in the corrected mapping image are obtained based on a 3×3 perspective transformation matrix.
[0024] Preferably, the ratio of the corrected collision coordinate data to the depth or scale of the transformation point in three-dimensional space is calculated as the secondary corrected collision coordinate data, wherein the depth or scale of the transformation point in three-dimensional space is 1.
[0025] Preferably, the image-to-reality mapping includes:
[0026] Establish a real-world mapping relationship between the corrected mapping image and the area that the monocular camera can cover on the collision surface, map the corrected mapping image to the real-world mapping image, and obtain the real-world collision coordinate data of the tennis ball within the real-world mapping image based on the real-world mapping image.
[0027] Preferably, the tennis ball speed calculation includes:
[0028] The height distance between the tennis ball and the bottom of the collision surface at the time of the collision is calculated based on the actual collision coordinate data. The motion displacement data of the tennis ball is calculated based on the trigonometric function of the height distance and the angle formed between the farthest line drawn from the camera's field of view and the collision surface.
[0029] Motion time data is obtained based on collision time data and initial time data;
[0030] Tennis ball speed data is obtained based on motion displacement data and motion time data.
[0031] Secondly, the device for measuring tennis ball speed based on a monocular camera provided by the present invention adopts the following technical solution:
[0032] A device for measuring tennis ball speed based on a monocular camera includes:
[0033] The shooting module includes a monocular camera and a vertically arranged collision surface, and is used to make an angle between the farthest line of the shooting range of the monocular camera and the collision surface.
[0034] Coordinate and Time Acquisition Module: Used to acquire the initial time data when the tennis ball first appears in the field of view of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface;
[0035] Image mapping module: includes image correction mapping unit and image display mapping unit;
[0036] The image correction mapping unit is used to correct the image captured by the monocular camera into a rectangular correction mapping image;
[0037] The image reality mapping unit is used to restore the corrected mapping image to a reality mapping image of the same size as the collision surface;
[0038] Tennis ball speed calculation module: It is used to calculate the motion displacement data of the tennis ball from the moment it first appears in the field of view of the monocular camera to the moment it collides with the collision surface, based on the real-world mapped image. It obtains the motion time data of the tennis ball based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera. It obtains the tennis ball speed data based on the motion displacement data and the motion time data.
[0039] Thirdly, the electronic device provided by the present invention adopts the following technical solution:
[0040] An electronic device comprising:
[0041] One or more processors;
[0042] Memory;
[0043] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the method for measuring tennis ball speed based on a monocular camera as described in any of the preceding claims.
[0044] Fourthly, the present invention provides a computer-readable storage medium, which adopts the following technical solution:
[0045] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for measuring tennis ball speed based on a monocular camera as described in any of the preceding claims.
[0046] In summary, the present invention has the following beneficial technical effects:
[0047] 1. This invention utilizes a monocular camera to continuously capture images of a tennis ball entering its shooting range. It selects the initial entry time data and the collision time data upon impact with the collision surface. Simultaneously, it performs image correction mapping and image-to-realization mapping on the images captured by the monocular camera, thereby obtaining the tennis ball's motion displacement data from the moment it first enters the shooting range of the monocular camera until its collision with the collision surface. Finally, it obtains the tennis ball speed data based on the motion displacement data and motion time data. This method for measuring tennis ball speed can be completed using only a monocular camera and a vertically positioned collision surface, greatly reducing the cost of measuring tennis ball speed. Furthermore, it has low maintenance costs, low technical difficulty, and provides relatively accurate tennis ball speed data, meeting the public's demand for tennis ball speed measurement.
[0048] 2. This invention estimates the displacement of a tennis ball from when it enters the field of view of a monocular camera until it collides with the collision surface as a straight line. This allows for the simple calculation of the average ball speed using a velocity calculation formula, and the average ball speed is used as the tennis ball speed data. This greatly simplifies the process and method of measuring tennis ball speed, reduces the measurement and maintenance costs, and is easy to maintain and technically simple. Furthermore, the measured tennis ball speed data is relatively accurate, making it suitable for promotion and widespread adoption. Attached Figure Description
[0049] Figure 1 This is a flowchart of the method in an embodiment of the present invention.
[0050] Figure 2 This is a schematic diagram showing the position of the monocular camera and the collision surface in an embodiment of the present invention.
[0051] Figure 3 This is a schematic diagram of image correction mapping and image reality mapping in an embodiment of the present invention. Detailed Implementation
[0052] The present invention will be further described in detail below with reference to the accompanying drawings.
[0053] After reading this specification, those skilled in the art may make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they fall within the scope of the claims of this application.
[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0055] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article, unless otherwise specified, generally indicates that the preceding and following related objects have an "or" relationship.
[0056] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.
[0057] This application provides a method for measuring tennis ball speed using a monocular camera, executed by an electronic device. This electronic device can be a server or a terminal device. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. The terminal device and the server can be directly or indirectly connected via wired or wireless communication. This application does not impose any limitations on this connection.
[0058] Reference Figure 1 The method for measuring tennis ball speed based on a monocular camera includes the following steps:
[0059] S1. Equipment installation: A rectangular collision surface is set vertically, and a monocular camera is set up so that the furthest line of the monocular camera's shooting range forms an angle with the collision surface.
[0060] Specifically, a rectangular collision plate is set up, with one side forming a rectangular collision surface. During use, the tennis ball collides with this surface. A monocular camera is placed on one side of the collision surface, and the camera can be positioned in multiple directions, such as above, below, left, or right front of the collision surface. (See reference...) Figure 2 As shown, in this embodiment of the application, a monocular camera is set with an upper front and lower front collision surface to measure the ball speed of a tennis ball. In addition, when setting it up, the line at the farthest end of the shooting range of the monocular camera forms an angle α with the collision surface.
[0061] Example 1: A monocular camera is positioned at the upper front of the collision surface;
[0062] The collision surface is S1, the camera is C1, and the distance between camera C1 and the top of the collision surface S1 is D. c1 The distance from where tennis ball T1 appeared in the camera's field of view to the point of collision was D. b1 The height from the top to the bottom of the collision surface S1 is H. s1 The distance from the point of collision between tennis ball T1 and the collision surface to the bottom of the collision surface S1 is H. b1 The angle between the bottom line of the camera C1's shooting range and the collision surface S1 is α1, and the area that the camera C1 can cover is set to be exactly the same size as the collision surface S1.
[0063] Example 2: A monocular camera is positioned at the lower front of the collision surface;
[0064] The collision surface is S2, the camera is C2, and the distance between camera C2 and the bottom of the collision surface S2 is D. c2 The distance from where tennis ball T2 appeared in the camera's field of view to the point of collision was D. b2 The height from the top to the bottom of the collision surface S2 is H. s2 The distance from the point of collision between tennis ball T2 and collision surface S2 to the top of collision surface S2 is H. b2 The angle between the topmost line of the shooting range of the monocular camera C2 and the collision surface S2 is α2, and the area that the shooting range of the monocular camera C2 can cover is exactly the same size as the collision surface S2.
[0065] Examples 1 and 2 above are merely demonstrations of the setup; in actual scenario settings, due to the D in Example 1... b1 With D in Example 2 b2 The value is relatively small, and the ball speed is relatively fast during the movement. That is, the displacement change of the ball from the time it enters the shooting range of the monocular camera to the time it collides with the collision surface is small. Therefore, in order to facilitate the measurement and calculation of the ball speed, the trajectory of the ball is estimated as a straight line.
[0066] S2. Coordinate and Time Point Acquisition: Acquire the initial time data of when the tennis ball first appears in the shooting range of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface.
[0067] Specifically, the time and coordinates of various key moments when the tennis ball enters the range of the monocular camera are acquired. For example, acquiring the coordinates and time points includes the following steps:
[0068] S21. Record the initial time data of when the tennis ball first enters the shooting range of the monocular camera;
[0069] A monocular camera forms a shooting area on the collision surface. The camera dynamically captures the tennis ball entering this area and continuously captures images at fixed time intervals. When the tennis ball first enters the camera's shooting range, the camera continuously captures images of the ball, obtaining an image sequence, which is recorded as [P1, P2, ..., P...]. n Simultaneously, the shooting time of the first image sequence P1 is recorded, and this shooting time is recorded as the initial time data t when the tennis ball first enters the shooting range of the monocular camera. f ;
[0070] S22. Perform RGB normalization on the image sequence;
[0071] Specifically, for the image sequence [P1, P2, ..., P] obtained in S21 n For each image P in the image, the RGB values of the three color channels are normalized and converted to the HSV color space.
[0072] S23. Obtain the coordinate sequence [p1, p2, ..., p n ];
[0073] Specifically, key pixels are obtained through preset threshold filtering, contour extraction is performed, and the pixel coordinates p of the tennis ball's center relative to image P are obtained. n (x n ,y n The above operation is performed on each image in the image sequence to obtain the coordinate sequence [p1, p2, ..., p...]. n ].
[0074] S24. Obtain the collision pixel coordinate data and collision time data between the tennis ball and the collision surface;
[0075] For the coordinate sequence [p1, p2, ..., p n Further analysis and processing are performed to obtain the collision pixel coordinate data c(x) of the tennis ball when it collides with the collision surface S.c ,y c ) and the corresponding collision time data t c .
[0076] For step S24, based on the coordinate sequence [p1, p2, ..., p n For details on the process and method of obtaining the collision pixel coordinate data and collision time data of the tennis ball and the collision surface, please refer to the patent document with patent application number "202410909888.4".
[0077] S3, Image Mapping: Image correction mapping, which corrects the image captured by a monocular camera into a rectangular corrected mapping image;
[0078] Image-to-real-world mapping restores the corrected-mapped image to a real-world map of the same size as the collision surface.
[0079] Specifically, this embodiment restores the image captured by the monocular camera to the collision surface in the real scene through two image mapping processes: image correction mapping and image reality mapping. This facilitates the measurement of the displacement and time of the tennis ball from the moment it enters the field of view of the monocular camera until it collides with the collision surface, thereby measuring the speed of the tennis ball.
[0080] Reference Figure 3 Because an angle α is formed between the monocular camera and the collision surface, the image formed by the monocular camera after capturing the collision surface is as follows. Figure 3 The trapezoid shown, for example 1, has its upper base at the bottom and its lower base at the top; for example 2, it has its upper base at the top and its lower base at the bottom.
[0081] Image correction mapping aims to correct a trapezoidal image into a rectangular corrected image.
[0082] Image correction mapping includes the following steps:
[0083] S311. Obtain the original coordinate data and the corrected coordinate data;
[0084] Specifically, obtain the four raw coordinate data of the image captured by the monocular camera. The raw coordinate data can be the four vertices of a trapezoidal image. For Example 1, the four raw coordinate data are...
[0085] [A1,A2,A3,A4]; For example 2, the four original coordinate data are [B1,B2,B3,B4].
[0086] The rectangular image P of the collision surface m For example, suppose the rectangular image P m The height is M h Width is M w That is, the rectangular image Pm The four coordinate points are [(0,0), (M) w ,0),(M w M h ),(0,M h )],
[0087] [(0,0),(M w ,0),(M w M h ),(0,M h )] refers to the four correction coordinate data.
[0088] S312. Establish a 3×3 perspective transformation matrix;
[0089] Establish a 3×3 perspective transformation matrix. This matrix describes the mapping relationship between the image to be corrected and the corrected image. The 3×3 perspective transformation matrix is as follows:
[0090]
[0091] S313. Calculate all parameters of the 3×3 perspective transformation matrix in the equation;
[0092] Specifically, suppose the four coordinate points of the image to be corrected are...
[0093] [(x1,y1),(x2,y2),(x3,y3),(x4,y4)], where the four coordinate points of the corrected image are...
[0094] Given [(u1,v1),(u2,v2),(u3,v3),(u4,v4)], establish the following equation:
[0095]
[0096] Specifically, four coordinate points of the image need to be corrected.
[0097] [(x1,y1),(x2,y2),(x3,y3),(x4,y4)] can use the original coordinate data. For Example 1, [(x1,y1),(x2,y2),(x3,y3),(x4,y4)] uses [A1,A2,A3,A4]; for Example 2...
[0098] [(x1,y1),(x2,y2),(x3,y3),(x4,y4)] uses [B1,B2,B3,B4].
[0099] The four coordinate points of the corrected image are [(u1,v1),(u2,v2),(u3,v3),(u4,v4)], using a rectangular image P. mThe four coordinate points are [(0,0),(M] w ,0),(M w M h ),(0,M h )).
[0100] Then, all parameters in the perspective transformation matrix of the above equation are calculated to obtain the mapping relationship G between the trapezoidal image and the rectangular image captured by the monocular camera. p .
[0101] S314. Obtain the corrected collision coordinate data of the collision point between the tennis ball and the collision surface in the corrected mapping image;
[0102] The mapping relationship G between the trapezoidal image captured by the monocular camera and the correction obtained in step S313. p Obtain the corrected mapping image, and extract the corrected collision coordinate data c(x) of the tennis ball from the corrected mapping image. c ,y c );c(x c ,y c The calculation equation for ) is as follows:
[0103]
[0104] Then, a second correction is performed on the corrected collision coordinate data. The second correction involves calculating the ratio of the corrected collision coordinate data to the depth or scale of the transformed point in three-dimensional space, which is then used as the second-corrected collision coordinate data m(x'). c ,y' c );
[0105] The calculation equations for the secondary correction collision coordinate data are as follows:
[0106]
[0107] Where w is the depth or scale of the transformation point in three-dimensional space, and w is 1.
[0108] Image-to-realization mapping restores the corrected image to a real-world image of the same size as the collision surface, so as to facilitate the calculation of the tennis ball's displacement and motion time.
[0109] Image-to-reality mapping includes the following steps:
[0110] S321. Establish the real mapping relationship between the corrected mapping image and the area that the monocular camera can cover on the collision surface. In this embodiment, the area that the monocular camera can cover on the collision surface is the collision surface.
[0111] In Examples 1 and 2, only the vertical axis mapping is required.
[0112] 1) Correcting the high M of the mapped image h The ratio is calculated by proportionally to the height H of the collision surface, and the unit is m / px:
[0113]
[0114] 2) From the pixel ordinate y' c The physical ordinate y is calculated by using the ratio η to map the collision surface / object S. s :
[0115] y s =y' c ×η;
[0116] Establish a coordinate system on the collision surface S, with the top left corner as the origin, east as the positive x-axis, and south as the positive y-axis. The physical vertical coordinate is the distance of this position from the top of the collision surface / object S.
[0117] This allows us to obtain the actual collision coordinates s(x) of the tennis ball and the collision surface at the point of impact. s ,y s ).
[0118] If the monocular camera is located to the left or right front of the collision surface, only the x-coordinate needs to be calculated. s That's all.
[0119] S4. Tennis ball speed calculation: Based on the real-world image, calculate the displacement data of the tennis ball from the moment it first appears in the field of view of the monocular camera until it collides with the collision surface. Based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera, obtain the motion time data of the tennis ball. Based on the motion displacement data and motion time data, obtain the tennis ball speed data.
[0120] Specifically, the calculation of tennis ball speed includes the following steps:
[0121] S41. Calculate the height distance between the tennis ball and the bottom of the collision surface at the time of the collision based on the actual collision coordinate data, and calculate the motion displacement data of the tennis ball based on the trigonometric function of the height distance and the angle formed between the farthest line drawn from the shooting range of the monocular camera and the collision surface.
[0122] The tangent trigonometric function values for the included angle α are calculated using the height H of the collision surface S and the distance D from the monocular camera.
[0123] For Example 1 and Example 2, they are respectively:
[0124]
[0125] Calculate the distance H from the point of impact between the tennis ball and the impact surface S to the bottom of the impact surface S. b ;
[0126] For example 1, H b1 =H s1 -y s ;
[0127] For example 2, H b2 =y s ;
[0128] Next, based on the tangent trigonometric function value of the included angle α and the distance H from the point of collision between the tennis ball and the collision surface S to the bottom of the collision surface S. b Calculate the motion displacement data of the tennis ball from when it enters the shooting range of the monocular camera until it collides with the collision surface;
[0129] For Example 1 and Example 2, the motion displacement data are as follows:
[0130] D b1 =tanα1×H b1
[0131] D b2 =tanα2×H b2 ;
[0132] S42. Obtain motion time data based on collision time data and initial time data;
[0133] The motion time data of the tennis ball from when it enters the shooting range of the monocular camera to when it collides with the collision surface is calculated;
[0134] The formula for calculating exercise time data is:
[0135] t D =t c -t f ;
[0136] Among them, t D For motion time data, t C For collision time data, t f This is the initial time data.
[0137] S43. Obtain tennis ball speed data based on motion displacement data and motion time data;
[0138] Based on the motion displacement data of the tennis ball from the moment it enters the camera's field of view until it collides with the collision surface, and the motion time data of the tennis ball from the moment it enters the camera's field of view until it collides with the collision surface, the average ball speed of the tennis ball within this motion displacement data is calculated. The formula for calculating the average ball speed is as follows:
[0139]
[0140] Because the distance and time between when the tennis ball enters the shooting range of the monocular camera and when it collides with the collision surface are short, the tennis ball speed is relatively fast. Therefore, the average ball speed within the motion displacement data is taken as the instantaneous ball speed of the tennis ball, i.e., the tennis ball speed data. Thus, the average ball speed within the motion displacement data is the measured tennis ball speed data.
[0141] This application also discloses a device for measuring tennis ball speed based on a monocular camera. This device is used to implement the method for measuring tennis ball speed based on a monocular camera disclosed in the above embodiments.
[0142] Specifically, the device for measuring tennis ball speed based on a monocular camera includes the following modules:
[0143] The shooting module includes a monocular camera and a vertically arranged collision surface, and is used to make an angle between the farthest line of the shooting range of the monocular camera and the collision surface.
[0144] The shooting module is used to implement step S1 in the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to step S1 in the above method embodiment.
[0145] Coordinate and Time Acquisition Module: Used to acquire the initial time data when the tennis ball first appears in the field of view of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface;
[0146] The coordinate and time point acquisition module is used to implement step S2 in the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to step S2 in the above method embodiment.
[0147] Image mapping module: includes image correction mapping unit and image display mapping unit;
[0148] The image mapping module is used to implement step S3 in the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to step S3 in the above method embodiment.
[0149] The image correction mapping unit is used to correct the image captured by the monocular camera into a rectangular correction mapping image;
[0150] The image correction mapping unit is used to implement steps S311 to S314 in the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to steps S311 to S314 in the above method embodiment.
[0151] The image reality mapping unit is used to restore the corrected mapping image to a reality mapping image of the same size as the collision surface;
[0152] The image-to-realization mapping unit is used to implement step S321 in the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to step S321 in the above method embodiment.
[0153] Tennis ball speed calculation module: It is used to calculate the motion displacement data of the tennis ball from the moment it first appears in the field of view of the monocular camera to the moment it collides with the collision surface, based on the real-world mapped image. It obtains the motion time data of the tennis ball based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera. It obtains the tennis ball speed data based on the motion displacement data and the motion time data.
[0154] The tennis ball speed calculation module is used to implement step S4 of the method for measuring tennis ball speed based on a monocular camera in the above embodiment. For the specific functions and uses, please refer to step S4 in the above method embodiment.
[0155] This application provides an electronic device including a processor and a memory. The processor and memory are connected, for example, via a bus. Optionally, the electronic device may also include a transceiver. It should be noted that in practical applications, the transceiver is not limited to one unit, and the structure of this electronic device does not constitute a limitation on the embodiments of this application.
[0156] The processor can be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Data Signal Processor), an ASIC (Application-Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0157] A bus can include a pathway for transmitting information between the aforementioned components. The bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc.
[0158] The memory can be ROM (Read-Only Memory) or other types of static storage devices that can store static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or EEPROM (Electrically Erasable Programmable Read-Only Memory), CD-ROM (Read-Only Optical Disc) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited thereto.
[0159] The memory stores the application code that executes the solution of this application, and the processor controls its execution. The processor executes the application code stored in the memory to implement the content shown in the aforementioned embodiment of the method for measuring tennis ball speed based on a monocular camera.
[0160] Electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, digital radio receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Servers can also be included.
[0161] This application provides a computer-readable storage medium storing a computer program that, when run on a computer, enables the computer to execute the corresponding content in the aforementioned method embodiment for measuring tennis ball speed based on a monocular camera.
[0162] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0163] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for measuring tennis ball speed based on a monocular camera, characterized in that, Includes the following steps: Equipment installation: A rectangular collision surface is set vertically, and a monocular camera is set up so that the furthest line of the monocular camera's shooting range forms an angle with the collision surface; Coordinate and time point acquisition: Acquire the initial time data of the tennis ball first appearing in the shooting range of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface; Image mapping includes image correction mapping and image reality mapping; Image correction mapping corrects images captured by a monocular camera into rectangular corrected mapping images; Image-to-real-world mapping restores the corrected-mapped image to a real-world map of the same size as the collision surface; Tennis ball speed calculation: The motion displacement data of the tennis ball is calculated based on the real-world image mapping from the moment the tennis ball first appears in the field of view of the monocular camera until the tennis ball collides with the collision surface. The motion time data of the tennis ball is obtained based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera. The tennis ball speed data is obtained based on the motion displacement data and the motion time data.
2. The method for measuring tennis ball speed based on a monocular camera according to claim 1, characterized in that, The acquisition of coordinates and time points includes: When the tennis ball appears within the field of view of the monocular camera C, the monocular camera captures an image of the tennis ball and obtains an image sequence [P1, P2, ..., P...]. n Simultaneously, it records the initial time data of when the tennis ball first enters the shooting range of the monocular camera; For the image sequence [P1, P2, ..., P n Each image undergoes RGB value normalization across its three color channels, converting it to the HSV color space. Key pixels are obtained through preset threshold filtering, contour extraction is performed, and the tennis ball center relative to the image sequence [P1, P2, ..., P] is obtained through filtering. n The pixel coordinates of [p1, p2, ..., p] are used to obtain the coordinate sequence [p1, p2, ..., p]. n ]; Using the coordinate sequence [p1, p2, ..., p n ]; Obtain the collision pixel coordinates and collision time data when the tennis ball collides.
3. The method for measuring tennis ball speed based on a monocular camera according to claim 1, characterized in that, The image correction mapping includes: Acquire the four raw coordinate data of the image captured by the monocular camera and the corrected coordinate data of the four raw coordinate data in the corrected mapping image; Establish a 3×3 perspective transformation matrix to describe the mapping relationship between the image to be corrected and the corrected image; A calculation equation is established based on four original coordinate data, four corrected coordinate data, and a 3×3 perspective transformation matrix, and all parameters of the 3×3 perspective transformation matrix in the equation are calculated. Corrected collision coordinates of the tennis ball in the corrected mapping image are obtained based on a 3×3 perspective transformation matrix.
4. The method for measuring tennis ball speed based on a monocular camera according to claim 3, characterized in that, The ratio of the corrected collision coordinate data to the depth or scale of the transformed point in three-dimensional space is calculated as the secondary corrected collision coordinate data, where the depth or scale of the transformed point in three-dimensional space is 1.
5. The method for measuring tennis ball speed based on a monocular camera according to claim 3, characterized in that, The image-to-reality mapping includes: Establish a real-world mapping relationship between the corrected mapping image and the area that the monocular camera can cover on the collision surface, map the corrected mapping image to the real-world mapping image, and obtain the real-world collision coordinate data of the tennis ball within the real-world mapping image based on the real-world mapping image.
6. The method for measuring tennis ball speed based on a monocular camera according to claim 5, characterized in that, The tennis ball speed calculation includes: The height distance between the tennis ball and the bottom of the collision surface at the time of the collision is calculated based on the actual collision coordinate data. The motion displacement data of the tennis ball is calculated based on the trigonometric function of the height distance and the angle formed between the farthest line drawn from the camera's field of view and the collision surface. Motion time data is obtained based on collision time data and initial time data; Tennis ball speed data is obtained based on motion displacement data and motion time data.
7. A device for measuring tennis ball speed based on a monocular camera, characterized in that, include: The shooting module includes a monocular camera and a vertically arranged collision surface, and is used to make an angle between the farthest line of the shooting range of the monocular camera and the collision surface. Coordinate and Time Acquisition Module: Used to acquire the initial time data when the tennis ball first appears in the field of view of the monocular camera, as well as the collision pixel coordinate data and collision time data when the tennis ball collides with the collision surface; Image mapping module: includes image correction mapping unit and image display mapping unit; The image correction mapping unit is used to correct the image captured by the monocular camera into a rectangular correction mapping image; The image reality mapping unit is used to restore the corrected mapping image to a reality mapping image of the same size as the collision surface; Tennis ball speed calculation module: It is used to calculate the motion displacement data of the tennis ball from the moment it first appears in the field of view of the monocular camera to the moment it collides with the collision surface, based on the real-world mapped image. It obtains the motion time data of the tennis ball based on the collision time data when the tennis ball collides with the collision surface and the initial time data when the tennis ball first appears in the field of view of the monocular camera. It obtains the tennis ball speed data based on the motion displacement data and the motion time data.
8. An electronic device, characterized in that, It includes: One or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications being configured to: perform the method for measuring tennis ball speed based on a monocular camera according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the method for measuring tennis ball speed based on a monocular camera as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Tennis ball collision detection method and device
CN118864532A