# Research on Recognition Method of Basketball Goals Based on Image Analysis of Computer Vision

Authors: Weini Zhang
Journal: Journal of Sensors
 (2021)

---

## Abstract

Moving target detection is involved in many engineering applications, but basketball has some difficulties because of the time-varying speed and uncertain path. The purpose of this paper is to use computer vision image analysis to identify the path and speed of a basketball goal, so as to meet the needs of recognition and achieve trajectory prediction. This research mainly discusses the basketball goal recognition method based on computer vision. In the research process, Kalman filter is used to improve the KCF tracking algorithm to track the basketball path. The algorithm of this research is based on MATLAB, so it can avoid the mixed programming of MATLAB and other languages and reduce the difficulty of interface design software. In the aspect of data acquisition, the extended EPROM is used to store user programs, and parallel interface chips (such as 8255A) can be configured in the system to output switch control signals and display and print operations. The automatic basketball bowling counter based on 8031 microprocessor is used as the host computer. After the level conversion by MAX232, it is connected with the RS232C serial port of PC, and the collected data is sent to the workstation recording the results. In order to consider the convenience of user operation, the GUI design of MATLAB is used to facilitate the exchange of information between users and computers so that users can see the competition results intuitively. The processing frame rate of the tested video image can reach 60 frames/second, more than 25 frames/second, which meet the real-time requirements of the system. The results show that the basketball goal recognition method used in this study has strong anti-interference ability and stable performance.


---

## Body

## 1. Introduction

From the early stage of vision to the final stage of classification and recognition, computer vision applications differ greatly in operation, data representation, and memory access patterns. The hardware system used for computer vision must provide a high degree of flexibility without compromising performance, make full use of spatially parallel operations, and must maintain high throughput on complex data-dependent program flows. In addition, the architecture must be modular and scalable and must be easy to adapt to the needs of different applications [1, 2].Image processing technology is a technology that uses a computer to process image information. It mainly includes image digitization, image enhancement and restoration, image data coding, image segmentation, and image recognition. With the rapid development of image processing technology, the detection technology of moving objects in video has been more and more widely used. In recent years, the sports video processing includes three parts: image processing and image processing. With the rapid development of the times, more and more video processing applications are proposed [3]. In order to better solve the problems existing in the traditional fixed-point shooting device, such as easy damage, high replacement rate, high installation and production costs, and misjudgment, the use of image processing technology can solve the above problems [3, 4].Now, computers and other visual display devices have become an important part of our daily lives [5]. Rashidi believes that with the increase in usage, a very large population worldwide is experiencing various ocular symptoms such as dry eyes, eye fatigue, irritation, and red eyes. His research is aimed at determining prevalence, community knowledge, pathophysiology, related factors, and prevention of CVS. He used questionnaires to collect relevant data, including demographic data and various variables to be studied. Regardless of age and gender, 634 students were recruited from the public sector university in Qassim, Saudi Arabia. Then, statistical analysis was performed on the data and graphs were used to represent descriptive data as percentages, modes, and medians when needed [6]. A total of 634 students with an average age of 21 were selected as the study subjects, of which the average age was 21. His research is too complicated [6]. Chaw believes that the development of a computer vision-based agricultural product identification system can help supermarket cashiers to price these weighted products. He proposed a hybrid method of object classification and attribute classification in a product recognition system, which involves the collaboration and integration of statistical methods and semantic models. Since attribute learning has become a promising example of bridging the semantic gap and assisting object recognition in many research fields, he proposed to integrate attribute learning into product recognition systems. When the training data is small, that is, when there are less than 10 samples per class, this can solve the problem. His research sample is too small [7]. Akkas has developed two computer vision algorithms that can automatically estimate labor time, duty cycle (DC), and hand activity level (HAL) from videos of workers performing 50 industrial tasks. He conducted a sensitivity analysis to examine the impact of DC deviation on HAL and found that when the DC error is less than 5%, it is not affected. Therefore, automatic computer vision HAL estimation is equivalent to manual frame-by-frame estimation. Computer vision is used to automatically estimate exercise time, work cycle, and hand activity levels from videos of workers performing industrial tasks. His research has no practical significance [8]. Barbu learns many computer vision and medical imaging problems from large-scale data sets that have millions of observations and features. He proposed a novel effective learning scheme that tightens the sparsity constraint by gradually deleting variables based on criteria and schedules [9]. The fascinating fact that the size of the problem continues to decrease throughout the iteration process makes it particularly suitable for big data learning [10, 11]. His method is generally applicable to the optimization of any differential loss function and finds applications in regression, classification, and ranking. The resulting algorithm incorporates variable screening into the estimation and is very simple to implement. He provides theoretical guarantees of convergence and selection consistency. In addition, one-dimensional piecewise linear response functions are used to solve nonlinear problems, and second-order priors are applied to these functions to avoid overfitting. His research is not novel enough [12].This research mainly discusses the basketball goal recognition method based on computer vision. In the research process, Kalman filter is used to improve the KCF tracking algorithm to track the basketball path. The algorithms in this study are all implemented on MATLAB, so the mixed programming of MATLAB and other languages can be avoided, and the difficulty of interface design software can be reduced. In terms of data acquisition, the externally expanded EPROM is used to store user programs, and the system can also be equipped with a parallel interface chip (such as 8255A) to output switch control signals or perform operations such as display and printing. The pitching counting module uses a microcomputer basketball pitching automatic counter with 8031 microprocessor as the host, then connects with the RS232C serial port of the PC through MAX232, and sends the collected pitching data to the workstation that records the results. In order to consider the convenience of the user’s operation, the GUI design of the interactive interface software MATLAB is used to facilitate information exchange between the user and the computer so that the user can intuitively see the game results [13]. The innovation of this article lies in the use of computer vision images to analyze the state of basketball goals to identify the trajectory of basketball. In addition, this article uses MATLAB to improve the KCF algorithm for meta use and get the Kalman filter to improve the KCF tracking algorithm.


## 2. Basketball Goal Recognition

### 2.1. Computer Vision

