# Automatic Capture Processing Method of Basketball Shooting Trajectory Based on Background Elimination Technology

Authors: Hongyan Fan; Youhong Hu; Jianfeng Zhang
Journal: Advances in Meteorology
 (2022)

---

## Abstract

The analysis and prediction of the shooting trajectory can be used to partially correct the shooting. The traditional automatic basketball shooting trajectory capture algorithm has a low capture accuracy and a long capture time, and thus is incapable of displaying the shooting trajectory in real time. To address this issue, this study proposes an automatic basketball shooting trajectory capture algorithm based on background elimination. The image of the basketball shooting trajectory is captured using imaging technology; the image is then preprocessed in four steps: binary erosion, binary expansion, closing operation, and opening operation to create a smooth image. After removing the background from the preprocessed image using the background difference method, the edge contour features are extracted, the candidate target area is set based on the extraction result, and a diagonal matrix reflecting the length and width of the trajectory target is introduced to calculate the probability of the color of the area in the shooting trajectory, thereby characterizing the trajectory. The target’s size changes in two directions to capture the basketball shooting trajectory automatically. The algorithm’s simulation results indicate that it has a higher accuracy and a shorter capture time.


---

## Body

## 1. Introduction

Basketball is one of the most popular sports in the world. It has been introduced into China for more than a hundred years. Every year, the number of people participating in basketball in China has been increasing. The big reason is that compared with other sports, basketball has the characteristics of convenience and simplicity. Several people can carry out activities with one ball. In addition, basketball is not only a high-intensity competitive sport with antagonism and intensity, but also an ornamental fitness leisure sports [1]. Participating in basketball can not only strengthen the body but also cultivate responsiveness and flexibility. It can also establish multiperson mutual cooperation and a collective sense of honor. It is a sport suitable for men, women, young, and old. In a basketball game, the most important thing is the score, and the only way to score is shooting. There are many ways of shooting, which also need to vary from person to person. The conventional shooting methods include one hand low hand layup, one hand shoulder shot (jump shot), two hand shot, etc. Among these various shooting methods, the most basic and stable shooting method is one hand shoulder shooting [2]. One hand shoulder shooting is the basic shooting method . It is not only the most commonly used shooting method of basketball players, but also the most widely used by basketball participants. Since one hand shoulder shot has the characteristics of good stability and high accuracy, it is suitable for people who have just come into contact with basketball or those who often play basketball to learn to use one hand shoulder shot. In the world of basketball, no matter how new shooting moves appear and change, one hand shoulder shooting has always been irreplaceable. Whether we can win in the game depends on the final score of the game, and the number of scores is first linked to the number of shots, but the main guarantee is the shooting hit rate. The most direct application of the technical action of one hand shoulder shot in place in the game is reflected through the free throw, although in the formal basketball game, the shooting hit rate of athletes is affected by many factors, such as the psychological quality of athletes, the competitive state at that time, the physical level, and the defensive strength of opponents [3]. But only the technical action factor is the most fundamental factor affecting the shooting percentage. Therefore, if athletes want to improve their shooting hit rate, get more scores and reflect their sports value, they must master and be able to use correct shooting techniques in various complex competition environments. In the process of basketball shooting, the shooting trajectory exists as a parabola. Therefore, it is necessary to automatically capture the basketball shooting trajectory and obtain the characteristic data of basketball shooting action, so as to lay a foundation for the improvement of players’ technical level in shooting [4].Reference [5] proposes a human motion space trajectory tracking algorithm based on an inertial sensor. The algorithm acquires real-time limb attitude information via an inertial sensor unit worn at the human joint point. Accelerometer, angular velocity sensor, and magnetometer comprise the inertial sensor. The microcontroller acquires sensor data and updates the quaternion using a low-pass filter and a Kalman filter. The Bluetooth module then transmits the preprocessed data to the computer in real time. It is demonstrated that the inertial sensor can track the spatial trajectory of human limb movement through experiments with various angles of limb movement. Based on binocular vision, reference [6] proposed an algorithm for determining the object’s position and predicting its motion trajectory. Calibration, image preprocessing, target capture, feature matching, and three-dimensional reconstruction can be used to obtain more precise position coordinates for a moving object over a time interval, and the motion trajectory can be fitted with a polynomial.The binocular camera’s historical position coordinates are substituted into the polynomial to predict the position of the moving object the next time. The experimental results demonstrate that the algorithm is capable of rapidly calculating the position coordinates of a moving object and accurately predicting the position coordinates of the object at a later time, indicating that it has a high degree of universality and flexibility. However, the accuracy of the two methods mentioned above is low, resulting in a low capture effect. Reference [7] proposed an improved elm-based algorithm for tracking pole jump trajectory. To improve the accuracy, the limit learning machine is first regularized using structural risk minimization theory, and then the hidden layer parameters are optimized using the global optimization capability of the differential evolution algorithm. Finally, a model for pole jumps is established. Pole jump’s experimental results demonstrate that the algorithm is capable of effectively overcoming the disadvantage of overfitting in limit learning machines and has a higher capacity for generalization. The simulation results demonstrate the effectiveness of the method. Reference [8] proposes an algorithm for capturing object motion data using an optical motion capture system. To begin, a fixed model is constructed using three-marker points to obtain the instantaneous coordinates of the corresponding marker points during object motion, and then the vector method is used to solve the object pose corresponding to each acquisition point of the measured object during object motion. The Kalman filter method is then used to eliminate the influence of system and environmental errors during the motion capture process to obtain a smooth object pose motion trajectory, and to calculate the object's velocity, acceleration, angular velocity, and angular acceleration at each acquisition point using the filtered data. Finally, an experiment is conducted to collect data on object motion using the cooperative robot. The proposed method for capturing object motion data is validated. However, the above two algorithms require a significant amount of time for automatic motion trajectory capture, resulting in a low motion trajectory capture efficiency.In light of the shortcomings of the preceding algorithms, this article proposes an automatic basketball shooting trajectory capture algorithm based on background elimination and validates the algorithm’s effectiveness and timeliness via simulation experiments. It not only addresses the shortcomings of the traditional algorithm, but also lays the groundwork for increasing the shooting hit rate in basketball.


