A New Dataset method for Biomechanical Training Model of the Free Throws Shots in Basketball Using Image Processing Technique

This work provides a new dataset method intended to build a biomechanical training model for the free-throws shots in basketball. Eight youth players from Jordanian secondary public school were video recorded from the sagittal plane executing free throw shots in basketball. Collectively (480) video clips were recorded and analyzed using image processing techniques to identify the ball track. Video processing involves extracting (11) different parameters that may affect the free throw in basketball game after detecting the ball trajectory. Creation of this dataset and its subsequent use for extracting free-throws information yielded several insights. First, a set of most important features were identified as those affecting the free-throws score in basketball. Second, our data set can be trained and tested using machine learning classifiers for building a new biomechanical training model based on set of rules that can be useful for both trainers and trainee to rehearse on successful free-throws in basketball. The dataset is being made publicly available at www.ju.edu.jo.


Introduction
Basketball is one of the most important sports in the world.Coaches face many problems related to access to the best technical performance of motor skills in athletes' sports.The use of kinematic analysis methods for these different skills is based on interpreting and dividing skills and comparing them with the ideal performance to correct mistakes, achieve high and optimal motor skill and avoid injuries during practice.(Kilani & Odtallah, 2008) Kinematic analysis is also an essential knowledge of effective basketball skills training.(Kilani, Slim, & Al-Kilani, 2009).It adds to the coaches a correct background to help them to display the skill and movement correctly and know the technical points that must be focused in the training of basketball skills.(Eslim, AlKilani, & Kilani, 2010) Studies in modeling and simulation were designed to determine the optimum in many motor skills, including the skill of free throw in basketball.(Okazaki, Rodacki, & Satern, 2015;Kilani, & Abu Eisheh, 2010;Al-Kilani, & Kilani, 1993) and the effect of shooting distance on energy flow in basketball jump shot was also conducted by Nakano, Fukashiro, & Yoshioka, (2018).
The significant of free shooting strategies in the basketball games are mainly affected by several variables.Thus, the tracking of ball provides useful information for providing the tactics and effective training strategies (Perše, Kristan, Kovačič, Vučkovič & Perš, 2009).In (Liu et al, 2011) they proposed a shot identification technique in basketball video based on ball tracking.They used mean-shift algorithm for ball tracking and Kalman filter and the hoop was identified using SURF (Speeded Up Robust Features).In (Chakraborty & Meher, 2013) work, they successfully applied a trajectory-based approach to detect and track the ball in basketball videos.(Fu & et al., 2011) provided throwing location estimation using the ball trajectory in a basketball game.They extracted 2-D trajectories based on physics-based algorithm to track the ball and then; they developed the 3-D trajectories based on their previous work.
Another study based on observation was conducted by (Del Piano & Leigh, 2013).They recorded video footages for basketball players to provide observations and appropriate modifications based on mechanical research through video analysis.After three days of training, analysis and observations, the players made appropriate adjustments to the free-throw attempts and were re-evaluated in order to draw conclusions and make recommendations based on video notes.The study found that when the player tries to throw the free shoot and does not bend properly in the joints of the hip, knee and ankle, the track of the throw will be less stable than the player who bends in those joints correctly.The video analysis improves the rate of successful free throw based on dynamic adjustments (increased flexion and full stretch).Kumar, (2016) study revealed that there is no significant relationship at the level of significance(α<=0.05) for all the mechanical variables related to the angle of left and right ankle joints, the knee joint (left and right), the shoulder joint (right and left) and the hip joint (left and right) with the performance of the basketball players performing free throw, or in the case of linear mechanical variables, which is the height of the center of gravity at the moment of throwing .However, Image processing techniques have supported many applications in various fields.These applications have been used to improve mathematical skills through modeling and simulation for effective individual and group training using artificial intelligence.For example, these techniques have been used to design a system that simulates training methods in the basketball game and to determine the course of clean balls in the National Basketball Association (NBA), for the popularity and spread of this game in all countries of the world.
These applications have been exploited image processing techniques to analysis basketball videos and extract several variables, such as the throwing angle and initial ball velocity.Such algorithms may able to track and correctly identify the ball in the video clips and reduce the rate of tracking error.The ball path trajectory which is based on the angle of the shot, the velocity of the shot and the average of shifts in the position of the ball can assess to implement the simulation.However, other factors such as air friction and rapid turnover should be considered.(Chakraborty & Meher, 2013).
The optimum projectile of the free throw in basketball aims to develop a physical model that provides a pathway to determine the optimal release of the free throw in basketball.Several simulation techniques, such as simulation of Monte Carlo program can accurately predict the success of the throws within a specific area associated with a particular angle and velocity, which varies from one player to another (Chen, 2017).
Many previous studies have tried to build traditional models that mimic the successful throwing in basketball or the ideal moves that the player should make for successful throwing (Okazaki, Rodacki, & Satern, 2015).These attempts were made with the method of observing and trying to imitate without controlling all the possible variables that can affect the performance of the free throw.These models may be valid in the environment in which the experiments were conducted and do not consider the variation in the performance mode from one player to another (Sarang et al, 2018).As a result of the rapid technology and development in the science of image processing and artificial intelligence, this knowledge has been exploited in the production of computer models that simulate the game of basketball in a form of video games or recorded clips.These models are codified to a certain category and sometimes to stand-alone teams and have not been circulated worldwide to help all players of the basketball game performing successful free throws (Lo & Puchalski, 2008).
There is a clear weakness in the long and close scoring of the basketball players of high school students in Jordanian public schools.A pilot study was conducted to examine student's ability to perform successful and clean shots.In this study, 8 youth players divided into three height categories (short, medium, tall) were asked to perform 10 scoring trials from behind the free throw line and 10 of the three-point line.The results indicated the weakness of the experimental sample of the three categories.The percentage of successful free shoots was (32%), including (8%) clean shoots only, and the percentage of free throws of three-point line was (50.2%), and including (35%) clean shots only.(Saraireh & Kilani, 2018) Based on this result, the problem of the study stems from the absence of publicly available dataset that comprised all information and features related to successful free throwing to be trained and tested by machine learning algorithms.This dataset can be then modeled in a computer-based form to simulate the free throw to be used in the training of youth players.Therefore, this study comes to employ artificial intelligence and machine learning algorithms to build a biomechanical model for the training process of basketball game.
In this sense, this study aims to implement artificial intelligence techniques and machine learning algorithms, such as the REPTree algorithm and the Random Tree algorithm to create a new dataset that can be used to build a biomechanical model that facilitates the task of trainers and trainees by training on a set of rules that lead to successful shoots with a high accuracy level.

