Shooting detection method and equipment based on depth image and storage medium
By using depth cameras and target recognition technology, the accuracy of judging the distance to the ball and whether the shot goes in in basketball game videos has been solved in existing technologies, achieving efficient and accurate basketball shot detection.
Patent Information
- Application Number
- CN202511085482.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-21
AI Technical Summary
Existing technologies cannot accurately determine the distance of the ball relative to the basket and backboard, or whether a shot has gone in, when dealing with complex scenarios, resulting in low efficiency in judging basketball game videos.
The system uses a depth camera to capture basketball shooting videos. By breaking down the frames and identifying the target, it generates bounding boxes for the backboard, rim, and basketball. It then combines depth image analysis to determine the distance between the ball and the target, generates the trajectory, and determines whether the shot is successful.
It improves the accuracy and efficiency of basketball shot detection, and can accurately determine the distance of the ball relative to the basket and backboard and whether the shot has gone in in complex scenarios.
Smart Images

Figure CN120997729A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of basketball shooting detection, and more particularly to a method, device, and storage medium for basketball shooting detection based on depth images. Background Technology
[0002] Currently, one method for judging whether a basket has been scored in a basketball game video is manual judgment: a person watches the entire basketball game video and judges whether a basket has been scored. This method has the highest accuracy, but it is inefficient and time-consuming. Especially now that there are dozens to hundreds of basketball games at all levels every day, it is impossible to manually screen all the baskets in the videos. In addition, there are methods that use computer vision to identify whether a basketball has entered the basket. These typically use a 2D camera as a sensor, providing 2D planar information. The identification and tracking of the ball during the shooting process is done simply by drawing a frame on that plane. This approach may be limited when handling complex scenarios, as it cannot accurately determine the distance of the ball relative to the basket and backboard, or whether the shot has gone in. Summary of the Invention
[0003] The main objective of this invention is to solve the technical problem that existing technologies may be limited when dealing with complex scenarios, making it impossible to accurately determine the distance of the ball relative to the basket and backboard and whether the shot has gone in.
[0004] The first aspect of this invention provides a basketball shot detection method based on depth images, the basketball shot detection method comprising: Shooting basketball shooting videos using a depth camera; The basketball shooting video is decomposed into frames to obtain N ordered shooting frame images, where N is a positive integer; Target recognition is performed on the N shooting frame images to obtain backboard recognition boxes, basket recognition boxes, and N ordered basketball recognition boxes; Based on the basketball hoop recognition frame, the distance between the depth camera and the edge of the basketball hoop is analyzed to obtain the minimum edge distance; and based on N basketball recognition frames, the spherical distance between the depth camera and the basketball is analyzed to obtain N minimum spherical distances. Calculate the distance between the center points of the i-th basketball recognition box and the (i+1)-th basketball recognition box to obtain an ordered N-1 pixel distance, where i = 1, 2, 3, ..., N-1; Based on the N-1 pixel distances, the trajectory of the basketball is generated; Determine whether the movement trajectory enters the backboard recognition frame; When the movement trajectory enters the backboard recognition frame, it is determined whether the movement trajectory has entered the basket recognition frame. When the object enters the basketball hoop recognition frame, it is determined whether the minimum spherical distance corresponding to the movement trajectory entering the basketball hoop recognition frame is greater than the minimum edge distance. When the minimum spherical distance of the movement trajectory into the basket recognition frame is greater than the minimum edge distance, the basketball is determined to be in a shooting state.
[0005] Optionally, in a first implementation of the first aspect of the present invention, the step of analyzing the edge distance between the depth camera and the basketball hoop based on the basketball hoop recognition frame to obtain the minimum edge distance, and analyzing the spherical distance between the depth camera and the basketball based on N basketball recognition frames to obtain N minimum spherical distances includes: Set the inspection cycle; In each inspection cycle, the initial horizontal distance and minimum edge distance between the depth camera and the backboard are measured. The detection diameter of the basketball hoop is obtained by the difference between the initial horizontal distance and the minimum edge distance.
[0006] Optionally, in a second implementation of the first aspect of the present invention, obtaining the detection diameter of the basket by the difference between the initial horizontal distance and the minimum edge distance includes: Determine whether the detection diameter matches the standard diameter of the basketball hoop; If the detection diameter matches the standard diameter of the basketball hoop, then it is determined whether the movement trajectory enters the backboard recognition frame.
[0007] Optionally, in a third implementation of the first aspect of the present invention, after determining whether the detection diameter matches the standard diameter of the basketball hoop, the method further includes: If the detection diameter does not match the standard diameter of the basketball hoop, the error between the depth image captured by the depth camera and the planar image is large, and the depth image is not used to determine whether the motion trajectory enters the backboard recognition frame.
[0008] Optionally, in the fourth implementation of the first aspect of the present invention, the step of calculating the distance between the center points of the i-th basketball recognition frame and the (i+1)-th basketball recognition frame to obtain an ordered N-1 pixel distance includes: The pixel distance is calculated using the Euclidean distance formula: ; Where d is the pixel distance. Let x be the x-coordinate of the center point of the i-th basketball recognition box. Let be the ordinate of the center point of the i-th basketball recognition box. Let x be the x-coordinate of the center point of the (i+1)th basketball recognition box. Let y be the ordinate of the center point of the (i+1)th basketball recognition box.
[0009] Optionally, in a fifth implementation of the first aspect of the present invention, generating the basketball's trajectory based on the distances of N-1 pixels includes: Determine whether the pixel distance is less than or equal to a preset matching threshold; If the pixel distance is less than or equal to the matching threshold, then the basketball in the i-th basketball recognition frame and the basketball in the (i+1)-th basketball recognition frame are considered to be the same sphere.
[0010] Optionally, in a sixth implementation of the first aspect of the present invention, generating the basketball's trajectory based on the distance of N-1 pixels further includes: performing time synchronization processing on the planar image and depth image of the basketball shooting video to obtain spatial position information of the basketball matching each other at the same time; dynamically segmenting a moving foreground region in the planar image based on the spatial position information; locating a candidate basketball target in the planar image based on the moving foreground region, and synchronously extracting the three-dimensional spatial coordinates of the candidate basketball target in the depth image; and calculating the motion speed and trajectory direction of the candidate basketball target in real time according to the changes in the three-dimensional spatial coordinates of the candidate basketball target in consecutive frames of the depth image to generate the basketball's trajectory.
[0011] Optionally, in the seventh implementation of the first aspect of the present invention, after determining whether the minimum spherical distance corresponding to the movement trajectory entering the basket recognition frame is greater than the minimum edge distance when entering the basket recognition frame, the method further includes: Set a time threshold; When the basketball enters the net connected to the hoop, it is determined whether the time the basketball stays in the net or the hoop is within the time threshold. If the time the basketball stays in the net or the hoop is within the time threshold, it is recorded as a successful shot.
[0012] A second aspect of the present invention provides a basketball shooting detection device applied in the above-described basketball shooting detection method. The basketball shooting detection device includes: a first acquisition module, a second acquisition module, a memory, and at least one processor. The first acquisition module and the second acquisition module are both located at the half-court position of a basketball court and directly facing the center of the basketball hoop recognition frame. The first acquisition module and the second acquisition module are used to acquire basketball shooting videos. The memory stores instructions. The memory and the at least one processor are interconnected via a circuit. The at least one processor calls the instructions in the memory to cause the basketball shooting detection device to execute the above-described basketball shooting detection method.
[0013] A third aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described shooting detection method.
[0014] In this embodiment of the invention, a depth camera captures a basketball shooting video; a backboard recognition frame, a basket recognition frame, and a basketball recognition frame are identified; based on the basket recognition frame, the distance between the depth camera and the edge of the basket is analyzed to obtain the minimum edge distance; and based on the basketball recognition frame, the spherical distance between the depth camera and the basketball is analyzed to obtain the minimum spherical distance; when the basketball enters the backboard recognition frame, it is determined whether the movement trajectory enters the basket recognition frame; when the basketball enters the basket recognition frame, it is determined whether the minimum spherical distance corresponding to the movement trajectory entering the basket recognition frame is greater than the minimum edge distance; when the minimum spherical distance corresponding to the movement trajectory entering the basket recognition frame is greater than the minimum edge distance, it is determined that the basketball is in a shooting state. This method can accurately determine the distance of the ball relative to the basket and backboard and whether the shot goes in, even in complex scenarios. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of one embodiment of the shooting detection method in this invention; Figure 2 This is a schematic diagram of a specific embodiment of step 104 in the present invention; Figure 3 This is a schematic diagram of a specific embodiment of step 1043 in the present invention; Figure 4 This is a schematic diagram of a specific embodiment of step 106 in the present invention; Figure 5 This is a schematic diagram of the structure of the basketball shooting detection device provided in an embodiment of the present invention. Detailed Implementation
[0016] This invention provides a method, device, and storage medium for basketball shooting detection based on depth images.
[0017] The embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0018] In the description of the embodiments disclosed in this invention, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0019] This invention uses a depth camera based on structured light technology as a sensor. By projecting a specific infrared light pattern onto an object and using two infrared cameras to capture the deformation of these patterns, the depth information of the object can be accurately calculated. It can simultaneously provide both traditional planar image data and depth image data to obtain the distance between the sphere and the depth camera. This allows for better utilization of spatial depth information as a method for determining basketball shots, improving the accuracy of basketball shot detection.
[0020] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 , Figure 1 This is a schematic diagram of an embodiment of the shooting detection method of the present invention. An embodiment of the shooting detection method based on depth images of the present invention includes: 101. Shoot basketball shooting videos using a depth camera; In this embodiment, a standard indoor basketball court is used as the environment. A half-court basketball court and a basketball hoop are used. A depth camera is set up at the half-court position and directly in front of the center of the basket.
[0021] 102. Decompose the basketball shooting video into frames to obtain N ordered shooting frame images, where N is a positive integer; 103. Perform target recognition on the N shooting frame images to obtain backboard recognition box, basket recognition box, and N ordered basketball recognition boxes; 104. Based on the basketball hoop recognition frame, analyze the edge distance between the depth camera and the basketball hoop to obtain the minimum edge distance; and based on N basketball recognition frames, analyze the spherical distance between the depth camera and the basketball to obtain N minimum spherical distances. In steps 102-104 of this embodiment, data such as N shooting frame images, backboard recognition boxes, hoop recognition boxes, N ordered basketball recognition boxes, minimum edge distances, and N minimum spherical distances are cached. The recognition boxes accurately locate the positions of the backboard, hoop, and basketball in each frame image. This provides an accurate pixel coordinate basis for subsequent spatial distance calculations, making it possible to quantify the relative positional relationship between the camera and key targets (hoop, basketball). The recognition algorithm can be a deep learning model such as YOLO-V8. These models use convolutional neural networks (CNNs) for object detection, enabling fast and accurate identification and location of multiple objects in images or videos. YOLO-V8, as the latest version of the YOLO series, has higher detection accuracy and stronger real-time performance, capable of handling complex scenes and diverse targets. Furthermore, YOLO-V8 reduces computational resource consumption and improves detection speed by optimizing model structure and algorithms. Besides YOLO-V8, other advanced object recognition algorithms, such as RetinaNet and Faster R-CNN, can also be used as alternatives. The most suitable algorithm should be selected for object detection based on specific needs.
[0022] like Figure 2 As shown, Figure 2 This is a schematic diagram of a specific embodiment of step 104 in this invention. Step 104 can perform the following steps: 1041. Set the inspection cycle; 1042. During each inspection cycle, the initial horizontal distance and minimum edge distance between the depth camera and the backboard are measured. 1043. The detection diameter of the basket is obtained by the difference between the initial horizontal distance and the minimum edge distance.
[0023] In steps 1041-1043, the inspection cycle is set to once a day. The initial horizontal distance and minimum edge distance between the depth camera and the backboard are measured in each inspection cycle. The initial horizontal distance is 10 meters, and the detection diameter = initial horizontal distance - minimum edge distance = 10 - minimum edge distance. This ensures the detection accuracy of the depth camera. This calibration process can reduce errors caused by factors such as equipment deviation and changes in the external environment. The furthest distance from the NBA three-point line to the basket is 7.25 meters. Therefore, the initial horizontal distance obtained from the position of the depth camera is approximately 3 meters behind the three-point line. This 3-meter distance allows athletes to move and retrieve the ball. This distance can reduce the possibility of collisions with the camera caused by athletes moving and the ball bouncing after shooting.
[0024] like Figure 3 As shown, Figure 3This is a schematic diagram of a specific embodiment of step 1043 in this invention. Step 1043 can perform the following steps: 10431. Determine whether the detection diameter matches the standard diameter of the basket; 10432. If the detection diameter matches the standard diameter of the basketball hoop, then determine whether the movement trajectory enters the backboard recognition frame.
[0025] 10433. If the detection diameter does not match the standard diameter of the basketball hoop, the error between the depth image captured by the depth camera and the planar image is large, and the depth image is not used to determine whether the motion trajectory enters the backboard recognition frame.
[0026] In steps 10431-10433, the detection diameter of the basketball hoop is calculated by comparing the difference between the initial horizontal distance and the minimum edge distance. The standard diameter of the basketball hoop is 45 cm. If the difference between the detection diameter and the standard diameter of the basketball hoop is greater than 2 cm, it is considered to have a large error. In this case, depth images are not used for auxiliary judgment to avoid misidentification. Only when it is confirmed that there is no error in the depth image will the next step be processed. This mechanism can ensure that processing will not continue when the error is large, thereby avoiding misidentification and improving the accuracy and reliability of recognition. Through regular automatic detection and calibration, manual intervention can be reduced, the degree of automation can be improved, and the operational efficiency and stability can be improved at the same time.
[0027] 105. Calculate the distance between the center points of the i-th basketball recognition box and the (i+1)-th basketball recognition box to obtain an ordered N-1 pixel distance, where i = 1, 2, 3, ..., N-1; In this embodiment, according to the chronological order, from front to back, each pair of adjacent frames is considered as a set of matching objects. The distance between each ball cached in these two frames is judged in pixels. When i is 1 and N is 2, the distance between the center points of the first basketball recognition frame and the second basketball recognition frame is calculated to obtain an ordered 1-pixel distance. This pixel distance is used to determine whether the basketballs in the two basketball recognition frames are the same ball.
[0028] The following steps can be performed in step 105: 1051. Calculate the pixel distance using the Euclidean distance formula: ; Where d is the pixel distance. Let x be the x-coordinate of the center point of the i-th basketball recognition box. Let be the ordinate of the center point of the i-th basketball recognition box. Let x be the x-coordinate of the center point of the (i+1)th basketball recognition box. Let y be the ordinate of the center point of the (i+1)th basketball recognition box.
[0029] In step 1051, when i is 1, the pixel distance between the center points of the first and second basketball recognition frames is calculated. Since the depth image and planar image of this device have the same resolution and have undergone image correction, the spherical coordinates in the planar image correspond to the spherical coordinates in the depth image. The Euclidean distance formula, by calculating the straight-line distance between two points, accurately reflects the true physical distance between two pixels in the image. It provides high-precision data support for tasks such as object localization, target tracking, and image matching. Euclidean distance effectively measures the spatial relationship between basketballs in an image. When processing depth images, recognizing object shapes, or performing target classification, using Euclidean distance helps the system understand the relative positional relationships between objects or pixels, thereby improving the accuracy of subsequent processing.
[0030] 106. Based on the distances between N-1 pixels, generate the trajectory of the basketball; In this embodiment, by calculating the distance between multiple pixels, the system can more accurately track the trajectory of the basketball. Compared to a single pixel, using N-1 pixel distances provides more data points, better reflecting the basketball's movement path and avoiding deviations caused by occasional errors or noise.
[0031] The following steps can be performed in step 106: 1061. Determine whether the pixel distance is less than or equal to a preset matching threshold; 1062. If the pixel distance is less than or equal to the matching threshold, then the basketball in the i-th basketball recognition frame and the basketball in the (i+1)-th basketball recognition frame are considered to be the same sphere.
[0032] In steps 1061-1062, when i is 1, the distance between the center points of the first and second basketball recognition frames is calculated, resulting in an ordered one-pixel distance. This pixel distance is then used to determine if the basketballs in the two recognition frames are the same ball. This process is repeated between every two adjacent shooting frames. By setting a matching threshold and using pixel distance to determine if the basketballs are the same, misidentification can be effectively avoided, reducing the chance of different basketballs being mistakenly identified as the same. Setting the threshold provides flexibility for the judgment, allowing adjustments based on the actual scenario, thereby improving the system's accuracy.
[0033] like Figure 4 As shown, Figure 4 This is a schematic diagram of a specific embodiment of step 106 in the present invention; 1063. Perform time synchronization processing on the planar image and depth image of the basketball shooting video to obtain the spatial position information of the basketball matching each other at the same moment; 1064. Based on the spatial position information, dynamically segment the moving foreground region in the planar image; 1065. Based on the moving foreground region, locate the candidate basketball target in the planar image, and simultaneously extract the three-dimensional spatial coordinates of the candidate basketball target in the depth image; 1066. According to the changes in the three-dimensional spatial coordinates of the candidate basketball target in consecutive frames of the depth image, calculate the motion speed and trajectory direction of the candidate basketball target in real time, and generate the motion trajectory of the basketball.
[0034] In steps 1063-1066, the trajectory of the basketball is generated by the parabolic trajectory between the three-dimensional spatial coordinates of the center points of multiple adjacent basketball recognition boxes. When the basketball is obscured by the player's hand, the trajectory is completed by predicting the position using Kalman filtering. Taking three consecutive frames from the basketball shooting video, with a 0.1-second interval between each frame, we obtain A (1.0, 2.2, 4.0), B (1.1, 2.4, 3.9), and C (1.2, 2.5, 3.8), with a horizontal velocity of 1 m / s and a vertical velocity of 1.5 m / s, thus obtaining the unit direction vector. = (0.2, 0.3, -0.2), normalized to (0.49, 0.73, -0.49), and a polynomial is used to fit the 3D coordinate points to generate a parabola. By processing the planar image and depth image in time synchronization, the spatial position information of the basketball at the same moment can be accurately obtained. This synchronous processing avoids erroneous matching caused by image delay or asynchronous problems, thereby improving the recognition accuracy of moving targets. Based on the spatial position information, the moving foreground region is dynamically segmented, effectively separating the basketball's trajectory from the background. This reduces background interference, ensuring that the system can focus on tracking the basketball, improving the efficiency of detecting and locating dynamic objects. By combining planar image and depth image information, the movement of the basketball can be comprehensively analyzed from multiple angles, reducing errors caused by single viewpoints or image quality issues, and improving the robustness of the system.
[0035] 107. Determine whether the movement trajectory enters the backboard recognition frame; 108. When entering the backboard recognition frame, determine whether the movement trajectory has entered the basket recognition frame; 109. When entering the basketball hoop recognition frame, determine whether the minimum spherical distance corresponding to the movement trajectory entering the basketball hoop recognition frame is greater than the minimum edge distance; 110. When the minimum spherical distance of the movement trajectory into the basket recognition frame is greater than the minimum edge distance, the basketball is determined to be in a shooting state.
[0036] In steps 107-110 of this embodiment, if the movement trajectory does not enter the backboard recognition frame, the shot is missed; if the movement trajectory does not enter the basket recognition frame, the shot is missed; if the minimum spherical distance corresponding to the movement trajectory entering the basket recognition frame is not greater than the minimum edge distance, the shot is missed. By judging whether the movement trajectory enters the backboard recognition frame, and then judging whether it enters the basket recognition frame, the system can accurately detect whether the basketball's movement path is close to the key target (backboard, basket). This step-by-step judgment method ensures that the system can accurately identify the relationship between the basketball and the target, avoiding misjudgment. The step-by-step judgment from the backboard recognition frame to the basket recognition frame ensures that judgment can be made in a larger area first, and then precise confirmation can be made in a smaller area. This layered processing method can reasonably filter the basketball trajectory at different scales, improving the efficiency and accuracy of detection. The judgment of the minimum spherical distance and the minimum edge distance increases the accuracy of the judgment, especially when the proximity of the ball to the basket is very small, ensuring that the system can correctly judge whether a shot has been made and avoiding errors.
[0037] After step 109, the following steps can be performed: A. Set a time threshold; B. When the basketball enters the net connected to the hoop, determine whether the time the basketball stays in the net or the hoop is within the time threshold. If the time the basketball stays in the net or the hoop is within the time threshold, it is recorded as a successful shot count.
[0038] In the AB process, for situations where the ball has entered the net but remains on the net or rim due to deformation and force, or moves slightly up and down, a time threshold is set to avoid false alarms. The recommended time threshold is 0.3 seconds, meaning that within 0.3 seconds, there will be at most one and only one successful shot count. This time threshold is consistent with the actual application scenario and is simple and efficient.
[0039] A second aspect of the present invention provides a basketball shooting detection device applied in the above-described basketball shooting detection method. The basketball shooting detection device includes: a first acquisition module, a second acquisition module, a memory, and at least one processor. The first acquisition module and the second acquisition module are both located at the half-court position of a basketball court and directly facing the center of the basketball hoop recognition frame. The first acquisition module and the second acquisition module are used to acquire basketball shooting videos. The memory stores instructions. The memory and the at least one processor are interconnected via a circuit. The at least one processor calls the instructions in the memory to cause the basketball shooting detection device to execute the above-described basketball shooting detection method.
[0040] A third aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described shooting detection method.
[0041] In this embodiment of the invention, even when dealing with complex scenarios, the distance of the ball relative to the basket and backboard, as well as whether the shot has gone in, can be accurately determined.
[0042] Figure 5 This is a schematic diagram of the structure of a basketball shooting detection device provided in an embodiment of the present invention. The shooting detection device is applied in the aforementioned shooting detection method. The shooting detection device includes: a first acquisition module 570, a second acquisition module 580, a memory 520, and at least one processor 510. The first acquisition module 570 and the second acquisition module 580 are both located at the half-court position of the basketball court and directly facing the center of the basketball hoop recognition frame. The first acquisition module 570 is an RGB camera (1080p / 60fps), and the second acquisition module 580 is a depth sensor (such as Kinect V2). The first acquisition module 570 and the second acquisition module 580 are used to acquire basketball shooting videos. The memory 520 stores instructions, and the memory 520 and the at least one processor 510 are interconnected via a circuit. This shooting detection device 500 can vary significantly due to different configurations or performance, and may include one or more processors (central processing units). Units 510 (e.g., one or more processors) and memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing application programs 533 or data 532. The memory 520 and storage media 530 can be temporary or persistent storage. The program stored in the storage media 530 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the shooting detection device 500. Furthermore, the processor 510 may be configured to communicate with the storage media 530 and execute the series of instruction operations in the storage media 530 on the shooting detection device 500.
[0043] The shooting detection device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input / output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, Free BSD, etc. Those skilled in the art will understand that... Figure 5The illustrated shooting detection device structure does not constitute a limitation on shooting detection device equipment, and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0044] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the shooting detection device method.
[0045] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0046] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.
[0047] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A basketball shot detection method based on depth images, characterized in that, The shooting detection method includes: Shooting basketball shooting videos using a depth camera; The basketball shooting video is decomposed into frames to obtain N ordered shooting frame images, where N is a positive integer; Target recognition is performed on the N shooting frame images to obtain backboard recognition boxes, basket recognition boxes, and N ordered basketball recognition boxes; Based on the basketball hoop recognition frame, the distance between the depth camera and the edge of the basketball hoop is analyzed to obtain the minimum edge distance; and based on N basketball recognition frames, the spherical distance between the depth camera and the basketball is analyzed to obtain N minimum spherical distances. Calculate the distance between the center points of the i-th basketball recognition box and the (i+1)-th basketball recognition box to obtain an ordered N-1 pixel distance, where i = 1, 2, 3, ..., N-1; Based on the N-1 pixel distances, the trajectory of the basketball is generated; Determine whether the movement trajectory enters the backboard recognition frame; When the movement trajectory enters the backboard recognition frame, it is determined whether the movement trajectory has entered the basket recognition frame. When the object enters the basketball hoop recognition frame, it is determined whether the minimum spherical distance corresponding to the movement trajectory entering the basketball hoop recognition frame is greater than the minimum edge distance. When the minimum spherical distance of the movement trajectory into the basket recognition frame is greater than the minimum edge distance, the basketball is determined to be in a shooting state.
2. The shooting detection method according to claim 1, characterized in that, The steps of analyzing the edge distance between the depth camera and the basketball hoop based on the basketball hoop recognition frame to obtain the minimum edge distance, and analyzing the spherical distance between the depth camera and the basketball based on N basketball recognition frames to obtain N minimum spherical distances, include: Set the inspection cycle; In each inspection cycle, the initial horizontal distance and minimum edge distance between the depth camera and the backboard are measured. The detection diameter of the basketball hoop is obtained by the difference between the initial horizontal distance and the minimum edge distance.
3. The shooting detection method according to claim 2, characterized in that, The method of obtaining the detection diameter of the basket by the difference between the initial horizontal distance and the minimum edge distance includes: Determine whether the detection diameter matches the standard diameter of the basketball hoop; If the detection diameter matches the standard diameter of the basketball hoop, then it is determined whether the movement trajectory enters the backboard recognition frame.
4. The shooting detection method according to claim 3, characterized in that, After determining whether the detection diameter matches the standard diameter of the basketball hoop, the method further includes: If the detection diameter does not match the standard diameter of the basketball hoop, the error between the depth image captured by the depth camera and the planar image is large, and the depth image is not used to determine whether the motion trajectory enters the backboard recognition frame.
5. The shooting detection method according to claim 1, characterized in that, The calculation of the distance between the center points of the i-th basketball recognition box and the (i+1)-th basketball recognition box to obtain the ordered N-1 pixel distances includes: The pixel distance is calculated using the Euclidean distance formula: ; Where d is the pixel distance. Let x be the x-coordinate of the center point of the i-th basketball recognition box. Let be the ordinate of the center point of the i-th basketball recognition box. Let x be the x-coordinate of the center point of the (i+1)th basketball recognition box. Let y be the ordinate of the center point of the (i+1)th basketball recognition box.
6. The shooting detection method according to claim 1, characterized in that, The process of generating the basketball's trajectory based on the distances between N-1 pixels includes: Determine whether the pixel distance is less than or equal to a preset matching threshold; If the pixel distance is less than or equal to the matching threshold, then the basketball in the i-th basketball recognition frame and the basketball in the (i+1)-th basketball recognition frame are considered to be the same sphere.
7. The shooting detection method according to claim 1, characterized in that, The step of generating the basketball's trajectory based on the distance of N-1 pixels further includes: performing time synchronization processing on the planar image and depth image of the basketball shooting video to obtain the spatial position information of the basketball matching each other at the same time; dynamically segmenting the moving foreground region in the planar image based on the spatial position information; locating the candidate basketball target in the planar image based on the moving foreground region, and simultaneously extracting the three-dimensional spatial coordinates of the candidate basketball target in the depth image; and calculating the movement speed and trajectory direction of the candidate basketball target in real time according to the changes in the three-dimensional spatial coordinates of the candidate basketball target in consecutive frames of the depth image to generate the basketball's trajectory.
8. The shooting detection method according to claim 1, characterized in that, After determining whether the minimum spherical distance corresponding to the movement trajectory entering the basket recognition frame is greater than the minimum edge distance when the movement enters the basket recognition frame, the method further includes: Set a time threshold; When the basketball enters the net connected to the hoop, it is determined whether the time the basketball stays in the net or the hoop is within the time threshold. If the time the basketball stays in the net or the hoop is within the time threshold, it is recorded as a successful shot.
9. A shooting detection device, characterized in that, In the basketball shooting detection method as described in any one of claims 1-8, the basketball shooting detection device includes: a first acquisition module, a second acquisition module, a memory, and at least one processor. The first acquisition module and the second acquisition module are both located at the half-court position of the basketball court and directly facing the center of the basketball hoop recognition frame. The first acquisition module and the second acquisition module are used to acquire basketball shooting videos. The memory stores instructions. The memory and the at least one processor are interconnected via a circuit. The at least one processor calls the instructions in the memory to cause the basketball shooting detection device to execute the basketball shooting detection method as described in any one of claims 1-8.
10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the shooting detection method as described in any one of claims 1-8.