## 2. Automatic Capture Algorithm of Basketball Shooting Trajectory Based on Background Elimination

### 2.1. Image Acquisition of Basketball Shooting Trajectory

In order to better complete the automatic capture of basketball shooting trajectory, it is necessary to collect the image data of basketball shooting trajectory in advance and complete the visual acquisition of basketball shooting trajectory according to imaging technology [9].To represent the frame difference of the visual collection image of the basketball shooting track,wwas set; p represents discrete sampling probability, then the edge information of single frame basketball shooting track image in T time is Lx, and the calculation process is shown in formula.(1)Lx=l1x,l2x,…,lmxT.In the sampling process of imaging sequence, it is assumed thatq represents the high-frequency part of basketball shooting trajectory. In the imaging space, the binary image ρ of basketball shooting trajectory is obtained by using the spatial feature decomposition method, i.e.(2)ρ=Lxxc−y2+pwq,where, x and y represent the coordinates of image pixels and c represents image texture features. The texture data feature transmission model is built in the basketball shooting trajectory image, as shown in the formula(3)cx,y=∑iρRxi,yi−Rxi+p,yi+q2,where, p and q describe the spatial position distribution probability function of basketball shooting trajectory image; xi. yi describes the spatial coordinate points of basketball shooting trajectory; i represents the number of image pixels; R represents the foreground image. The pixel space is reconstructed according to formula (3), and scale decomposition and information data fusion operations are performed on the jumping action background image B and foreground image R, so as to obtain the basketball shooting track image distribution model [10], and then segment the basketball shooting track distribution module to obtain B/2×R/2 the submodule. Then, the image data acquisition results of the basketball shooting track are as follows:(4)x′=tcosϕcosφ,y′=tsinϕ,z′=−tcosϕsinφ,o′=ωysinγ+ωzcosε,where, x′,y′,z′,o′ represents the collected image data of basketball shooting trajectory respectively; ε represents fused image information; ϕ represents the included angle of trajectory points; t represents the distribution characteristic results of some information feature points of basketball shooting trajectory [11].


### 2.2. Image Pre-Processing of Basketball Shooting Trajectory

Since the basketball shooting track image will be disturbed by the outside world during the acquisition process, resulting in cracks and unevenness in the basketball shooting track image, this article uses the morphological method to preprocess the collected basketball shooting track image, including binary corrosion, binary expansion, closed operation, open operation, and other steps [12].


#### 2.2.1. Binary Corrosion

Corrosion and expansion are the two most basic mathematical morphology methods in morphological operation. All other morphological algorithms are based on the composite form of these two basic operations. Firstly, the corrosion of basketball shooting trajectory image is introduced. The main function of corrosion is to shrink the image on the basis of maintaining the edge contour of the original basketball shooting track image. This method can not only remove the impurities smaller than the structural elements in the basketball shooting track image, but also separate two objects with only a small connection [13].For a given basketball shooting track imageA and structural element B, the structural element B is used to corrode the binary basketball shooting track image A, which can be expressed by AΘB. The mathematical expression is defined as follows:(5)AΘB=z|Bz∈AIn the above formula, the structural elementB originally located at the origin of the basketball shooting track image is moved in the whole Z2 plane. If B can be completely included in A when the origin of B is translated to point Z.


#### 2.2.2. Binary Expansion

The algorithm corresponding to binary corrosion is binary expansion, and binary expansion is also one of the most basic morphological methods. The principle of expansion is to expand the binary image on the basis of maintaining the original basketball shooting track image through structural elements [14]. The main function of expansion is to fill the gaps or holes in the binary basketball shooting trajectory image. At the same time, the isolated noise points in the binary image can be eliminated by expansion operation.The structural elementB is used to expand the basketball shooting track image A, which is represented by A⊕B. The mathematical expression is defined as follows:(6)A⊕B=z|B′z∩A≠∅.Assuming that there is a structural elementB located at the original point of the basketball shooting track image, let B move on the Z2 plane in the whole basketball shooting track image. When its own origin is translated to point Z, B overlaps at least one pixel of its own origin mapping B′ and basketball shooting track image A, Then all such B points in the basketball shooting trajectory image form a set, which is called the expansion operation of B to A [15].