Traditional computer vision solutions to problems basically follow: image preprocessing → feature extraction → model building (classifier/regressor) → output process. In deep learning, most problems will adopt an end-to-end solution, that is, from input to output in one go. With the latest developments in high-throughput automated microscopes, the demand for effective computing strategies for analyzing large-scale image-based data is increasing [14, 15]. To this end, computer vision methods have been applied to cell segmentation and feature extraction, while machine learning methods have been developed to help phenotypic classification and clustering of data obtained from images [16]. From the early stage of vision to the final stage of classification and recognition, computer vision applications have great differences in operation, data representation, and memory access patterns [17, 18]. The hardware system used in computer vision must provide a high degree of flexibility without compromising performance, make full use of spatially parallel operations, and must maintain high throughput on complex data-dependent program flows [19]. In addition, the architecture must be modular and scalable and must be easy to adapt to the needs of different applications. The extensive application of complex monitoring systems in sports produces a lot of data. The analysis and mining of basketball monitoring data have become a research hotspot in the field of sports. The existing data cleaning methods mainly focus on noise filtering, while the detection of false data requires professional knowledge and is very time-consuming [20, 21]. Inspired by the manual inspection process in the real world, a data anomaly detection method based on computer vision and deep learning can solve this problem [22].Computer vision algorithms have the following advantages. Faster and simpler processes—computer vision systems can perform monotonous and repetitive tasks at a faster speed, making the entire process simpler. Accurate results—the machine never makes mistakes, this is no secret. Similarly, unlike humans, computer vision systems with image processing capabilities cannot make mistakes. Ultimately, the products or services provided are not only fast but also of high quality. Reduce costs—as the machine assumes the responsibility of performing tedious tasks, errors will be minimized, leaving no room for defective products or services. Therefore, the company can save a lot of money; otherwise, the money will be spent on repairing defective processes and products.Computer vision simulates the functions of the human eye and, more importantly, enables the computer to perform tasks that the human eye cannot do. The machine vision is based on the theory of computer vision, focusing on the engineering of computer vision technology, which can automatically acquire and analyze specific images to control corresponding behaviors.Different from the visual pattern recognition and visual understanding researched by computer vision, machine vision technology focuses on perceiving geometric information such as the shape, position, posture, and movement of objects in the environment. The basic theoretical frameworks, underlying theories, and algorithms of the two are similar, but the final purpose of the research is different. Therefore, computer vision is generally applicable in general, and machine vision is more used in industry.


### 2.2. Image Recognition

There is no essential difference between computer image recognition technology and human image recognition in principle. Human image recognition relies on the classification of the image’s own characteristics and then recognizes the image through the characteristics of each category. Image recognition technology may be based on the main characteristics of the image. Every image has its characteristics. In order to facilitate digital processing, the image is first converted from the RGB color space to the HIS space, and then, the Yuantong distance criterion is used to segment the field, and finally, the field ratio value is calculated. The field ratio value is given by the following formula:(1)FRj=D2jp×q.FR represents the field ratio, showing the ratio of two matrices. The frame rate of change is a physical quantity that describes the speed of frame movement [23]. The frame image is the basis of the video. With the change of the frame image, the video advances gradually, and the different degree of frame change reflects the different intensity of the video content. For example, in the live broadcast of a basketball game, when there are fierce competition fragments such as steals and fast breaks, the rapid movement of the target in the video makes the image difference between adjacent frames increase, and the overall reflection is that the frame movement becomes faster. In the gentle stage, the camera slowly transitions from one end to the other following the basketball, the frame change progresses slowly, and the frame change value is relatively small [24, 25]. Therefore, for this feature of video, the frame rate of change is selected as an auxiliary to detect the approximate location of wonderful events. The specific calculation formula of the frame change rate is as follows:
(2)FCMk=1p×q×omax∑t=1p∑j=1qoi,j.Among them,FCMk represents the frame change rate of k image frame [26]. The basketball game venue is greatly affected by the lighting, which makes the main color of the game venue float within a certain range and constantly change [27]. Therefore, try not to use a single peak as the main color feature of the venue. The classification effect of a single peak is poor. Use the main color interval to replace the single main color:
(3)mean=∑i=imini=imaxhisti×i∑i=imini=imaxhisti.Among them,histi represents color statistics [28, 29]. When a player hits a three-pointer in a basketball game, the sequence of camera switching is to first display the process of the three-point shot from the far camera, then replay the highlights into the replay shot, and finally give the player a close-up shot into the close-up shot [30].
(4)SEc=exp1−ncα.Among them,SE is the lens conversion rate and c is the lens index value [31, 32]. When a wonderful event occurs, in order to clearly describe the process of the wonderful event, the change of the frame image is accelerated, which leads to the strengthening of the lens movement. For example, when a fast break is performed in a basketball game, the lens performs a rapid field change, and the image pixel changes greatly [33]. Therefore, the key feature of lens motion intensity is used to assist the location and detection of wonderful events. The specific definition of frame motion intensity is as follows:
(5)LMIc=1nc×mc∑j=1ncmcj.Among them,LMIc represents the lens motion intensity of c lens and n represents the total number of frames of c lens [34].


### 2.3. KCF Tracking Algorithm Fused with Kalman Prediction

The KCF algorithm is a tracking algorithm based on detection. It cleverly uses the nature of the circulant matrix to make the detection process very fast and accurate. It is a widely used tracking technology. But the algorithm itself does not deal with scale changes and occlusion; Kalman filter is a widely used tool for mathematical random estimation from noisy measurement values. It can estimate the linear minimum variance of the state sequence of the dynamic system and estimate the state of the next moment on the basis of the previous state of the system. When the cascaded occlusion detection mechanism determines that there is severe occlusion or complete occlusion, if the tracking processing continues according to the original KCF tracking algorithm, the accuracy and tracking of the target model information description will not be guaranteed as the tracker is updated. Performance, the tracker update processing needs to be stopped, and the existing target prior information is used for position prediction and tracking to ensure that the target position can still be accurately tracked when occlusion occurs in a complex environment. Therefore, this study introduces the Kalman filtering strategy in the KCF tracking framework. Realize predictive tracking. The KCF tracking algorithm solves the problem of transferring learning across computing models to adapt it to data from different distributions. When Kalman filtering is used, the currentk−1 time state is predicted based on k time:
(6)Xkk−1=AXkk−1+BUk.Calculate the optimal estimate from the observed value to modify the predicted valueZk:
(7)Xkk−1=Xkk−1+KkZk−HXkk−1.Among them,A and B are system parameters and H represents the observation system parameters [35, 36].


### 2.4. Coordinate System Transformation and Rigid Body Transformation

Considering multiple coordinate systems, let the coordinate vector of the pointQ in the coordinate system E be denoted as QE, namely,
(8)EQ=EOQ⟶=xyz⇔OQ⟶=xi+yj+zk.Consider the case of two coordinate systems:A=OA,iA,jA,kA and B=OB,iB,jB,kB. The task is how to express QB as QA.When there is a pure translation relationship between the two coordinate systems, there is(9)OBQ⟶=OBOA⟶+OAQ⟶.Then,
(10)QB=QA+OBA,when the relationship between the two coordinate systems is pure rotation. The rotation matrix is a3×3 array, defined as WAB(11)WAB=defiA⋅iBjA⋅iBkA⋅iBiA⋅jBjA⋅jBkA⋅jBiA⋅kBjA⋅kBkA⋅kB,which is
(12)WAB=BiABjABkA=AiBTAjBTAkBT.It satisfies WAB=WABT.Generally speaking, the rotation matrix can be decomposed into the product of the basic rotation matrix rotating aroundi, j, and k. From the fact that WBB is the unit matrix, it can be seen that in the coordinate system B(13)QB=WABQA.If the origin and basis vectors of the two coordinate systems are different, we call the two coordinate systems a general rigid body transformation, and there are(14)BQ=WABQA+OBA.In the case of homogeneous coordinates, the previous equation can be written in the form of matrix product(15)QB1=TABQA1.Among them,
(16)TAB=WAB0TBOA1,0=0,0,0T.In this way, we can use a4×4 matrix and a four-dimensional vector to represent any coordinate system transformation.


## 2.1. Computer Vision