Method
The aim of this paper is to create a new dataset for the free throwing in basketball game; this dataset model is based on video imaging a group of basketball players performing the free throw several times for each player, for each video we used digital image processing/analysis techniques to track the ball to be able extract some useful information which are vital for scoring.Therefore, the creation of this dataset model is vital to extract the parameters/variables, which are useful to score in the basketball free throw, this is important for basketball trainers and trainees.Figure 1 shows the flowchart of the steps of the creation of our dataset model.

Video Capturing
In order to record videos, eight players (aging from 14-17 years and their height ranging from 166-182 cm) from secondary public schools were asked to perform free shoots.The total number of the video recorded for the purpose of this study was 379.Thirty one of these videos are corrupted and therefore removed from the database and our calculations, the reasons for these corrupted videos were: 1-Highest altitude of the ball was outside (above) the screen (frame) 2-Initial ball is in the middle due to late imaging of the videos 3-Missing frames: These might by due to software and hardware error in the imaging system.
-Two Flashlights with 10/10 light, 2 meters away on the right and left of the camera.

Ball Tracking
We painted the basketball in blue and used a black curtain to cover the background of the scene so as to increase the accuracy of finding the rightful track of the ball after throwing it; we tried as possible to avoid blue color in the scene.We used MatLab 2017 to program the ball tracking and information extraction as well.The code opens all the recorded videos and opens each frame for each video to do ball tracking.
Since the color of the basketball is blue, in Red, Green, Blue (RGB) color model the B channel has a large value, while the R and G channels have smaller values; therefore, we opt for a global fixed threshold to binarize the frames, this thresholding technique is chosen empirically and worked well for all videos, so for each pixel in each video frame we decided the ball pixel as follow To avoid the blue floor and bouncing the ball, we eliminated all balls/blue-objects in the bottom third of the frame, the bottom third of the frame is about one-meter, hence we assumed that there is no throw from a one-meter height, as all the players are taller than that.We also eliminated all balls/blue-objects located at the rightmost fifth of the frame, assuming that this zone is beyond the basketball ring and therefore balls there should not be counted as part of a rightful track.By applying equation 1 for each frame for each video we get frames containing the ball pixels only (ones), and all other objects are removed (zeros), and by targeting the center of these pixels (those with one values) we can determine the ball location in each frame/video.
Sometimes there are undesired locations of the ball, such as catching the ball by the player for long time, bouncing the ball higher than one meter and the reflected balls from the board or the ring, all these ball (in such situations) should be eliminated in order to get the rightful track of the ball that holds the useful information that we are after.
Assuming that the ball is moving from left to right in all videos with a some speed in the x direction, this assumption helped us to eliminate the wrong balls, since we know all the locations (x, y)-co-ordinates of the balls, we opt for calculating the x-axes derivative for all the (x, y) points, if the difference is less than 30 this means that the ball is not moving or moving from right to left, or vertically (bouncing), therefore it should be eliminated and removed from the track, however the chosen threshold ( 30)is large as the speed of the ball is less than average, therefore, we opt for reducing this threshold dynamically if the number of the remaining balls is small (15 balls) in our case.
Figure 2. The correct (blue circles) track of the segmented balls