#### 2.2.3. Open Operation

If we want to smooth the object contour in the binary basketball shooting trajectory image, we can use the open operation of morphology [16]. Corrosion and expansion operations are not mutually inverse operations. In practical applications, corrosion and expansion operations often need to be combined to achieve the desired purpose. Then, the structural element is used to corrode the binary basketball shooting track image, and then the same structural element is used for the expansion operation. This method is called open operation [15].For the binary basketball shooting track imageA and structural element B, the mathematical representation method is A∘B and the specific expression is as follows:(7)A∘B=AΘB⊕B.


#### 2.2.4. Closed Operation

To eliminate the small cracks or holes in the binary basketball shooting trajectory image, the closed operation in morphology can be used. Closed operation can not only connect the disconnected adjacent targets in the binary basketball shooting trajectory image, but also smooth the contour in the basketball shooting trajectory image.The closed and open operations of morphology are dual operations. The operation process of closed operation is just opposite to that of open operation. This method first expands the binary basketball shooting track image and then corrodes the image [17]. The definition is as follows:(8)A•B=A⊕BΘB,where, B represents the structural element, A represents the image, A•B represents B, and the image A is closed.


### 2.3. Background Elimination of Basketball Shooting Trajectory Image Based on Background Difference Method

The background difference method is used to eliminate the background of the preprocessed basketball shooting track image, the pixel points are classified by using the gray difference of the corresponding pixel points between different frame images, and the average value of the classified pixel points is taken as the background pixel value. The background difference method does not need to establish a separate model for the background and target in the scene, but directly reconstructs the background model for the scene containing moving targets. Selecting appropriate parameters can effectively avoid the mixing phenomenon so as to achieve a robust background image [18].


#### 2.3.1. Pixel Classification

For the basketball shooting track image sequence, each pixel value of the frame basketball shooting track image was collected and it was obtained thatxim and m represent the value of the -th pixel in the i-th frame image. The m-th pixel value is calculated as follows:(9)pim,q=1,ifpim,q−1=0,xim−xjm≤T1,0,otherwise.First,pim,0 with an initial value of 0 is initialized. T1 determines whether the two pixel values are the threshold of the same class, and q is the mark of each class. If pim,q=1, the gray values of xim and xjm are similar, and it is judged to be the same class; otherwise, it is not the same kind.


#### 2.3.2. Determines the Background Pixel Value

Classs can be obtained by pixel classification, and the number of pixels contained in each class is recorded as l1,l2,…,ls, then:(10)∑p=1sls=N.The number of pixels of classq and the corresponding average gray values are:(11)Iqm=∑i=1Npqm,q,rqm=∑i=1Nximpim,qlqm,where, rqm is the average gray value of all classes determined. Suppose class q is the background class, then there is Iqm=maxl1,l2,…,ls.Through the above steps, the background image can be reconstructed from the image sequence with basketball shooting track.Since the background will be affected by the sudden change of light and the stopping of moving objects in the background, the background is not static. The background image is always subtracted from the current frame. It is found that the effect is not ideal, so it is necessary to update the background. At present, the commonly used background updates are: real-time background update and regular update. Real time background update can meet the slow changing environment of light, while regular update can meet the sudden change of light and the change of background structure.Real time background update: the pixel value of a point in the current frame with the background pixel value of the previous frame is compared to determine whether to update the background pixel. The calculation formula is:(12)Bim=Bim∗A+Bi−1m∗1−a,ifxim−Bi−1m≤T2,Bi−1m,otherwise,Where, T2 is the threshold for judging whether to update, xim is the pixel value of point m in the previous i frame, Bi−1m is the background pixel value of point m in the previous frame, a is the learning rate. The closer a is to 0, the slower the background update speed is, and the closer h is to 1, the faster the background update speed is.


### 2.4. Edge Contour Feature Extraction of Basketball Shooting Trajectory Image

Edge contour feature extraction on the above obtained target image is carried out, the image fusion model of basketball player’s shooting trajectory is established, the state vectorxt of basketball shooting action feature is extracted and located, one-step or n-step prediction on the basketball shooting action image with k1 and k2 as the optimization coefficients is made, the feature quantity of basketball shooting action at time k is calculated, and the quantitative coding method is adopted. The output pixel feature quantity is mjj=1,2,…,m∀mj∈M and the scale decomposition is carried out according to the sample similarity. Under the constraint of scale coefficient α, the likelihood function Wk of the edge contour distribution of basketball player shooting image is expressed as:(13)Wk=Ncx,yαk1mjBimQkk2,where, Qk is the gray vector information covariance of basketball player’s shooting image. Combined with the gray pixel feature extraction method, the edge contour feature of basketball shooting track image is extracted and the fuzzy correlation feature component a,b,c,d of basketball player shooting motion image is expressed as:(14)a=f1−u,b=f2−u,c=f3−u,d=u.Among them,u is the distribution scale of the contour curve, and the statistical shape models of basketball players' shooting images are f1,f2,f3 respectively.


### 2.5. Automatic Capture of Basketball Shooting Trajectory