Traditional computer vision solutions to problems basically follow: image preprocessing → feature extraction → model building (classifier/regressor) → output process. In deep learning, most problems will adopt an end-to-end solution, that is, from input to output in one go. With the latest developments in high-throughput automated microscopes, the demand for effective computing strategies for analyzing large-scale image-based data is increasing [14, 15]. To this end, computer vision methods have been applied to cell segmentation and feature extraction, while machine learning methods have been developed to help phenotypic classification and clustering of data obtained from images [16]. From the early stage of vision to the final stage of classification and recognition, computer vision applications have great differences in operation, data representation, and memory access patterns [17, 18]. The hardware system used in computer vision must provide a high degree of flexibility without compromising performance, make full use of spatially parallel operations, and must maintain high throughput on complex data-dependent program flows [19]. In addition, the architecture must be modular and scalable and must be easy to adapt to the needs of different applications. The extensive application of complex monitoring systems in sports produces a lot of data. The analysis and mining of basketball monitoring data have become a research hotspot in the field of sports. The existing data cleaning methods mainly focus on noise filtering, while the detection of false data requires professional knowledge and is very time-consuming [20, 21]. Inspired by the manual inspection process in the real world, a data anomaly detection method based on computer vision and deep learning can solve this problem [22].Computer vision algorithms have the following advantages. Faster and simpler processes—computer vision systems can perform monotonous and repetitive tasks at a faster speed, making the entire process simpler. Accurate results—the machine never makes mistakes, this is no secret. Similarly, unlike humans, computer vision systems with image processing capabilities cannot make mistakes. Ultimately, the products or services provided are not only fast but also of high quality. Reduce costs—as the machine assumes the responsibility of performing tedious tasks, errors will be minimized, leaving no room for defective products or services. Therefore, the company can save a lot of money; otherwise, the money will be spent on repairing defective processes and products.Computer vision simulates the functions of the human eye and, more importantly, enables the computer to perform tasks that the human eye cannot do. The machine vision is based on the theory of computer vision, focusing on the engineering of computer vision technology, which can automatically acquire and analyze specific images to control corresponding behaviors.Different from the visual pattern recognition and visual understanding researched by computer vision, machine vision technology focuses on perceiving geometric information such as the shape, position, posture, and movement of objects in the environment. The basic theoretical frameworks, underlying theories, and algorithms of the two are similar, but the final purpose of the research is different. Therefore, computer vision is generally applicable in general, and machine vision is more used in industry.


## 2.2. Image Recognition

There is no essential difference between computer image recognition technology and human image recognition in principle. Human image recognition relies on the classification of the image’s own characteristics and then recognizes the image through the characteristics of each category. Image recognition technology may be based on the main characteristics of the image. Every image has its characteristics. In order to facilitate digital processing, the image is first converted from the RGB color space to the HIS space, and then, the Yuantong distance criterion is used to segment the field, and finally, the field ratio value is calculated. The field ratio value is given by the following formula:(1)FRj=D2jp×q.FR represents the field ratio, showing the ratio of two matrices. The frame rate of change is a physical quantity that describes the speed of frame movement [23]. The frame image is the basis of the video. With the change of the frame image, the video advances gradually, and the different degree of frame change reflects the different intensity of the video content. For example, in the live broadcast of a basketball game, when there are fierce competition fragments such as steals and fast breaks, the rapid movement of the target in the video makes the image difference between adjacent frames increase, and the overall reflection is that the frame movement becomes faster. In the gentle stage, the camera slowly transitions from one end to the other following the basketball, the frame change progresses slowly, and the frame change value is relatively small [24, 25]. Therefore, for this feature of video, the frame rate of change is selected as an auxiliary to detect the approximate location of wonderful events. The specific calculation formula of the frame change rate is as follows:
(2)FCMk=1p×q×omax∑t=1p∑j=1qoi,j.Among them,FCMk represents the frame change rate of k image frame [26]. The basketball game venue is greatly affected by the lighting, which makes the main color of the game venue float within a certain range and constantly change [27]. Therefore, try not to use a single peak as the main color feature of the venue. The classification effect of a single peak is poor. Use the main color interval to replace the single main color:
(3)mean=∑i=imini=imaxhisti×i∑i=imini=imaxhisti.Among them,histi represents color statistics [28, 29]. When a player hits a three-pointer in a basketball game, the sequence of camera switching is to first display the process of the three-point shot from the far camera, then replay the highlights into the replay shot, and finally give the player a close-up shot into the close-up shot [30].
(4)SEc=exp1−ncα.Among them,SE is the lens conversion rate and c is the lens index value [31, 32]. When a wonderful event occurs, in order to clearly describe the process of the wonderful event, the change of the frame image is accelerated, which leads to the strengthening of the lens movement. For example, when a fast break is performed in a basketball game, the lens performs a rapid field change, and the image pixel changes greatly [33]. Therefore, the key feature of lens motion intensity is used to assist the location and detection of wonderful events. The specific definition of frame motion intensity is as follows:
(5)LMIc=1nc×mc∑j=1ncmcj.Among them,LMIc represents the lens motion intensity of c lens and n represents the total number of frames of c lens [34].


## 2.3. KCF Tracking Algorithm Fused with Kalman Prediction

The KCF algorithm is a tracking algorithm based on detection. It cleverly uses the nature of the circulant matrix to make the detection process very fast and accurate. It is a widely used tracking technology. But the algorithm itself does not deal with scale changes and occlusion; Kalman filter is a widely used tool for mathematical random estimation from noisy measurement values. It can estimate the linear minimum variance of the state sequence of the dynamic system and estimate the state of the next moment on the basis of the previous state of the system. When the cascaded occlusion detection mechanism determines that there is severe occlusion or complete occlusion, if the tracking processing continues according to the original KCF tracking algorithm, the accuracy and tracking of the target model information description will not be guaranteed as the tracker is updated. Performance, the tracker update processing needs to be stopped, and the existing target prior information is used for position prediction and tracking to ensure that the target position can still be accurately tracked when occlusion occurs in a complex environment. Therefore, this study introduces the Kalman filtering strategy in the KCF tracking framework. Realize predictive tracking. The KCF tracking algorithm solves the problem of transferring learning across computing models to adapt it to data from different distributions. When Kalman filtering is used, the currentk−1 time state is predicted based on k time:
(6)Xkk−1=AXkk−1+BUk.Calculate the optimal estimate from the observed value to modify the predicted valueZk:
(7)Xkk−1=Xkk−1+KkZk−HXkk−1.Among them,A and B are system parameters and H represents the observation system parameters [35, 36].


## 2.4. Coordinate System Transformation and Rigid Body Transformation