Information Extraction
After determining the correct track of the ball several related information become available for extraction, these include: 1.The release angles; 2. The landing angle; 3. The highest altitude of the ball; 4. The horizontal distance between the last ball and the highest ball; 5. The angle between the first ball and the highest ball; 6.The angle between the last ball and the highest ball; 7. The distance of the furthest ball from the chord of the track; 8. Initial Velocity of the ball; 9. Horizontal Velocity of the ball; 10. Final Velocity of the ball; 11.Other information which are known previously and stored in the videos' names such as the gender and height of the player, in addition to whether the free throw was a score or not. Figure 4 shows all this information.
Figure 3.The extracted information

The Throw Angle
This angle is calculated based on finding the slope of the straight line between the first and second balls; number 1 in Figure 4. Since we know the x and y coordinates of both balls we can calculate the throw angle using where x2 and x1 are the x coordinates of the first and the second balls respectively, and y2 and y1 are the y coordinates of the first and the second balls respectively.

The Landing Angle
Calculating this angle is similar to the throw angle, however it uses the slope of the straight line between the last ball (on the ring) and its preceding ball.Obviously, and because the players threw the balls from left to right the throw angle is positive, while the landing angle is negative.

The Highest Altitude of the Ball
By looping over all the points, it is easy to find the ball with the highest altitude (y-value).It is worth mentioning that the original point in digital images is normally located at the top-left corner, therefore we opt for subtracting the y-value from the height of the image (h), so as to get a normal coordinate located at the bottom-left corner.This value is calculated in pixel, to convert it to cm, we multiplied it by the cm to pixel ratio (CPR), which is found to be 305/855, this is because the height of the ring is 305cm and we found it located at pixel 855 in all videos since the video camera was recording from the same location for all videos.

The Horizontal Distance between the Last Ball and the Highest Ball
This distance (number (4) in blue color in Figure 4) is calculated by subtracting the x-coordinate of the highest ball from that of the last ball on the ring.This value is then multiplied by CPR to convert it to cm.

The Angle between the First Ball and the Highest Ball
This angle (light-green, number 5 in Figure 4) is calculated using Equation 2 with the first ball and the highest ball coordinates.

The Angle between the Last Ball and the Highest Ball
This angle (light-yellow, number 6 in Figure 4) is calculated using Equation 2 with the last ball and the highest ball coordinates.Apparently, this angle is negative and the angle between the first ball and the highest ball is positive due to the direction of the ball from left to right.Unless the highest ball was lower than the ring, such videos were removed from the beginning.

The Distance of the Furthest Ball from the Chord of the Track
This variable measures the convexity of the ball's track, the more this distance is the more the convexity of the ball's track.This variable (number 7 in pink color in Figure 4) is calculated by finding the maximum perpendicular distance between each ball in the track and the chord of the track (shown in yellow in Figure 4), which is defined by two points P1(x1, y1) (the first ball), and P2(x2, y2) (the last ball), the distance is then calculated using where I is the index of the balls in the track, n is the number of balls in the track, (x0,y0) are the coordinates of each ball in the track.This distance is then converted to cm by multiplying by the CPR.

…(6)
where ∆ = ( −  ) and G is the gravity constant = -980.665cm/s2 2.3.9The Horizontal Velocity of the ball The horizontal velocity V0x is not changing as the veridical velocity V0y and can be calculated using Equation 5.

The Final Velocity of the ball
We calculate the final velocity of the ball using the last bal and the ball before, which are the ones nearest to the ring, this is different from the final velocity for trajectory, which is calculated at the same launching level, such level is lower than the ring, and is not necessary to calculate it after it get in/out the ring.The velocity of the last ball can be defined by where n is the number of balls in the track and V0 is the initial velocity.

Result
By running the code on all the videos in the database we get all the variables as shown in Table 1.The total number of the remaining videos is 348, we further removed 12 videos due to our algorithm errors in finding the correct track of the ball, and this makes the accuracy of our system in extracting the information equal to 96.55%.

Discussion
Most existing work on detecting ball track of clean free-throw has been developed in a statistical context and manual observations.Therefore, we exploit image processing techniques, particularly classification learners, to discover the importance of free-throw features and learn their relationships.In this paper, we summarize our work, showing that simulation seems to be more important than observations, and supports trainers and trainee for better practicing and then professional and clean shoots can be presented.

Conclusion
The dataset presented in this work provides free-throw data collected throughout multiple throws performed by 8 players several times.The performed throws examine a variety of features common in free-throw.Identification of ball track within these activities was performed with the assistance of video recording.The resulted dataset in this work allows for more detailed evaluation of ball track and clean throw detection, which makes the accuracy of our system in extracting the information equal to 96.55%.The presented dataset contains (11) different variables that affected free-throw in basketball game.

Implication
As future work, our data set can be used to design a new biomechanical training model based on set of rules that can be useful for both trainers and trainee to rehearse on successful free throwing in basketball game.

Figure 1 .
Figure 1.Steps of the proposed biomechanical model

2. 3
.8 Initial Velocity of the Ball We calculated the initial velocity V0 of the ball based on the first and second balls as follows the video frame rate (the numbers of video frames per second) and is equal to 23.98 frames/second and

Table 1 .
Sample of the extracted information.