According to the edge contour features of the basketball shooting track image extracted above, the basketball shooting track is automatically captured. The candidate target area is set, a diagonal matrix that can reflect the length and width of the track target is introduced, and the probability of the area color in the shooting track is calculated, so as to characterize the change of the track target size in two directions and realize the automatic capture of the basketball shooting track.Suppose thatrt represents the point set of the basketball arm shooting trajectory in the image, and the regional coordinates have been adjusted to take 0 as the center and have been normalized according to the regional size lx,ly. The function mis set for each pixel value xi and mxi is the pixel color value. Through epanechnikov kernel, the occurrence probability of area color e in shooting trajectory can be expressed as:(15)SA=Z∑i=1nrtδmxi−eSi,jWk.In (15), Z represents the normalization function and δ represents the Kronecker function.It is assumed that the candidate trajectory target isrt with y as the center. The probability expression of area color e in shooting trajectory can be expressed as:(16)puy=Zi∑i=1nhK−1y−xi2eSASi,j,where Zi represents the normalization factor and K represents the diagonal matrix, and its expression is:(17)K=puyl12,l22where l1 and l2 represent the length and width of the trajectory respectively.According to the above calculation and analysis, the similarity between the trajectory target and the candidate target is described by the Babbitt distance coefficient. The expression of Babbitt distance coefficient is shown in (18), and the distance between them is shown in (19):(18)ρy=∑u=1mρy⋅qu,(19)dy=1−ρpuy,q.The larger the coefficient value, the smaller the distance value, that is, the higher the similarity between the trajectory target and the candidate target.To sum up, the automatic capture of basketball shooting trajectory is to retrieve the new position corresponding to the target in the current frame, which can minimize the distance value withy as the independent variable. The retrieval starts from the target of the previous frame and queries in its neighborhood. Assuming that the target position in the previous frame is y0, ρpuy,q at the target prediction position y0 of the shooting track is expanded and the obtained linear approximation of ρpuy,q can be expressed as:(20)ρpuy,q≈12∑u=1mpuy0⋅qu+12∑u=1mpuyqupuy0.Substituting (16) into (20) can obtain:(21)ρpy,q≈12∑u=1mpuy0⋅qu+CH2∑i=1nhwiK−1y−xi2.In (21), wi represents the weighted value. According to (21), the maximum value of this density evaluation within the neighborhood can be retrieved according to mean shift. In the whole process, the core moves from the current position y0 to the new position y1:(22)y1=∑i=1nhxiwiK−1y−xi2∑i=1nhwiK−1y−xi2ρpy,q.By iterating the above process and constantly updating the shooting track target, the automatic capture result of basketball shooting track can be defined as:(23)Y=y0,y1,…,yn0In (23), Y represents the set of track pixels.


## 2.1. Image Acquisition of Basketball Shooting Trajectory

In order to better complete the automatic capture of basketball shooting trajectory, it is necessary to collect the image data of basketball shooting trajectory in advance and complete the visual acquisition of basketball shooting trajectory according to imaging technology [9].To represent the frame difference of the visual collection image of the basketball shooting track,wwas set; p represents discrete sampling probability, then the edge information of single frame basketball shooting track image in T time is Lx, and the calculation process is shown in formula.(1)Lx=l1x,l2x,…,lmxT.In the sampling process of imaging sequence, it is assumed thatq represents the high-frequency part of basketball shooting trajectory. In the imaging space, the binary image ρ of basketball shooting trajectory is obtained by using the spatial feature decomposition method, i.e.(2)ρ=Lxxc−y2+pwq,where, x and y represent the coordinates of image pixels and c represents image texture features. The texture data feature transmission model is built in the basketball shooting trajectory image, as shown in the formula(3)cx,y=∑iρRxi,yi−Rxi+p,yi+q2,where, p and q describe the spatial position distribution probability function of basketball shooting trajectory image; xi. yi describes the spatial coordinate points of basketball shooting trajectory; i represents the number of image pixels; R represents the foreground image. The pixel space is reconstructed according to formula (3), and scale decomposition and information data fusion operations are performed on the jumping action background image B and foreground image R, so as to obtain the basketball shooting track image distribution model [10], and then segment the basketball shooting track distribution module to obtain B/2×R/2 the submodule. Then, the image data acquisition results of the basketball shooting track are as follows:(4)x′=tcosϕcosφ,y′=tsinϕ,z′=−tcosϕsinφ,o′=ωysinγ+ωzcosε,where, x′,y′,z′,o′ represents the collected image data of basketball shooting trajectory respectively; ε represents fused image information; ϕ represents the included angle of trajectory points; t represents the distribution characteristic results of some information feature points of basketball shooting trajectory [11].


## 2.2. Image Pre-Processing of Basketball Shooting Trajectory

Since the basketball shooting track image will be disturbed by the outside world during the acquisition process, resulting in cracks and unevenness in the basketball shooting track image, this article uses the morphological method to preprocess the collected basketball shooting track image, including binary corrosion, binary expansion, closed operation, open operation, and other steps [12].


### 2.2.1. Binary Corrosion