Considering multiple coordinate systems, let the coordinate vector of the pointQ in the coordinate system E be denoted as QE, namely,
(8)EQ=EOQ⟶=xyz⇔OQ⟶=xi+yj+zk.Consider the case of two coordinate systems:A=OA,iA,jA,kA and B=OB,iB,jB,kB. The task is how to express QB as QA.When there is a pure translation relationship between the two coordinate systems, there is(9)OBQ⟶=OBOA⟶+OAQ⟶.Then,
(10)QB=QA+OBA,when the relationship between the two coordinate systems is pure rotation. The rotation matrix is a3×3 array, defined as WAB(11)WAB=defiA⋅iBjA⋅iBkA⋅iBiA⋅jBjA⋅jBkA⋅jBiA⋅kBjA⋅kBkA⋅kB,which is
(12)WAB=BiABjABkA=AiBTAjBTAkBT.It satisfies WAB=WABT.Generally speaking, the rotation matrix can be decomposed into the product of the basic rotation matrix rotating aroundi, j, and k. From the fact that WBB is the unit matrix, it can be seen that in the coordinate system B(13)QB=WABQA.If the origin and basis vectors of the two coordinate systems are different, we call the two coordinate systems a general rigid body transformation, and there are(14)BQ=WABQA+OBA.In the case of homogeneous coordinates, the previous equation can be written in the form of matrix product(15)QB1=TABQA1.Among them,
(16)TAB=WAB0TBOA1,0=0,0,0T.In this way, we can use a4×4 matrix and a four-dimensional vector to represent any coordinate system transformation.


## 3. Basketball Goal Recognition Experiment

### 3.1. Improved KCF Tracking Algorithm

The KCF filter model is always in the update state. In the complex occlusion environment, the background and occluded object information are continuously introduced, which leads to target drift in subsequent frames, decreased tracking accuracy, and even target loss. Therefore, the model update is stopped when the occlusion occurs to avoid excessive learning of background information and the tracker drifts. At the same time, to ensure the normal tracking process and tracking accuracy, Kalman filter is used to improve the KCF tracking algorithm.(1)
Initialize the Kalman filter parameters and the KCF tracker, use the KCF tracking algorithm to obtain the current frame target position pos, and calculate the current frame’s predicted position pre_pos from the previous frame target position Lpos(2)
The cascaded occlusion determination mechanism is enabled to determine the occlusion of the current frame. If the target is not occluded, the KCF tracking result pos is used as the measured value to modify the Kalman predicted value pre_pos, and finally, the target optimal position tracking_pos is obtained(3)
If it is judged that the target is occluded, stop updating the KCF model. After the target is out of the occlusion, the KCF algorithm tracks normally, and the Kalman filter is used to optimize the current tracking position to obtain the optimal target tracking(4)
After the current frame position is output, the Kalman filter and position are updated, and based on the result, the next frame is judged and the tracking strategy is selected, so as to complete the antiocclusion tracking of the entire video sequence


### 3.2. Hardware Environment Construction

#### 3.2.1. Camera Selection

The type of experiment in this article is simulation experiment. The camera parameters in this study are shown in Table1. In the process of fixed-point shooting, due to the fast movement of basketball, the basketball will hit the basket or backboard during the shooting process, resulting in shooting jitter. Mainly consider the following aspects: real time, frame rate, and antishake. The three points of real time, frame rate, and antishake are selected mainly because all algorithm processing must be completed within the specified time slice to reduce image instability. In addition, the sensor parameters are shown in Table 2.Table 1
Camera parameters.
ModelFree drive (M30A)Support operating systemWindows XP/WIN 8Resolution and frame rate70 frames per second at 640∗480Programmable controlBrightness, contrast, hueInterface protocolUSB3.0Development languageUnlimitedImage data formatYUV4 22Color typeColorTable 2
Sensor parameters.
Sensitivity size3563μmPixel size2003μmSensitivity4μm∗4 μmSpectral response3.0 V/lux-sec (770 nm)Sensitivity size5 nm–1500 nm with IR600 filter


#### 3.2.2. PC Selection

In order to process and run in real time on a PC, there are certain basic requirements for configuration. Computer CPU: i5-7200U@2.50 GHz memory is 4G, and the graphics card is a discrete graphics card.


### 3.3. Software Environment Construction

The design of the basketball goal recognition system mainly includes a development environment and an operating environment. The development environment is a series of processes for identifying basketball goals. The operating environment is the software that can perform the work normally on the PC used in basketball detection [37].


#### 3.3.1. Development Environment

MATLAB interface design is simple and powerful. The algorithms in this study are all implemented on MATLAB, so the mixed programming of MATLAB and other languages can be avoided, and the difficulty of interface design software can be reduced. MATLAB provides users with a concise interface design environment. The GUI interface used in this study is developed in the GUDE integrated environment.The main functions that MATLAB can achieve include real-time input and display of video images, acquisition of image frames, display of tracking area coordinates and manual selection, and real-time tracking. For MATLAB to achieve the development requirements of this research, MATLAB software is selected as the development environment.


#### 3.3.2. Operating Environment

This system is developed under the MATLAB environment. It is necessary to consider whether to install MATLAB software. The operating environment of the computer is Windows 7/8/10 (32/64 bit) operating system and MATLAB software or MCRInstaller.exe plugin.


### 3.4. Data Collection

#### 3.4.1. Data Acquisition Hardware

The extended EPROM is used to store the user program, that is, the control program of the system. The externally expanded RAM is used to store the collected data. Sometimes the amount of collected data is large. It is generally not enough to only use the on-chip RAM. Therefore, it is necessary to expand the off-chip RAM. If the amount of data is particularly large, you can also equip a tape drive. To save the collected data, the A/D converter is used to collect the data. This system collects digital signals, and the amount of collected data is large. The collected data is communicated with the PC through the RS232 interface and transmitted to the PC at any time and recorded and saved in the hard disk or floppy disk. Therefore, there is no need to expand the AD converter and off-chip RAM. The system can also be equipped with a parallel interface chip (such as 8255A) to output switch control signals or perform operations such as display and printing.


#### 3.4.2. Data Acquisition Software

Data acquisition is basically a data acquisition and processing process under the control of a timer/counter. Complete data collection and processing in the terminal program. If the AD converter is compared successively, the query method can be used to wait for the end of the A/D conversion, instead of using interrupts and interrupt nesting methods. If the system has other work to do during the A/D conversion process, of course interrupt nesting can also be used.


### 3.5. System Connection Communication

The structure diagram of the system is shown in Figure1. This block diagram shows the structure of the visual image analysis system, including the hardware system and wireless router.Figure 1
System structure diagram.


#### 3.5.1. Data Communication Method

Usually, according to the distance of information transmission to decide which communication method to use, if the distance is short, the parallel communication method can be used; when the distance is longer, the serial communication method is used. The 8031 single-chip microcomputer has two communication modes: parallel and serial. Generally, parallel communication is used between the single-chip microcomputer and the peripheral interface chip, and the communication between the single-chip and the peripheral uses serial communication. In the communication between the computer and the single-chip microcomputer, we choose the serial port communication; this is because serial communication is one of the main methods of data communication between the single-chip microcomputer and the computer, and RS-232C is a commonly used serial communication standard. The data we want to transmit is some binary values, which does not require too high transmission speed and low cost.


#### 3.5.2. Choice of Transmission Method

We use the full duplex mode, because in the process of communication between the single-chip microcomputer and the computer, the computer transmits control information to the single-chip microcomputer, and the single-chip microcomputer responds and transmits data. This is a two-way process.


### 3.6. Design of Pitch Counting Module