Corrosion and expansion are the two most basic mathematical morphology methods in morphological operation. All other morphological algorithms are based on the composite form of these two basic operations. Firstly, the corrosion of basketball shooting trajectory image is introduced. The main function of corrosion is to shrink the image on the basis of maintaining the edge contour of the original basketball shooting track image. This method can not only remove the impurities smaller than the structural elements in the basketball shooting track image, but also separate two objects with only a small connection [13].For a given basketball shooting track imageA and structural element B, the structural element B is used to corrode the binary basketball shooting track image A, which can be expressed by AΘB. The mathematical expression is defined as follows:(5)AΘB=z|Bz∈AIn the above formula, the structural elementB originally located at the origin of the basketball shooting track image is moved in the whole Z2 plane. If B can be completely included in A when the origin of B is translated to point Z.


### 2.2.2. Binary Expansion

The algorithm corresponding to binary corrosion is binary expansion, and binary expansion is also one of the most basic morphological methods. The principle of expansion is to expand the binary image on the basis of maintaining the original basketball shooting track image through structural elements [14]. The main function of expansion is to fill the gaps or holes in the binary basketball shooting trajectory image. At the same time, the isolated noise points in the binary image can be eliminated by expansion operation.The structural elementB is used to expand the basketball shooting track image A, which is represented by A⊕B. The mathematical expression is defined as follows:(6)A⊕B=z|B′z∩A≠∅.Assuming that there is a structural elementB located at the original point of the basketball shooting track image, let B move on the Z2 plane in the whole basketball shooting track image. When its own origin is translated to point Z, B overlaps at least one pixel of its own origin mapping B′ and basketball shooting track image A, Then all such B points in the basketball shooting trajectory image form a set, which is called the expansion operation of B to A [15].


### 2.2.3. Open Operation

If we want to smooth the object contour in the binary basketball shooting trajectory image, we can use the open operation of morphology [16]. Corrosion and expansion operations are not mutually inverse operations. In practical applications, corrosion and expansion operations often need to be combined to achieve the desired purpose. Then, the structural element is used to corrode the binary basketball shooting track image, and then the same structural element is used for the expansion operation. This method is called open operation [15].For the binary basketball shooting track imageA and structural element B, the mathematical representation method is A∘B and the specific expression is as follows:(7)A∘B=AΘB⊕B.


### 2.2.4. Closed Operation

To eliminate the small cracks or holes in the binary basketball shooting trajectory image, the closed operation in morphology can be used. Closed operation can not only connect the disconnected adjacent targets in the binary basketball shooting trajectory image, but also smooth the contour in the basketball shooting trajectory image.The closed and open operations of morphology are dual operations. The operation process of closed operation is just opposite to that of open operation. This method first expands the binary basketball shooting track image and then corrodes the image [17]. The definition is as follows:(8)A•B=A⊕BΘB,where, B represents the structural element, A represents the image, A•B represents B, and the image A is closed.


## 2.2.1. Binary Corrosion

Corrosion and expansion are the two most basic mathematical morphology methods in morphological operation. All other morphological algorithms are based on the composite form of these two basic operations. Firstly, the corrosion of basketball shooting trajectory image is introduced. The main function of corrosion is to shrink the image on the basis of maintaining the edge contour of the original basketball shooting track image. This method can not only remove the impurities smaller than the structural elements in the basketball shooting track image, but also separate two objects with only a small connection [13].For a given basketball shooting track imageA and structural element B, the structural element B is used to corrode the binary basketball shooting track image A, which can be expressed by AΘB. The mathematical expression is defined as follows:(5)AΘB=z|Bz∈AIn the above formula, the structural elementB originally located at the origin of the basketball shooting track image is moved in the whole Z2 plane. If B can be completely included in A when the origin of B is translated to point Z.


## 2.2.2. Binary Expansion

The algorithm corresponding to binary corrosion is binary expansion, and binary expansion is also one of the most basic morphological methods. The principle of expansion is to expand the binary image on the basis of maintaining the original basketball shooting track image through structural elements [14]. The main function of expansion is to fill the gaps or holes in the binary basketball shooting trajectory image. At the same time, the isolated noise points in the binary image can be eliminated by expansion operation.The structural elementB is used to expand the basketball shooting track image A, which is represented by A⊕B. The mathematical expression is defined as follows:(6)A⊕B=z|B′z∩A≠∅.Assuming that there is a structural elementB located at the original point of the basketball shooting track image, let B move on the Z2 plane in the whole basketball shooting track image. When its own origin is translated to point Z, B overlaps at least one pixel of its own origin mapping B′ and basketball shooting track image A, Then all such B points in the basketball shooting trajectory image form a set, which is called the expansion operation of B to A [15].


## 2.2.3. Open Operation

If we want to smooth the object contour in the binary basketball shooting trajectory image, we can use the open operation of morphology [16]. Corrosion and expansion operations are not mutually inverse operations. In practical applications, corrosion and expansion operations often need to be combined to achieve the desired purpose. Then, the structural element is used to corrode the binary basketball shooting track image, and then the same structural element is used for the expansion operation. This method is called open operation [15].For the binary basketball shooting track imageA and structural element B, the mathematical representation method is A∘B and the specific expression is as follows:(7)A∘B=AΘB⊕B.


## 2.2.4. Closed Operation

To eliminate the small cracks or holes in the binary basketball shooting trajectory image, the closed operation in morphology can be used. Closed operation can not only connect the disconnected adjacent targets in the binary basketball shooting trajectory image, but also smooth the contour in the basketball shooting trajectory image.The closed and open operations of morphology are dual operations. The operation process of closed operation is just opposite to that of open operation. This method first expands the binary basketball shooting track image and then corrodes the image [17]. The definition is as follows:(8)A•B=A⊕BΘB,where, B represents the structural element, A represents the image, A•B represents B, and the image A is closed.


## 2.3. Background Elimination of Basketball Shooting Trajectory Image Based on Background Difference Method

The background difference method is used to eliminate the background of the preprocessed basketball shooting track image, the pixel points are classified by using the gray difference of the corresponding pixel points between different frame images, and the average value of the classified pixel points is taken as the background pixel value. The background difference method does not need to establish a separate model for the background and target in the scene, but directly reconstructs the background model for the scene containing moving targets. Selecting appropriate parameters can effectively avoid the mixing phenomenon so as to achieve a robust background image [18].


### 2.3.1. Pixel Classification

For the basketball shooting track image sequence, each pixel value of the frame basketball shooting track image was collected and it was obtained thatxim and m represent the value of the -th pixel in the i-th frame image. The m-th pixel value is calculated as follows:(9)pim,q=1,ifpim,q−1=0,xim−xjm≤T1,0,otherwise.First,pim,0 with an initial value of 0 is initialized. T1 determines whether the two pixel values are the threshold of the same class, and q is the mark of each class. If pim,q=1, the gray values of xim and xjm are similar, and it is judged to be the same class; otherwise, it is not the same kind.


### 2.3.2. Determines the Background Pixel Value

Classs can be obtained by pixel classification, and the number of pixels contained in each class is recorded as l1,l2,…,ls, then:(10)∑p=1sls=N.The number of pixels of classq and the corresponding average gray values are:(11)Iqm=∑i=1Npqm,q,rqm=∑i=1Nximpim,qlqm,where, rqm is the average gray value of all classes determined. Suppose class q is the background class, then there is Iqm=maxl1,l2,…,ls.Through the above steps, the background image can be reconstructed from the image sequence with basketball shooting track.Since the background will be affected by the sudden change of light and the stopping of moving objects in the background, the background is not static. The background image is always subtracted from the current frame. It is found that the effect is not ideal, so it is necessary to update the background. At present, the commonly used background updates are: real-time background update and regular update. Real time background update can meet the slow changing environment of light, while regular update can meet the sudden change of light and the change of background structure.Real time background update: the pixel value of a point in the current frame with the background pixel value of the previous frame is compared to determine whether to update the background pixel. The calculation formula is:(12)Bim=Bim∗A+Bi−1m∗1−a,ifxim−Bi−1m≤T2,Bi−1m,otherwise,Where, T2 is the threshold for judging whether to update, xim is the pixel value of point m in the previous i frame, Bi−1m is the background pixel value of point m in the previous frame, a is the learning rate. The closer a is to 0, the slower the background update speed is, and the closer h is to 1, the faster the background update speed is.


## 2.3.1. Pixel Classification

For the basketball shooting track image sequence, each pixel value of the frame basketball shooting track image was collected and it was obtained thatxim and m represent the value of the -th pixel in the i-th frame image. The m-th pixel value is calculated as follows:(9)pim,q=1,ifpim,q−1=0,xim−xjm≤T1,0,otherwise.First,pim,0 with an initial value of 0 is initialized. T1 determines whether the two pixel values are the threshold of the same class, and q is the mark of each class. If pim,q=1, the gray values of xim and xjm are similar, and it is judged to be the same class; otherwise, it is not the same kind.


## 2.3.2. Determines the Background Pixel Value

Classs can be obtained by pixel classification, and the number of pixels contained in each class is recorded as l1,l2,…,ls, then:(10)∑p=1sls=N.The number of pixels of classq and the corresponding average gray values are:(11)Iqm=∑i=1Npqm,q,rqm=∑i=1Nximpim,qlqm,where, rqm is the average gray value of all classes determined. Suppose class q is the background class, then there is Iqm=maxl1,l2,…,ls.Through the above steps, the background image can be reconstructed from the image sequence with basketball shooting track.Since the background will be affected by the sudden change of light and the stopping of moving objects in the background, the background is not static. The background image is always subtracted from the current frame. It is found that the effect is not ideal, so it is necessary to update the background. At present, the commonly used background updates are: real-time background update and regular update. Real time background update can meet the slow changing environment of light, while regular update can meet the sudden change of light and the change of background structure.Real time background update: the pixel value of a point in the current frame with the background pixel value of the previous frame is compared to determine whether to update the background pixel. The calculation formula is:(12)Bim=Bim∗A+Bi−1m∗1−a,ifxim−Bi−1m≤T2,Bi−1m,otherwise,Where, T2 is the threshold for judging whether to update, xim is the pixel value of point m in the previous i frame, Bi−1m is the background pixel value of point m in the previous frame, a is the learning rate. The closer a is to 0, the slower the background update speed is, and the closer h is to 1, the faster the background update speed is.