The pitching counting module uses the microcomputer basketball pitching automatic counter with 8031 microprocessor as the core as the host, then connects to the RS232C serial port of the PC through MAX232 for level conversion, and sends the collected pitching data to the workstation that records the results. It is operated by the assessment personnel, and the data collected by the instrument connected to the computer is read in, displayed, and processed through the serial port of the computer to obtain the final result and print it. The videos of shooting in the left, middle, and right directions are collected separately. The videos in each direction are divided into ten groups of data, and the duration of each group of data is about 1.5 minutes. The Hough circle transform method is used to realize the accurate detection of the basket, and the background difference and three-frame difference combination algorithm is used to realize the basketball detection and image calibration technology to realize the recognition of basketball goals.


### 3.7. Interface Design

In order to consider the convenience of the user’s work, the interactive interface software is designed with MATLAB GUI, which facilitates the information exchange between the user and the computer and allows the user to intuitively see the performance of the game. The interface is mainly composed of four parts: video display part, basketball detection part, button control part, and result screen part. Button control: use the video button to activate the screen. The basketball discovery button uses the background difference method and the three-frame discrimination method to reduce the basketball. The system mode update button is used to update the system variables caused by each camera setting. The result consists of two parts, showing the countdown to stable shots and the number of goals scored.


## 3.1. Improved KCF Tracking Algorithm

The KCF filter model is always in the update state. In the complex occlusion environment, the background and occluded object information are continuously introduced, which leads to target drift in subsequent frames, decreased tracking accuracy, and even target loss. Therefore, the model update is stopped when the occlusion occurs to avoid excessive learning of background information and the tracker drifts. At the same time, to ensure the normal tracking process and tracking accuracy, Kalman filter is used to improve the KCF tracking algorithm.(1)
Initialize the Kalman filter parameters and the KCF tracker, use the KCF tracking algorithm to obtain the current frame target position pos, and calculate the current frame’s predicted position pre_pos from the previous frame target position Lpos(2)
The cascaded occlusion determination mechanism is enabled to determine the occlusion of the current frame. If the target is not occluded, the KCF tracking result pos is used as the measured value to modify the Kalman predicted value pre_pos, and finally, the target optimal position tracking_pos is obtained(3)
If it is judged that the target is occluded, stop updating the KCF model. After the target is out of the occlusion, the KCF algorithm tracks normally, and the Kalman filter is used to optimize the current tracking position to obtain the optimal target tracking(4)
After the current frame position is output, the Kalman filter and position are updated, and based on the result, the next frame is judged and the tracking strategy is selected, so as to complete the antiocclusion tracking of the entire video sequence


## 3.2. Hardware Environment Construction

### 3.2.1. Camera Selection

The type of experiment in this article is simulation experiment. The camera parameters in this study are shown in Table1. In the process of fixed-point shooting, due to the fast movement of basketball, the basketball will hit the basket or backboard during the shooting process, resulting in shooting jitter. Mainly consider the following aspects: real time, frame rate, and antishake. The three points of real time, frame rate, and antishake are selected mainly because all algorithm processing must be completed within the specified time slice to reduce image instability. In addition, the sensor parameters are shown in Table 2.Table 1
Camera parameters.
ModelFree drive (M30A)Support operating systemWindows XP/WIN 8Resolution and frame rate70 frames per second at 640∗480Programmable controlBrightness, contrast, hueInterface protocolUSB3.0Development languageUnlimitedImage data formatYUV4 22Color typeColorTable 2
Sensor parameters.
Sensitivity size3563μmPixel size2003μmSensitivity4μm∗4 μmSpectral response3.0 V/lux-sec (770 nm)Sensitivity size5 nm–1500 nm with IR600 filter


### 3.2.2. PC Selection

In order to process and run in real time on a PC, there are certain basic requirements for configuration. Computer CPU: i5-7200U@2.50 GHz memory is 4G, and the graphics card is a discrete graphics card.


## 3.2.1. Camera Selection

The type of experiment in this article is simulation experiment. The camera parameters in this study are shown in Table1. In the process of fixed-point shooting, due to the fast movement of basketball, the basketball will hit the basket or backboard during the shooting process, resulting in shooting jitter. Mainly consider the following aspects: real time, frame rate, and antishake. The three points of real time, frame rate, and antishake are selected mainly because all algorithm processing must be completed within the specified time slice to reduce image instability. In addition, the sensor parameters are shown in Table 2.Table 1
Camera parameters.
ModelFree drive (M30A)Support operating systemWindows XP/WIN 8Resolution and frame rate70 frames per second at 640∗480Programmable controlBrightness, contrast, hueInterface protocolUSB3.0Development languageUnlimitedImage data formatYUV4 22Color typeColorTable 2
Sensor parameters.
Sensitivity size3563μmPixel size2003μmSensitivity4μm∗4 μmSpectral response3.0 V/lux-sec (770 nm)Sensitivity size5 nm–1500 nm with IR600 filter


## 3.2.2. PC Selection

In order to process and run in real time on a PC, there are certain basic requirements for configuration. Computer CPU: i5-7200U@2.50 GHz memory is 4G, and the graphics card is a discrete graphics card.


## 3.3. Software Environment Construction

The design of the basketball goal recognition system mainly includes a development environment and an operating environment. The development environment is a series of processes for identifying basketball goals. The operating environment is the software that can perform the work normally on the PC used in basketball detection [37].


### 3.3.1. Development Environment

MATLAB interface design is simple and powerful. The algorithms in this study are all implemented on MATLAB, so the mixed programming of MATLAB and other languages can be avoided, and the difficulty of interface design software can be reduced. MATLAB provides users with a concise interface design environment. The GUI interface used in this study is developed in the GUDE integrated environment.The main functions that MATLAB can achieve include real-time input and display of video images, acquisition of image frames, display of tracking area coordinates and manual selection, and real-time tracking. For MATLAB to achieve the development requirements of this research, MATLAB software is selected as the development environment.


### 3.3.2. Operating Environment

This system is developed under the MATLAB environment. It is necessary to consider whether to install MATLAB software. The operating environment of the computer is Windows 7/8/10 (32/64 bit) operating system and MATLAB software or MCRInstaller.exe plugin.


## 3.3.1. Development Environment

MATLAB interface design is simple and powerful. The algorithms in this study are all implemented on MATLAB, so the mixed programming of MATLAB and other languages can be avoided, and the difficulty of interface design software can be reduced. MATLAB provides users with a concise interface design environment. The GUI interface used in this study is developed in the GUDE integrated environment.The main functions that MATLAB can achieve include real-time input and display of video images, acquisition of image frames, display of tracking area coordinates and manual selection, and real-time tracking. For MATLAB to achieve the development requirements of this research, MATLAB software is selected as the development environment.


## 3.3.2. Operating Environment

This system is developed under the MATLAB environment. It is necessary to consider whether to install MATLAB software. The operating environment of the computer is Windows 7/8/10 (32/64 bit) operating system and MATLAB software or MCRInstaller.exe plugin.


## 3.4. Data Collection

### 3.4.1. Data Acquisition Hardware

The extended EPROM is used to store the user program, that is, the control program of the system. The externally expanded RAM is used to store the collected data. Sometimes the amount of collected data is large. It is generally not enough to only use the on-chip RAM. Therefore, it is necessary to expand the off-chip RAM. If the amount of data is particularly large, you can also equip a tape drive. To save the collected data, the A/D converter is used to collect the data. This system collects digital signals, and the amount of collected data is large. The collected data is communicated with the PC through the RS232 interface and transmitted to the PC at any time and recorded and saved in the hard disk or floppy disk. Therefore, there is no need to expand the AD converter and off-chip RAM. The system can also be equipped with a parallel interface chip (such as 8255A) to output switch control signals or perform operations such as display and printing.