## 2.4. Edge Contour Feature Extraction of Basketball Shooting Trajectory Image

Edge contour feature extraction on the above obtained target image is carried out, the image fusion model of basketball player’s shooting trajectory is established, the state vectorxt of basketball shooting action feature is extracted and located, one-step or n-step prediction on the basketball shooting action image with k1 and k2 as the optimization coefficients is made, the feature quantity of basketball shooting action at time k is calculated, and the quantitative coding method is adopted. The output pixel feature quantity is mjj=1,2,…,m∀mj∈M and the scale decomposition is carried out according to the sample similarity. Under the constraint of scale coefficient α, the likelihood function Wk of the edge contour distribution of basketball player shooting image is expressed as:(13)Wk=Ncx,yαk1mjBimQkk2,where, Qk is the gray vector information covariance of basketball player’s shooting image. Combined with the gray pixel feature extraction method, the edge contour feature of basketball shooting track image is extracted and the fuzzy correlation feature component a,b,c,d of basketball player shooting motion image is expressed as:(14)a=f1−u,b=f2−u,c=f3−u,d=u.Among them,u is the distribution scale of the contour curve, and the statistical shape models of basketball players' shooting images are f1,f2,f3 respectively.


## 2.5. Automatic Capture of Basketball Shooting Trajectory

According to the edge contour features of the basketball shooting track image extracted above, the basketball shooting track is automatically captured. The candidate target area is set, a diagonal matrix that can reflect the length and width of the track target is introduced, and the probability of the area color in the shooting track is calculated, so as to characterize the change of the track target size in two directions and realize the automatic capture of the basketball shooting track.Suppose thatrt represents the point set of the basketball arm shooting trajectory in the image, and the regional coordinates have been adjusted to take 0 as the center and have been normalized according to the regional size lx,ly. The function mis set for each pixel value xi and mxi is the pixel color value. Through epanechnikov kernel, the occurrence probability of area color e in shooting trajectory can be expressed as:(15)SA=Z∑i=1nrtδmxi−eSi,jWk.In (15), Z represents the normalization function and δ represents the Kronecker function.It is assumed that the candidate trajectory target isrt with y as the center. The probability expression of area color e in shooting trajectory can be expressed as:(16)puy=Zi∑i=1nhK−1y−xi2eSASi,j,where Zi represents the normalization factor and K represents the diagonal matrix, and its expression is:(17)K=puyl12,l22where l1 and l2 represent the length and width of the trajectory respectively.According to the above calculation and analysis, the similarity between the trajectory target and the candidate target is described by the Babbitt distance coefficient. The expression of Babbitt distance coefficient is shown in (18), and the distance between them is shown in (19):(18)ρy=∑u=1mρy⋅qu,(19)dy=1−ρpuy,q.The larger the coefficient value, the smaller the distance value, that is, the higher the similarity between the trajectory target and the candidate target.To sum up, the automatic capture of basketball shooting trajectory is to retrieve the new position corresponding to the target in the current frame, which can minimize the distance value withy as the independent variable. The retrieval starts from the target of the previous frame and queries in its neighborhood. Assuming that the target position in the previous frame is y0, ρpuy,q at the target prediction position y0 of the shooting track is expanded and the obtained linear approximation of ρpuy,q can be expressed as:(20)ρpuy,q≈12∑u=1mpuy0⋅qu+12∑u=1mpuyqupuy0.Substituting (16) into (20) can obtain:(21)ρpy,q≈12∑u=1mpuy0⋅qu+CH2∑i=1nhwiK−1y−xi2.In (21), wi represents the weighted value. According to (21), the maximum value of this density evaluation within the neighborhood can be retrieved according to mean shift. In the whole process, the core moves from the current position y0 to the new position y1:(22)y1=∑i=1nhxiwiK−1y−xi2∑i=1nhwiK−1y−xi2ρpy,q.By iterating the above process and constantly updating the shooting track target, the automatic capture result of basketball shooting track can be defined as:(23)Y=y0,y1,…,yn0In (23), Y represents the set of track pixels.


## 3. Simulation Experiment Analysis

To verify the effectiveness of the basketball shooting trajectory automatic capture algorithm based on background elimination in practical application, a simulation experiment is carried out. The hardware and software operating environment selected for the experiment are shown in Tables1 and 2.Table 1
Experimental hardware and software environment.
Operating systemR&D softwareWindows Win10Microsoft visual studio 2010OpenCV3.4LIBSVM-3.21UbuntuGCC andG++OpenCV3.4Table 2
PC related parameters.
CPUIntel Pentium dual core T4500Dominant frequency2.3 GHzMemory4.00 GUSB interface4.0In this article, male and female basketball players are selected as the experimental objects to shoot respectively, and the automatic capture algorithm of basketball shooting trajectory based on background elimination proposed in this article. The human motion space trajectory tracking algorithm based on inertial sensor proposed in literature [5] and the algorithm of determining object position and predicting motion trajectory based on binocular vision proposed in literature [6] are adopted and the automatic capture algorithm of basketball shooting trajectory is carried out. The details of male and female basketball players are shown in Table 3.Table 3
Details of male and female basketball players.
ProjectDetailsNumber of male athletes/person50Number of female athletes/person50Height range of male athletes/cm177–192Height range of female athletes/cm173–187Weight range of male athletes/kg67–83Weight range of female athletes/kg54–73For the sample number of basketball players’ shooting motion images, 1200 groups of images are selected as the test set in the basketball players’ shooting motion auxiliary training system. The test sample set size of basketball players’ shooting motion images is 800, the training sample set is 120, the video feature sampling time of basketball shooting motion features isT=0.04s, and the image gray average value is Δ=2.5. The image edge contour detection coefficient is 0.67. According to the above simulation environment and parameter settings, the basketball player’s shooting trajectory is extracted. The original player’s shooting motion image is shown in Figure 1.Figure 1
Original shooting image of athletes.The morphological method is used to preprocess the collected basketball shooting trajectory image, and the binary image is obtained, as shown in Figure2.Figure 2
Image processing results.According to the analysis of Figure2, the basketball shooting trajectory automatic capture algorithm based on background elimination proposed in this study can effectively and accurately process the basketball shooting trajectory.To verify the effectiveness of this algorithm, the automatic capture algorithm of basketball shooting trajectory based on background elimination proposed in this article, the human motion space trajectory tracking algorithm based on inertial sensor proposed in literature [5] and the algorithm of determining object position and predicting motion trajectory based on binocular vision proposed in literature [6] are used to compare and analyze the automatic capture accuracy of basketball shooting trajectory, The comparison results are shown in Figure 3.Figure 3
Comparison results of automatic capture accuracy of basketball shooting trajectory with different algorithms.According to Figure3, the accuracy of basketball shooting trajectory automatic capture algorithm based on background elimination proposed in this article can reach 100%, while the accuracy of basketball shooting trajectory automatic capture algorithm based on inertial sensor proposed in literature [5] is only 86%, and in literature [6], the proposed algorithm of determining object position and predicting motion trajectory based on binocular vision has the highest accuracy of only 80%. The automatic basketball shooting trajectory capture algorithm based on background elimination proposed in this article has the highest accuracy and the best trajectory capture effect.To further verify the effectiveness of this algorithm, the automatic capture algorithm of basketball shooting trajectory based on background elimination proposed in this article, the human motion space trajectory tracking algorithm based on inertial sensor proposed in literature [5] and the algorithm of determining object position and predicting motion trajectory based on binocular vision proposed in literature [6] are adopted. The automatic capture time of basketball shooting trajectory is compared and analyzed, and the comparison results are shown in Table 4.Table 4
Comparison results of automatic capture time of basketball shooting trajectory of three algorithms/s.
Number of experiments/timePaper algorithmLiterature [5] algorithmLiterature [6] algorithm108.1215.1218.22208.2215.3618.63308.3015.9919.10408.4216.9519.11508.5117.2219.89608.6617.8820.25708.7018.2223.42808.7218.5523.85908.8319.2224.561008.9220.0025.58According to the data in Table4, the time consumed by the automatic basketball shooting trajectory capture algorithm based on background elimination proposed in this article for automatic basketball shooting trajectory capture is within 8.92 s, and the time consumed by the human motion space trajectory tracking algorithm based on inertial sensor proposed in [5] for automatic basketball shooting trajectory capture is within 20.00 s, and in [6], the time consumed by the proposed algorithm of determining object position and predicting motion trajectory based on binocular vision for automatic capture of basketball shooting trajectory is within 25.58 s. The time consumed by the automatic capture algorithm of basketball shooting trajectory based on background elimination is the shortest and the efficiency of automatic capture of basketball shooting trajectory is the highest.


## 4. Conclusion

In China, as the level of computer science and technology continues to improve, subjects such as target image tracking and human dynamics have enabled the analysis and collection of basketball shooting action characteristic data, which has become a core subject of contemporary sports and computer application disciplines. The number of shooting scores determines the outcome of a shooting game. It is critical to master shooting technology and to constantly improve one’s shooting percentage in the game. However, based on incomplete statistics, there are obvious differences in shooting ability between foreign excellent players and Chinese players, particularly a group of excellent players led by Kobe Bryant and Michael Jordan, whose hand hip following action is very obvious, whereas domestic basketball players’ hand hip following action is subtle or nonexistent. In this case, tracking the basketball shooting trajectory and accurately correcting shooting deviation has become a significant impediment to the development of domestic basketball technology, attracting the attention of numerous experts and scholars. With the rapid development of basketball, and subsequent shooting of players during competition, motion capture of basketball trajectory has presented numerous challenges due to the uniqueness of its motion characteristics. The trajectory is frequently incomplete during the capture process, resulting in the low capture accuracy of basketball shooting trajectory. As a result, this article proposes an automatic basketball shooting trajectory capture algorithm based on background elimination. This algorithm can significantly improve the accuracy of trajectory capture. Following its widespread adoption and application, it has been shown to significantly improve the trajectory capture effect in basketball.



---

*Source: 7884528-2022-05-17.xml*