### 3.4.2. Data Acquisition Software

Data acquisition is basically a data acquisition and processing process under the control of a timer/counter. Complete data collection and processing in the terminal program. If the AD converter is compared successively, the query method can be used to wait for the end of the A/D conversion, instead of using interrupts and interrupt nesting methods. If the system has other work to do during the A/D conversion process, of course interrupt nesting can also be used.


## 3.4.1. Data Acquisition Hardware

The extended EPROM is used to store the user program, that is, the control program of the system. The externally expanded RAM is used to store the collected data. Sometimes the amount of collected data is large. It is generally not enough to only use the on-chip RAM. Therefore, it is necessary to expand the off-chip RAM. If the amount of data is particularly large, you can also equip a tape drive. To save the collected data, the A/D converter is used to collect the data. This system collects digital signals, and the amount of collected data is large. The collected data is communicated with the PC through the RS232 interface and transmitted to the PC at any time and recorded and saved in the hard disk or floppy disk. Therefore, there is no need to expand the AD converter and off-chip RAM. The system can also be equipped with a parallel interface chip (such as 8255A) to output switch control signals or perform operations such as display and printing.


## 3.4.2. Data Acquisition Software

Data acquisition is basically a data acquisition and processing process under the control of a timer/counter. Complete data collection and processing in the terminal program. If the AD converter is compared successively, the query method can be used to wait for the end of the A/D conversion, instead of using interrupts and interrupt nesting methods. If the system has other work to do during the A/D conversion process, of course interrupt nesting can also be used.


## 3.5. System Connection Communication

The structure diagram of the system is shown in Figure1. This block diagram shows the structure of the visual image analysis system, including the hardware system and wireless router.Figure 1
System structure diagram.


### 3.5.1. Data Communication Method

Usually, according to the distance of information transmission to decide which communication method to use, if the distance is short, the parallel communication method can be used; when the distance is longer, the serial communication method is used. The 8031 single-chip microcomputer has two communication modes: parallel and serial. Generally, parallel communication is used between the single-chip microcomputer and the peripheral interface chip, and the communication between the single-chip and the peripheral uses serial communication. In the communication between the computer and the single-chip microcomputer, we choose the serial port communication; this is because serial communication is one of the main methods of data communication between the single-chip microcomputer and the computer, and RS-232C is a commonly used serial communication standard. The data we want to transmit is some binary values, which does not require too high transmission speed and low cost.


### 3.5.2. Choice of Transmission Method

We use the full duplex mode, because in the process of communication between the single-chip microcomputer and the computer, the computer transmits control information to the single-chip microcomputer, and the single-chip microcomputer responds and transmits data. This is a two-way process.


## 3.5.1. Data Communication Method

Usually, according to the distance of information transmission to decide which communication method to use, if the distance is short, the parallel communication method can be used; when the distance is longer, the serial communication method is used. The 8031 single-chip microcomputer has two communication modes: parallel and serial. Generally, parallel communication is used between the single-chip microcomputer and the peripheral interface chip, and the communication between the single-chip and the peripheral uses serial communication. In the communication between the computer and the single-chip microcomputer, we choose the serial port communication; this is because serial communication is one of the main methods of data communication between the single-chip microcomputer and the computer, and RS-232C is a commonly used serial communication standard. The data we want to transmit is some binary values, which does not require too high transmission speed and low cost.


## 3.5.2. Choice of Transmission Method

We use the full duplex mode, because in the process of communication between the single-chip microcomputer and the computer, the computer transmits control information to the single-chip microcomputer, and the single-chip microcomputer responds and transmits data. This is a two-way process.


## 3.6. Design of Pitch Counting Module

The pitching counting module uses the microcomputer basketball pitching automatic counter with 8031 microprocessor as the core as the host, then connects to the RS232C serial port of the PC through MAX232 for level conversion, and sends the collected pitching data to the workstation that records the results. It is operated by the assessment personnel, and the data collected by the instrument connected to the computer is read in, displayed, and processed through the serial port of the computer to obtain the final result and print it. The videos of shooting in the left, middle, and right directions are collected separately. The videos in each direction are divided into ten groups of data, and the duration of each group of data is about 1.5 minutes. The Hough circle transform method is used to realize the accurate detection of the basket, and the background difference and three-frame difference combination algorithm is used to realize the basketball detection and image calibration technology to realize the recognition of basketball goals.


## 3.7. Interface Design

In order to consider the convenience of the user’s work, the interactive interface software is designed with MATLAB GUI, which facilitates the information exchange between the user and the computer and allows the user to intuitively see the performance of the game. The interface is mainly composed of four parts: video display part, basketball detection part, button control part, and result screen part. Button control: use the video button to activate the screen. The basketball discovery button uses the background difference method and the three-frame discrimination method to reduce the basketball. The system mode update button is used to update the system variables caused by each camera setting. The result consists of two parts, showing the countdown to stable shots and the number of goals scored.


## 4. Basketball Goal Recognition Analysis

### 4.1. Goal Recognition Results

Through the comprehensive analysis of the collected three simulation test videos of left, center, and right shots, the basketball is detected from the video sequence frame images. Through the video analysis of left, center, and right shots, it is concluded that the image basketball of adjacent frames will have a certain position change, and the basketball will gradually become smaller when entering the basket. By testing 24 sets of data, select the left 8 sets of data and the test results are shown in Table3. In the ten sets of left, center, and right shot data, respectively, it was found that there was no misdetection or missed detection in the left and right shot data, and the third and ninth group of mid shot data had missed detection. This research is to judge the basketball and system configuration parameters again by delaying the appropriate time after the basketball enters the basket, which can solve the misdetection. And the basketball thrown in the middle position will directly throw into the basket (hollow ball) and move along the direction of the connection between the basket and the backboard. In this case, there will be a missed detection phenomenon. It can be seen from Table 3 that this algorithm has neither missed detection nor false detection, which is very stable.Table 3
Test results of the left 8 groups of data.
NameLeft layupsActual goalJudge the goal1147722412123201010414775168862412127147781688


### 4.2. Algorithm Performance Analysis

Four groups of typical target occlusion scenes are selected from the 0TB2015 data set for qualitative experimental analysis of the algorithm, which are Jogging1 sequence, Coke sequence, Girl2 sequence, and box sequence, mainly aiming at the improvement of the nonrobust occlusion defect of the KCF algorithm. Therefore, the COPKCF algorithm proposed in this research and the traditional KCF algorithm are compared and analyzed to verify the effectiveness of the improved algorithm in this paper. It can be seen from Figure2 that before occlusion occurs, both algorithms show very good tracking effects. Because the COPKCF algorithm combines the Kalman filter to optimize the tracking result, the position deviation is smaller and the coincidence rate is high. When severe occlusion occurs, the position error of the KCF algorithm increases, the coincidence rate of the target frame decreases, and the tracking performance decreases. The algorithm predicts the tracking to ensure that the tracking is normal. When the target leaves the occlusion area, the KCF tracking frame stays in the occlusion area and the tracking fails. As the sequence progresses, the error keeps increasing, and the coincidence rate keeps dropping until it becomes zero. In this research, the Kalman filter algorithm can not only track the target when occlusion occurs (frame 270) but also maintain good tracking accuracy. The improved algorithm COPKCF proposed in this research based on the KCF framework greatly improves the tracking accuracy and success rate of the algorithm. Compared with the KCF algorithm, they have increased by 31.3% and 33.6%, respectively, indicating that the algorithm in this paper has good robustness for tracking in occluded environments. Analyze the tracking speed of the algorithm. In the occlusion detection mechanism, extracting and matching LBP features every 3 frames will increase the processing time. The response traversal calculation in APCE and the determination of the secondary occlusion threshold require a certain amount of time. In addition, Kalman filtering is used for prediction. The optimal position estimation also consumes part of the calculation time. These three parts increase the overall time complexity of the algorithm and reduce the processing speed. The final algorithm processing performance is 46 fps.Figure 2
Algorithm performance analysis results.


### 4.3. Real-Time Analysis

Real-time performance means that one thing can be analyzed and processed correctly in time and the length of time it takes to process a thing. The shorter the processing time, the better the real-time performance, and the longer the processing time, that is, the worse the real-time performance. The calculation process of edge pixel ratio firstly preprocess the image, convert the image from RGB space to YCbCr space which is convenient for digital image processing, and then use COPKCF operator for edge detection to obtain edge pixels. The real-time analysis result is shown in Figure3. The ratio of edge pixels of different images is quite different. When the lens is pointed at sports basketball and the sports basketball is close-up, the athlete is the main content of the image. The outline is relatively simple, the smooth area is more, and the background is relatively simple. Edge detection is performed through the COPKCF operator. It can be seen that there are fewer edge pixels in the image. When the lens is turned to the distance to shoot the audience lens, the background is relatively complicated. At this time, the ratio of edge pixels obtained is larger, and the ratio of edge pixels can well divide part of the content in the video. In this study, we need to be able to process the basketball goal event in real time during the shooting, and the time spent on it should be as short as possible. The image whose frame rate is not less than 25 fps is called real-time image and can meet the real-time requirements of the system. It can be seen from Figure 3 that the processing frame rate in the tested video image can reach 60 frames per second, which is greater than 25 frames per second, which meets the real-time requirements of the system.Figure 3
Real-time analysis results.


### 4.4. Antijamming Performance Analysis

In order to make the system work reliably and prevent strong interference sources from causing the system to work abnormally or crash, a finished switching power supply with power supply filtering and overvoltage and overcurrent protection is used, a reset circuit is designed on the hardware, and the PCB board design adopts some anti-interference measures; sensor design has adopted some technical measures, thus ensuring the accuracy and reliability of the basketball automatic test system. The antijamming performance analysis result is shown in Figure4. However, due to the randomness of interference, even though the hardware anti-interference measures such as the above are adopted, all kinds of interference cannot be completely shut out. We have given full play to the flexibility of the single-chip microcomputer in software programming, adopted two software antijamming measures, combined with the above hardware anti-jamming measures, and improved the reliability of the system. If the interference signal has been applied to the CPU in some way, the CPU cannot execute the program in the normal state, which will cause confusion. This is what is usually called the program “runaway.” One of the easiest ways to return to normal after a program “runs away” is to reset the CPU and let the program restart from the beginning. This system has also designed a reset circuit. When manual reset is required, press the reset button once, and the circuit can provide reset pulses for the system to reset the microcontroller. Although this method is simple, it requires human participation and the reset is not timely. Manual reset is generally used when the entire system is completely paralyzed and there is nothing to do. Therefore, in the software design, we should also consider that in case the program “runs away,” it should be able to automatically return to normal operation. Interference time is the time when interference measures are taken.Figure 4
Antijamming performance analysis results.The COPKCF operator is an algorithm similar to KCF, which can achieve target tracking and data collection. Based on the COPKCF basketball video, the detection result of whether a goal is a three-pointer is shown in Figure5. It can be seen from the results that the ME model does not consider the constraints of the conversion mode of score numbers at all, and the recognition rate is the lowest among the three. In the experiment, KCF will mistake some score numbers as impossible patterns, such as sequences like (2, 6). This shows that this model cannot automatically learn the domain knowledge of the score conversion mode through training data. In contrast, the COPKCF model proposed in this study can obtain a higher accuracy of score digit recognition. The experiment also compared the score recognition model proposed in this chapter with the score number recognition model proposed in existing work. According to the experimental results, the recognition accuracy of the recognition model based on Zernike moment+ template matching is less than 80%, and the accuracy of the digital recognition model based on shape features is 90%. The results show that COPKCF has a higher accuracy in three-point ball detection than in digit recognition. This is because the accurate free throw detection results help reduce the errors that the model may make during recognition (for example, mistaking the score from 5 to 6 to the score from 5 to 8).Figure 5
The test result of whether the goal based on COPKCF is a three-pointer.


## 4.1. Goal Recognition Results

Through the comprehensive analysis of the collected three simulation test videos of left, center, and right shots, the basketball is detected from the video sequence frame images. Through the video analysis of left, center, and right shots, it is concluded that the image basketball of adjacent frames will have a certain position change, and the basketball will gradually become smaller when entering the basket. By testing 24 sets of data, select the left 8 sets of data and the test results are shown in Table3. In the ten sets of left, center, and right shot data, respectively, it was found that there was no misdetection or missed detection in the left and right shot data, and the third and ninth group of mid shot data had missed detection. This research is to judge the basketball and system configuration parameters again by delaying the appropriate time after the basketball enters the basket, which can solve the misdetection. And the basketball thrown in the middle position will directly throw into the basket (hollow ball) and move along the direction of the connection between the basket and the backboard. In this case, there will be a missed detection phenomenon. It can be seen from Table 3 that this algorithm has neither missed detection nor false detection, which is very stable.Table 3
Test results of the left 8 groups of data.
NameLeft layupsActual goalJudge the goal1147722412123201010414775168862412127147781688


## 4.2. Algorithm Performance Analysis

Four groups of typical target occlusion scenes are selected from the 0TB2015 data set for qualitative experimental analysis of the algorithm, which are Jogging1 sequence, Coke sequence, Girl2 sequence, and box sequence, mainly aiming at the improvement of the nonrobust occlusion defect of the KCF algorithm. Therefore, the COPKCF algorithm proposed in this research and the traditional KCF algorithm are compared and analyzed to verify the effectiveness of the improved algorithm in this paper. It can be seen from Figure2 that before occlusion occurs, both algorithms show very good tracking effects. Because the COPKCF algorithm combines the Kalman filter to optimize the tracking result, the position deviation is smaller and the coincidence rate is high. When severe occlusion occurs, the position error of the KCF algorithm increases, the coincidence rate of the target frame decreases, and the tracking performance decreases. The algorithm predicts the tracking to ensure that the tracking is normal. When the target leaves the occlusion area, the KCF tracking frame stays in the occlusion area and the tracking fails. As the sequence progresses, the error keeps increasing, and the coincidence rate keeps dropping until it becomes zero. In this research, the Kalman filter algorithm can not only track the target when occlusion occurs (frame 270) but also maintain good tracking accuracy. The improved algorithm COPKCF proposed in this research based on the KCF framework greatly improves the tracking accuracy and success rate of the algorithm. Compared with the KCF algorithm, they have increased by 31.3% and 33.6%, respectively, indicating that the algorithm in this paper has good robustness for tracking in occluded environments. Analyze the tracking speed of the algorithm. In the occlusion detection mechanism, extracting and matching LBP features every 3 frames will increase the processing time. The response traversal calculation in APCE and the determination of the secondary occlusion threshold require a certain amount of time. In addition, Kalman filtering is used for prediction. The optimal position estimation also consumes part of the calculation time. These three parts increase the overall time complexity of the algorithm and reduce the processing speed. The final algorithm processing performance is 46 fps.Figure 2
Algorithm performance analysis results.


## 4.3. Real-Time Analysis

Real-time performance means that one thing can be analyzed and processed correctly in time and the length of time it takes to process a thing. The shorter the processing time, the better the real-time performance, and the longer the processing time, that is, the worse the real-time performance. The calculation process of edge pixel ratio firstly preprocess the image, convert the image from RGB space to YCbCr space which is convenient for digital image processing, and then use COPKCF operator for edge detection to obtain edge pixels. The real-time analysis result is shown in Figure3. The ratio of edge pixels of different images is quite different. When the lens is pointed at sports basketball and the sports basketball is close-up, the athlete is the main content of the image. The outline is relatively simple, the smooth area is more, and the background is relatively simple. Edge detection is performed through the COPKCF operator. It can be seen that there are fewer edge pixels in the image. When the lens is turned to the distance to shoot the audience lens, the background is relatively complicated. At this time, the ratio of edge pixels obtained is larger, and the ratio of edge pixels can well divide part of the content in the video. In this study, we need to be able to process the basketball goal event in real time during the shooting, and the time spent on it should be as short as possible. The image whose frame rate is not less than 25 fps is called real-time image and can meet the real-time requirements of the system. It can be seen from Figure 3 that the processing frame rate in the tested video image can reach 60 frames per second, which is greater than 25 frames per second, which meets the real-time requirements of the system.Figure 3
Real-time analysis results.


## 4.4. Antijamming Performance Analysis

In order to make the system work reliably and prevent strong interference sources from causing the system to work abnormally or crash, a finished switching power supply with power supply filtering and overvoltage and overcurrent protection is used, a reset circuit is designed on the hardware, and the PCB board design adopts some anti-interference measures; sensor design has adopted some technical measures, thus ensuring the accuracy and reliability of the basketball automatic test system. The antijamming performance analysis result is shown in Figure4. However, due to the randomness of interference, even though the hardware anti-interference measures such as the above are adopted, all kinds of interference cannot be completely shut out. We have given full play to the flexibility of the single-chip microcomputer in software programming, adopted two software antijamming measures, combined with the above hardware anti-jamming measures, and improved the reliability of the system. If the interference signal has been applied to the CPU in some way, the CPU cannot execute the program in the normal state, which will cause confusion. This is what is usually called the program “runaway.” One of the easiest ways to return to normal after a program “runs away” is to reset the CPU and let the program restart from the beginning. This system has also designed a reset circuit. When manual reset is required, press the reset button once, and the circuit can provide reset pulses for the system to reset the microcontroller. Although this method is simple, it requires human participation and the reset is not timely. Manual reset is generally used when the entire system is completely paralyzed and there is nothing to do. Therefore, in the software design, we should also consider that in case the program “runs away,” it should be able to automatically return to normal operation. Interference time is the time when interference measures are taken.Figure 4
Antijamming performance analysis results.The COPKCF operator is an algorithm similar to KCF, which can achieve target tracking and data collection. Based on the COPKCF basketball video, the detection result of whether a goal is a three-pointer is shown in Figure5. It can be seen from the results that the ME model does not consider the constraints of the conversion mode of score numbers at all, and the recognition rate is the lowest among the three. In the experiment, KCF will mistake some score numbers as impossible patterns, such as sequences like (2, 6). This shows that this model cannot automatically learn the domain knowledge of the score conversion mode through training data. In contrast, the COPKCF model proposed in this study can obtain a higher accuracy of score digit recognition. The experiment also compared the score recognition model proposed in this chapter with the score number recognition model proposed in existing work. According to the experimental results, the recognition accuracy of the recognition model based on Zernike moment+ template matching is less than 80%, and the accuracy of the digital recognition model based on shape features is 90%. The results show that COPKCF has a higher accuracy in three-point ball detection than in digit recognition. This is because the accurate free throw detection results help reduce the errors that the model may make during recognition (for example, mistaking the score from 5 to 6 to the score from 5 to 8).Figure 5
The test result of whether the goal based on COPKCF is a three-pointer.


## 5. Conclusion

From the early stage of vision to the final stage of classification and recognition, computer vision applications differ greatly in operation, data representation, and memory access patterns. The hardware system used for computer vision must provide a high degree of flexibility without compromising performance, make full use of spatially parallel operations, and must maintain high throughput on complex data-dependent program flows. In addition, the architecture must be modular and scalable and must be easy to adapt to the needs of different applications. The KCF filter model is always in the update state. In the complex occlusion environment, the background and occluded object information are continuously introduced, which leads to target drift in subsequent frames, decreased tracking accuracy, and even target loss. Therefore, the model update is stopped when the occlusion occurs to avoid excessive learning of background information and the tracker drifts. At the same time, to ensure the normal tracking process and tracking accuracy, Kalman filter is used to improve the KCF tracking algorithm.This research mainly discusses the basketball goal recognition method based on computer vision. The interactive interface used in this study is mainly composed of four parts, video display part, basketball detection part, button control part, and result display part. Button control: start the video display through the video start button. The basketball detection button uses the background difference method and the three-frame difference method to extract the basketball. The system configuration update button is used to update the system parameter changes caused by the installation of the camera each time. The result shows that it consists of two parts, the countdown to fixed-point shooting and the number of goals is displayed.In the research process, Kalman filter is used to improve the KCF tracking algorithm to track the basketball path. The algorithms in this study are all implemented on MATLAB, so the mixed programming of MATLAB and other languages can be avoided, and the difficulty of interface design software can be reduced. In terms of data acquisition, the externally expanded EPROM is used to store user programs, and the system can also be equipped with a parallel interface chip to output switch control signals or perform operations such as display and printing. The pitching counting module uses a microcomputer basketball pitching automatic counter with a microprocessor as the core as the host to perform level conversion and then connects with the RS232C serial port of the PC and sends the collected pitching data to the workstation that records the results. In order to consider the convenience of the user’s operation, the GUI design of the interactive interface software MATLAB is used to facilitate information exchange between the user and the computer so that the user can intuitively see the game results. The disadvantage of this article is that the analysis of this algorithm is not comprehensive enough, and the performance of this algorithm is not analyzed from the perspective of throughput. In addition, this system has not been applied to actual scenarios.



---

*Source: 5269431-2021-09-20.xml*