# Application of Embedded Intelligent Target Detection System in Basketball Movement Test

Authors: Chi Zhang; Yuanyuan Wu
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

With the development of society, basketball has been deeply loved by people all over the world. Meanwhile, basketball has become one of the most watched events in the world. In order to adapt to the development of basketball and make people better understand the laws of basketball, this paper aims to study the application of embedded intelligent object detection system in basketball sports test and use the embedded intelligent object detection system to separate basketball sports. Compared with the general computer processing system, the embedded system has great differences. It cannot realize the large-capacity storage function because there is no matching large-capacity medium. Strengthen the learning of basketball theoretical knowledge through learning rules. Firstly, the research background of basketball and the research significance of moving target detection are introduced, and the embedded Linus operating system is introduced, including hardware design and software design. Then, four moving target detection algorithms are proposed. Object detection, also called object extraction, is an image segmentation based on the geometric and statistical features of objects, and its accuracy and real-time performance are an important capability of the entire system. Experiments show that when using the YCrCb domain detection algorithm, the average time-consuming is 292 ms, and the conversion frame rate is about 3.5fps. The YCrCb domain detection algorithm has good detection effect and high efficiency.


---

## Body

## 1. Introduction

### 1.1. Background

Basketball is known as “the second largest ball game in the world,” which shows that basketball has been recognized and widely participated in by everyone. Since the establishment of the Chinese Basketball Association, there have also been some players with good technical level and physical fitness, but the results of the competition are not as good as those of badminton, table tennis, and other net separation projects. To ensure the robustness of embedded systems, motion detection algorithms must be accurate and efficient. Therefore, in order to apply it to intelligent systems, we should prioritize high computational efficiency for real-time processing. Robustness is the robustness of the system, and it is the key to the survival of the system in abnormal and dangerous situations. For example, in the case of intentional attack of computer software, whether it cannot crash or crash is the embodiment of robustness. The derived target is required to be as complete and accurate as possible, which is an error-free motion detection algorithm.


### 1.2. Significance

With the continuous development of modern science and technology, computer vision technology has become an important technology to replace traditional vision in the information age. It has very important applications in many fields. In the field of video monitoring of life security, the monitoring system can automatically find the target, track and take pictures of it, and trigger the alarm to realize unattended. In medicine, we can analyze the cells in exercise. In industry, it can be used for pipeline monitoring and robot action response to moving targets. In military, it can lock and track the targets found by radar, aircraft navigation, bomb guidance, and monitoring of border crossing behavior on the border.


### 1.3. Related Work

With the development of society and the progress of science, more and more people study embedded system. Among them, Soyata outlines passive radio frequency (RF) energy receiving and power collection circuits for isolated communication and computing systems that cannot access the main power supply. This paper provides a unified understanding of alternative energy collection schemes and then studies RF energy collection in embedded system environment in detail. The RF technology from directional communication signal reception to decentralized environmental power collection is discussed in detail. The principle is that the scanner transmits radio wave energy of a specific frequency to the receiver, which is used to drive the receiver circuit to send out the internal code, and the scanner will receive the code at this time. A comparative focus on design tradeoffs and process changes is provided to represent the diversity of applications requiring radio frequency acquisition units. However, his research is not very practical [1]. Energy collection is a promising technology that can overcome the limitations of energy availability and prolong the service life of battery powered embedded systems. Among them, Xue studies how to prolong the service life of real-time embedded system (RTES-EH) with energy collection capability. RTES-EH includes photovoltaic (PV) panels for energy collection, supercapacitors for energy storage, and real-time sensor nodes as embedded load devices. The global controller simultaneously performs the optimal operating point tracking of PV panel, the state of charge (SOC) management of supercapacitor, and the energy collection of sensor dynamic voltage and frequency scaling (DVFS); senses the real-time task scheduling node; and adopts an accurate solar irradiance prediction method. The controller adopts cascade feedback control structure, in which the external supervisory control loop uses DVFS to perform real-time task scheduling in the sensor node, while maintaining the optimal supercapacitor SOC to improve the system availability. However, at present, it is difficult to realize all aspects [2]. Learning the design, simulation, and implementation of embedded systems opens a new paradigm for the development of practical laboratory experiments based on embedded systems. Ajao demonstrated the use of simulation computer-aided design tools such as proteus virtual system modeling (PVSM), Multisim, and micro-CAD learning system circuit design methods. In order to demonstrate how to conduct circuit experiments based on a virtual microcontroller in the laboratory, the PIC16F887 chip is used as the main logic element. Several actual hands-on experiments were demonstrated with the help of PVSM, and the results of each experiment were shown with snapshots. The purpose is to propose a learning technology method to allow students to participate in practice and become experts in learning embedded systems courses. In addition to student classroom teaching, this practical experiment will be an additional advantage and allow amateurs, professional scientists, and engineers to design and analyze [3]. Embedded systems must resolve many potential conflicting design constraints, such as flexibility, energy, heat, cost, performance, and safety, all of which face highly dynamic operating behaviors and environmental conditions. Dutt proposed that by adding intelligent elements, we hope that the resulting “smart” embedded system can operate correctly under the expected constraints, despite the highly dynamic changes in the application and environment, as well as the underlying software/hardware platform. Since terms related to “intelligence” (for example, self-awareness, adaptability, and autonomy) are widely used in many software and hardware computing environments, a taxonomy of “self-x” terms has been proposed and used. This classification is used to correlate the main “smart” software and hardware computing tasks. One of the main attributes of the intelligent embedded system is the concept of self-awareness, which enables the embedded system to monitor its own state and behavior as well as the external environment in order to adapt intelligently. Home appliances will be the largest application field of intelligent embedded systems, and intelligent refrigerators and air conditioners will lead people’s lives to a brand-new space. Even when you are not at home, you can remotely control your home appliances through the network [4]. Many emerging applications such as the Internet of Things, wearable devices, and sensor networks have ultra-low power consumption requirements. At the same time, for cost and programmability considerations, many of these applications will be powered by general-purpose embedded microprocessors and microcontrollers (rather than ASIC). Cherupalli has taken advantage of a new opportunity to improve the energy efficiency of ultra-low-power processors, which are expected to promote these applications-dynamic timing slack. When the embedded software application executing on the processor does not execute the static critical path of the processor, dynamic timing slack occurs. In this case, the longest path executed by the application has an additional time delay. By reducing the voltage of the processor at the same frequency until the longest path executed just meets the time limit, it can be used without reducing performance costs. This time delay is used to save power. It is possible to safely allow paths that cannot be executed by the application to violate time constraints. The results show that dynamic timing slack exists in many ultra-low power applications, and the use of dynamic timing slack can bring significant power savings to any ultra-low power process. But the cost of application development is not low [5]. In recent years, technicians have continuously deepened their exploration of embedded systems. Computer vision is an interdisciplinary object detection field. Computer vision is the use of computers to process images to obtain the information we want. The target detection relay is an important part of auxiliary monitoring, vehicle detection, and attitude estimation. In this work, Madasamy proposed a new “deep YOLO V3” method to detect multiple objects. This method looks at the entire frame during the training and testing phases. It follows regression-based techniques and uses probabilistic models to locate objects. In the article, Madasamy constructed 106 convolutional layers, followed by 2 fully connected layers and an input size of 812×812×3 to detect small-sized drones. The pretrained convolutional layer is classified at half the resolution, and then the resolution is doubled for detection. The number of filters per layer will be set to 16. The number of filters in the last scale layer exceeds 16 to improve small target detection. This configuration uses an upsampling technique to improve the unwanted spectral image into an existing signal and rescale the feature at a specific location. It clearly reveals upsampling to detect small objects [6].


### 1.4. Main Structure

In Chapter 1, it mainly introduces the research background and significance of basketball and moving target detection and tracking, the development status and development trend of domestic and foreign theories and applications, and the main content of related work and papers. Chapter 2 introduces the software and hardware structure of embedded systems; outlines three common target detection algorithms; including the complexity and advantages and disadvantages of the algorithms; and introduces the improved four-frame hybrid differential method to detect targets and to move the implementation of four algorithms for target detection. Chapter 3 introduces the work related to experiments, Chapter 4 comparison and performance test of various algorithms after the experiment, and Chapter 5 the summary, where it summarizes the design of the entire system and the achieved target effects, evaluates the system’s deficiencies, and clarifies the future development direction.


## 1.1. Background

Basketball is known as “the second largest ball game in the world,” which shows that basketball has been recognized and widely participated in by everyone. Since the establishment of the Chinese Basketball Association, there have also been some players with good technical level and physical fitness, but the results of the competition are not as good as those of badminton, table tennis, and other net separation projects. To ensure the robustness of embedded systems, motion detection algorithms must be accurate and efficient. Therefore, in order to apply it to intelligent systems, we should prioritize high computational efficiency for real-time processing. Robustness is the robustness of the system, and it is the key to the survival of the system in abnormal and dangerous situations. For example, in the case of intentional attack of computer software, whether it cannot crash or crash is the embodiment of robustness. The derived target is required to be as complete and accurate as possible, which is an error-free motion detection algorithm.


## 1.2. Significance

With the continuous development of modern science and technology, computer vision technology has become an important technology to replace traditional vision in the information age. It has very important applications in many fields. In the field of video monitoring of life security, the monitoring system can automatically find the target, track and take pictures of it, and trigger the alarm to realize unattended. In medicine, we can analyze the cells in exercise. In industry, it can be used for pipeline monitoring and robot action response to moving targets. In military, it can lock and track the targets found by radar, aircraft navigation, bomb guidance, and monitoring of border crossing behavior on the border.


## 1.3. Related Work

With the development of society and the progress of science, more and more people study embedded system. Among them, Soyata outlines passive radio frequency (RF) energy receiving and power collection circuits for isolated communication and computing systems that cannot access the main power supply. This paper provides a unified understanding of alternative energy collection schemes and then studies RF energy collection in embedded system environment in detail. The RF technology from directional communication signal reception to decentralized environmental power collection is discussed in detail. The principle is that the scanner transmits radio wave energy of a specific frequency to the receiver, which is used to drive the receiver circuit to send out the internal code, and the scanner will receive the code at this time. A comparative focus on design tradeoffs and process changes is provided to represent the diversity of applications requiring radio frequency acquisition units. However, his research is not very practical [1]. Energy collection is a promising technology that can overcome the limitations of energy availability and prolong the service life of battery powered embedded systems. Among them, Xue studies how to prolong the service life of real-time embedded system (RTES-EH) with energy collection capability. RTES-EH includes photovoltaic (PV) panels for energy collection, supercapacitors for energy storage, and real-time sensor nodes as embedded load devices. The global controller simultaneously performs the optimal operating point tracking of PV panel, the state of charge (SOC) management of supercapacitor, and the energy collection of sensor dynamic voltage and frequency scaling (DVFS); senses the real-time task scheduling node; and adopts an accurate solar irradiance prediction method. The controller adopts cascade feedback control structure, in which the external supervisory control loop uses DVFS to perform real-time task scheduling in the sensor node, while maintaining the optimal supercapacitor SOC to improve the system availability. However, at present, it is difficult to realize all aspects [2]. Learning the design, simulation, and implementation of embedded systems opens a new paradigm for the development of practical laboratory experiments based on embedded systems. Ajao demonstrated the use of simulation computer-aided design tools such as proteus virtual system modeling (PVSM), Multisim, and micro-CAD learning system circuit design methods. In order to demonstrate how to conduct circuit experiments based on a virtual microcontroller in the laboratory, the PIC16F887 chip is used as the main logic element. Several actual hands-on experiments were demonstrated with the help of PVSM, and the results of each experiment were shown with snapshots. The purpose is to propose a learning technology method to allow students to participate in practice and become experts in learning embedded systems courses. In addition to student classroom teaching, this practical experiment will be an additional advantage and allow amateurs, professional scientists, and engineers to design and analyze [3]. Embedded systems must resolve many potential conflicting design constraints, such as flexibility, energy, heat, cost, performance, and safety, all of which face highly dynamic operating behaviors and environmental conditions. Dutt proposed that by adding intelligent elements, we hope that the resulting “smart” embedded system can operate correctly under the expected constraints, despite the highly dynamic changes in the application and environment, as well as the underlying software/hardware platform. Since terms related to “intelligence” (for example, self-awareness, adaptability, and autonomy) are widely used in many software and hardware computing environments, a taxonomy of “self-x” terms has been proposed and used. This classification is used to correlate the main “smart” software and hardware computing tasks. One of the main attributes of the intelligent embedded system is the concept of self-awareness, which enables the embedded system to monitor its own state and behavior as well as the external environment in order to adapt intelligently. Home appliances will be the largest application field of intelligent embedded systems, and intelligent refrigerators and air conditioners will lead people’s lives to a brand-new space. Even when you are not at home, you can remotely control your home appliances through the network [4]. Many emerging applications such as the Internet of Things, wearable devices, and sensor networks have ultra-low power consumption requirements. At the same time, for cost and programmability considerations, many of these applications will be powered by general-purpose embedded microprocessors and microcontrollers (rather than ASIC). Cherupalli has taken advantage of a new opportunity to improve the energy efficiency of ultra-low-power processors, which are expected to promote these applications-dynamic timing slack. When the embedded software application executing on the processor does not execute the static critical path of the processor, dynamic timing slack occurs. In this case, the longest path executed by the application has an additional time delay. By reducing the voltage of the processor at the same frequency until the longest path executed just meets the time limit, it can be used without reducing performance costs. This time delay is used to save power. It is possible to safely allow paths that cannot be executed by the application to violate time constraints. The results show that dynamic timing slack exists in many ultra-low power applications, and the use of dynamic timing slack can bring significant power savings to any ultra-low power process. But the cost of application development is not low [5]. In recent years, technicians have continuously deepened their exploration of embedded systems. Computer vision is an interdisciplinary object detection field. Computer vision is the use of computers to process images to obtain the information we want. The target detection relay is an important part of auxiliary monitoring, vehicle detection, and attitude estimation. In this work, Madasamy proposed a new “deep YOLO V3” method to detect multiple objects. This method looks at the entire frame during the training and testing phases. It follows regression-based techniques and uses probabilistic models to locate objects. In the article, Madasamy constructed 106 convolutional layers, followed by 2 fully connected layers and an input size of 812×812×3 to detect small-sized drones. The pretrained convolutional layer is classified at half the resolution, and then the resolution is doubled for detection. The number of filters per layer will be set to 16. The number of filters in the last scale layer exceeds 16 to improve small target detection. This configuration uses an upsampling technique to improve the unwanted spectral image into an existing signal and rescale the feature at a specific location. It clearly reveals upsampling to detect small objects [6].


## 1.4. Main Structure

In Chapter 1, it mainly introduces the research background and significance of basketball and moving target detection and tracking, the development status and development trend of domestic and foreign theories and applications, and the main content of related work and papers. Chapter 2 introduces the software and hardware structure of embedded systems; outlines three common target detection algorithms; including the complexity and advantages and disadvantages of the algorithms; and introduces the improved four-frame hybrid differential method to detect targets and to move the implementation of four algorithms for target detection. Chapter 3 introduces the work related to experiments, Chapter 4 comparison and performance test of various algorithms after the experiment, and Chapter 5 the summary, where it summarizes the design of the entire system and the achieved target effects, evaluates the system’s deficiencies, and clarifies the future development direction.


## 2. Basketball Mobile Test Method Based on Embedded Target Detection Intelligent System

### 2.1. Embedded System

Embedded system is an application-centric, computer-based dedicated computer system. Software and equipment can be reduced, and it can meet the strict requirements of the implementation system in terms of operation, reliability, cost, volume and energy consumption, etc. The embedded system is highly specialized and is usually oriented to a specific application; the miniaturization of the volume is conducive to the realization of miniaturization, and it is convenient to embed the embedded system into the target system; the real-time performance is good. As shown in Figure1, this is an embedded system architecture based on ARM [7].Figure 1
Embedded system structure based on ARM.


#### 2.1.1. Hardware System Platform

In order to save time and reduce investment costs, it is very important to choose a set of integrated development environment as the development environment of ARM so that when in use the PC can support editing, compiling, assembling, linking, and other tasks. The ARM processor itself is a bit design, but it is also equipped with a 16-bit instruction set, which retains all the advantages of a 32-bit system; the addition of the DSP instruction set to the CPU function provides enhanced 16-bit and 32-bit arithmetic operation capabilities, improving performance and flexibility. What is used here is the embedded development platform with S3C214 microprocessor as the core of the system. As shown in Figure2, this is the ARM program development process [8].Figure 2
ARM program development process.For the research of application platform, this system intends to adopt embedded platform as the operating environment, because compared with Windows platform, embedded platform has the characteristics of low power consumption, stability, reliability, and mobility. There are several issues that need to be addressed when developing on an embedded platform. First of all, on how to collect and store images, the technical solution to be adopted in this article is to build an ARM microprocessor system, plus appropriate peripheral equipment, to capture images through a camera connected to the ARM board. As for the storage of images, consider using SQLite, a unique database for embedded systems, because the database is syntactically similar to a relational database, which can be quickly mastered by those who have some experience in using databases. Next, we need to solve the tracking problem of moving objects in the frame sequence, and we plan to use the OpenCV open source library to design the tracking algorithm. The Opencv library is an open source library with mature computing vision. It is a cross-platform library that can be easily ported to the ARM panel without modification in the code. Finally, for the development platform of the system, it is planned to use Qt Creator. Qt is a commonly used graphical user interface development platform under Linux with abundant relevant technical documents [9].


### 2.2. Target Detection

Moving target detection is to extract the moving foreground from the background image. Firstly, the background model is obtained by the statistical method, and the morphological method and the area of the connected domain are used for post-processing to eliminate the influence of noise and background disturbance and obtain an accurate moving target. But often due to interference from external factors such as weather and light, motion detection is not a simple matter. Commonly used moving target detection methods include optical flow method, background difference method, and adjacent frame difference method.


#### 2.2.1. Optical Flow Method

Optical flow refers to the brightness information of an image. The advantage of this method is that the target object can be extracted without knowing the historical data of the moving object in the image and the effect is good. The disadvantage is that the amount of calculation is too large, and the program implementation is complicated [10].The background difference method is a common method to identify and extract moving regions. The basic principle is to subtract the current frame in the image sequence and the acquired background reference model and calculate the pixel difference with the background image, so as to determine the position, outline, size, and other characteristics of the moving object. The creation of the background model is an important step to determine the effect of motion area detection. The creation of the background model is divided into a simple background model and a Gaussian background model. The so-called simple background model uses a still image as a background model. If the difference between the color value of the pixel at the same position in the background image and the color value of the pixel in the current frame is greater than the threshold, it is regarded as a moving target image; otherwise, it is regarded as a background image.This algorithm is relatively simple to operate, but it is easy to affect the effect due to weather factors such as brightness, because the selected limit value is obtained through a series of experiments and is not suitable for the dynamic changes of basketball. The mixed Gaussian model uses the weighted sum of multiple Gaussian components to obtain the approximate distribution of light points, has a good detection effect, improves the shortcomings of the simple background model, and can adapt to changes in background illumination. The disadvantage is that the amount of calculation is very large, so it will be very slow in the experiment [11].The principle of the adjacent frame difference method is to obtain the moving target area by making the difference between two adjacent frames. This algorithm is relatively easy and can adapt to changes in brightness and other natural environments. However, when this method detects high-speed moving targets, the output area will be much larger than the actual size of the target, and it is difficult to accurately identify the slow moving and stationary objects we perceive. When facing objects with relatively uniform gray values inside, it is not possible to extract all the relevant feature pixels, and the extracted image may have a hole effect, which will affect the next experiment [12]. The concept of the four-frame hybrid differential method is introduced below.
(1)
Flow chart of the algorithmThe overall flow chart of the algorithm is shown in Figure3.
(2)
Improvement of inter-frame difference method-hybrid difference methodFigure 3
Algorithm flow chartIn this method, the first three image frames are stored, and the fourth frame image and the stored image are correspondingly differentiated two by two so that the sensitivity of the first stage recognition of moving targets can be enhanced. LetYt(m,n) be the image at time t, Yt−k (m,n) be the image saved at time t−k, and (m,n) be the position of the same pixel in each frame of image; At−kt(m,n) represents the difference between the t and t−k frames at (m, n) pixels. In continuous experimentation, it is concluded that in using the hybrid difference method to obtain object images, when k=3 is the most accurate and clear.Which is(1)At−3tm,n=Ytm,n−Yt−3m,n,(2)At−2tm,n=Ytm,n−Yt−2m,n,(3)At−1tm,n=Ytm,n−Yt−1m,n.The difference image obtained by Formulas (1), (2), and (3), using threshold value discrimination, obtains the binarized image:
(4)At−ktm,n=1At−ktm,n≥T0At−ktm,n<T.Perform logical OR operation on the binarized image obtained in Formula (4), and the result obtained is the final image after mixing and difference; we get
(5)Am,n=At−1tm,n∨At−2tm,n∨∙∙∙∨Dt−ktm,n.TheAm,n obtained by Formula (5) is the final extracted and detected moving target [13].
(3)
Determination of the threshold of the hybrid difference methodIn this article, the threshold S is determined by an adaptive method. Choosing an accurate threshold is very important for the foreground and background of the entire segmented image. The most commonly used methods to determine the threshold are iterative method, histogram method, adaptive local threshold method, and maximum between-class variance method.The iterative method is easier to understand, but it has a large amount of calculation and slow processing speed. The histogram method is only suitable for the phenomenon where the image presents an obvious double-humped gray histogram. It can display the state of quality fluctuation and transmit information about the quality of the process more intuitively; after studying the state of quality fluctuation, you can grasp the state of the process and carry out quality improvement work. The adaptive local threshold method is suitable for scenes with brightness, and when there is sudden noise in the segmented image, the processing speed is also very slow, and artifacts may appear [14].OTSU is a method of maximizing the variance between classes. It uses the most accurate boundary value to divide the gray histogram into two parts and maximizes the difference between the variance values between the two parts, that is, the maximum separation. It divides the image into two parts: background and foreground according to the grayscale characteristics of the image. The greater the interclass variance between the background and the foreground, the greater the difference between the two parts that make up the image. The background is wrongly divided into the foreground, which will cause the difference between the two parts to become smaller. This method has fast calculation speed and strong real-time performance [15]. The steps are as follows: Assuming that the gray level of the image is in the region (0~255), the gray level m has nm pixels, and then the probability function is extracted from the gray level histogram:
(6)Pm=nmN.The thresholdS is selected to divide the gray levels into two categories: B1=0,1,2,⋯,S and B2=S+1,S+2,⋯,255; therefore:
(7)w0=prC1=∑m=0Spm=wt,(8)w1=prC2=∑m=S+1255pm=1−wt,(9)μ0=∑m=0Smpmw0=μtwt,(10)μ1=∑m=S+1255mpmw1=μT−μt1−wt.From Formulas (7), (8), (9), and (10), we can get
(11)μS=ω0μ0+ω1μ1,ω0+ω1=1.Among them,ω0 is the probability attributed to the foreground pixel, μ0 is the average gray level, ω1 is defined as the probability attributed to the background pixel, μ1 is the average gray level, and μS is the average gray level of the entire frame of image. The between-class variance of C1 and C2 is
(12)θ=ω0μ0−μS2+ω1μ1−μS2.Substitute (11) into (12) to get
(13)θ=ω0ω1μ0−μ12.In order to maximize the value of the variance between classes, the most appropriate thresholdS is selected, which is the final threshold.Table1 shows the calculated thresholds for some specific frames, as follows.Table 1
Thresholds calculated for different frame sequences.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold1001912019150101801020072307250152801530012330123201735017In this paper, the maximum between-class variance method is improved. The improved algorithm first divides the difference image into multiple regions and then uses the algorithm to calculate the threshold for each region and then adds all the thresholds, divides by the number of divided blocks, and calculates the average Threshold, this value is the threshold for binarization of the entire image [16]. The mathematical expression is as follows:
(14)S=∑m=0nsm/n.In the formula,S represents the output result,sm represents the threshold of the m-th small area of the image, and n represents the number of divided areas.This is the threshold of some specific frames calculated after improvement, as shown in Table2.Table 2
Thresholds calculated by different frame sequences after improvement.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold10020120121509180820062307250152801530013330133201335017The derivation process of the OTSU method shows that the final threshold is obtained by performing variance calculation on each gray value. Assuming that the time consumption for variance calculation for each gray level isT1, it takes 256 T1 time for the entire frame of image analyze the large amount of calculations on the whole, so appropriate improvements should be made in this regard to reduce the search time and achieve high calculation efficiency.The gray value of the image is between 0 and 255, so we choose to calculate every 10 gray levels to reduce the number of calculations and calculate the value that maximizes the between-class varianceθ and set it to t and then calculate each level of gray in the interval t−∆x,t+∆x to find the value of t that maximizes θ. There are two special cases for the required t:
(1)
t−∆x<0; then calculate each gray level in the interval [0,t- ∆x].(2)
)t+∆x>255; calculate each gray level on t+∆x,255.Using this method to calculate the threshold, the consumption time is 35T1 or 45T1, which is 5 to 6 times faster than the time required without improvement.


### 2.3. Basketball Moving Test Method Based on Target Detection

#### 2.3.1. System Composition

This system is mainly composed of a camera, an ARM development board, and a PC-side serial port auxiliary tool, as shown in Figure4.Figure 4
Composition of moving target detection system.The following describes the functions and characteristics of each part shown in Figure4:
(1)
The camera used in this topic supports HTTP service, with JPEG output function, and its output image size is320×240; it supports RTSP protocol and has MPEG4 video output function. This camera is the source of visual data for this system(2)
The ARM development board CPU used in this subject is ARM S3C2410, with a main frequency of 203 MHz, with one RJ-45 interface and two RS-232 interfaces. Embedded Linux is installed, kernel version 2.6.10. The main algorithm logic of this control system runs on this development board(3)
The PC serial port auxiliary tool is a program running on the PC, which can receive, interpret, and display the serial data sent by the development board to the PC in real time and make some prompts [17].


#### 2.3.2. Design of System Software

The main control program here is an image acquisition, decoding, filtering, segmentation, and follow-up running on the ARM development board.In the trace multithreaded program, the main modules include image acquisition module, image decoding module, moving object detection and shadow elimination module, and moving object tracking module.Since the target system is an embedded software system that can run on the development board in quasi-real time, its operating environment is the embedded Linus operating system, which means that the development process is roughly divided into three steps:(1)
Implement various candidate algorithms on the PC to evaluate the effect and time and space complexity(2)
Porting from other platforms to Linus operating system and running on board(3)
According to the characteristics of the CPU, the key parts of the code are optimized at the C language level so that the running speed is improved and the quasi-real-time operation is realized.If the Linus operating system has been used on the PC from the beginning of development, step one and step two can be combined. Here, for convenience in the development process, step one is completed using VC6 on the Windows platform. At this time, you can easily observe the operating effect of the algorithm through the display module for debugging and make a subjective evaluation.Step two is completed on the Fedora Core4 release version Linus, which is mainly due to the fact that its kernel is close to the kernel used by the embedded Linus on the development board. This step uses samba, vnc, nfs, and other services. Samba is used to conveniently access the program code on Fedora on windows and to modify it with a convenient text editing tool. vnc is a universal remote desktop program that provides a way to access Fedora graphical interface on windows for compiling, debugging, and other operations. In this way, the entire development can be completed in front of a computer, which improves development efficiency. nfs is used to enable the development board to access and run cross-compiled executable programs without programming, avoiding the slow programming process [18]. The third step is to use the ARM integrated development environment to complete on the windows platform by establishing a unit project.


#### 2.3.3. Image Acquisition Module

The camera we use can output compressed images in JPEG format via HTTP protocol. It can also output the MPEG4 format baseline video stream through the RTP protocol, the frame rate is 25 frames per second, and the I frame period is 30 frames.The reason why MPEG4 video stream is not used as the source of visual information is mainly due to the following considerations. Because the MPEG4 format baseline video stream essentially uses the H.263 protocol processing method, its P frame decoding complexity is relatively small, but the P frame decoding complexity is relatively large; if the H.263 protocol is used as the visual data source, it will cause a lot of frame loss due to the inability to process in time. If the P frame is lost, the decoding will fail, and the picture cannot be recomposed until the I frame appears. The I frame period is 30 frames and will only appear after about 1.2 seconds, which will cause serious real-time problems. Therefore, compressed images in JPEG format are used as visual data sources [19].The image acquisition module is responsible for using HTTP protocol to obtain JPEG format picture files from the web camera. Since the network is an unstable and unreliable environment, you must make full legality judgments before doing JPEG decoding. This can reduce the impact of the system from network equipment errors and improve the robustness of the system.The basic steps are as follows:(1)
Establish a TCP connection with port 80 of the camera(2)
Send HTTP GET request(3)
Receive the response, and judge whether the response code is OK; if not, return(4)
Extract the content and make some judgments to prevent the occurrence of errors(5)
If it is normal, the JPEG image is obtained, and the starting address of the image is returned to [20]


#### 2.3.4. Implementation and Optimization of Image Decoding Module

JPEG image file decoding steps are roughly as follows:(1)
Read the file information from the file header. JPEG file data is divided into two parts: file header and image data. The file header records important information, such as image output, length and width, sampling factor, quantum table, and Huffman table. Therefore, before decoding, for image data decoding processing, the information in the file header should be read(2)
Read the MCU from the image data stream, and extract each internal color unit on how to separate continuously stored MCUs from the data stream and how to separate multiple color elements from each MCU(3)
The color component unit shall be restored from the data stream to the matrix data. Use the Huffman table provided in the file header to decode the component unit and return it to the8×8 data matrixThe8×8 data sheet should be further decoded. This part of the decryption work takes 8×8 data units as a unit and includes five steps: differential decoding of the direct current coefficients of adjacent matrices, reverse quantum data using the quantum table provided in the file header, reversezig-zag glyph encoding, interlaced positive and negative correction, and reverse discrete synthesis. The final output is still in the form of a data matrix8×8.
(4)
The color system YCrCb is converted to RGB. Integrate the decoding results of each color unit of the MCU to convert the image color system from YCrCb to RGB(5)
Classification and sorting of decoded data for each MCU. Continue to read and decode the MCU in the data stream until all MCU are read, and the decoded data of each MCU is correctly organized in the complete picture [21]


#### 2.3.5. Realize the Moving Object Detection Algorithm

Moving object detection is an important technology used here. Moving object detection is one of the basic functions of image content analysis. It is usually a process of generating an alarm when it is confirmed that the suspicious target is indeed a foreign moving individual after a certain period of time. The currently implemented moving object detection algorithms have three simple background subtraction methods, single Gaussian background model method, and mixed Gaussian background model method. The principles and characteristics of the three algorithms are compared as follows:(i)
Simple background subtraction: Use a fixed frame as the scene, subtract the current frame from the background frame, and use the consistent threshold to determine whether the pixel is background. All calculations are done in the gray domain. The advantage is low time and space complexity, but due to the use of a unified threshold, the effect is moderate.(ii)
Single Gaussian model method: Each pixel uses a Gaussian model as the background point type and matches the current frame pixel with the background point model. If it falls within the model, it is judged as the background, and the model mean and variance are updated. On the contrary, it is judged as the foreground and background learning is not carried out. All calculations are done in the gray domain. The effect is moderate, the time complexity is greater than the background subtraction method, and the space complexity is greater [22].(iii)
Mixed Gaussian model method: Each pixel uses multiple Gaussian models as the background point model and uses the weight to represent the possibility that the model is a background. The model with the largest weight is considered the background, and the remaining models are considered the foreground. After each pixel is matched, the weight, model mean, and variance are updated once. All calculations are done in the gray domain. The adaptive ability is strong, and the effect is better, but the time and space complexity are large [23]. A mixture model is a probabilistic model that can be used to represent K subdistributions in the overall distribution. It does not require the observation data to provide information about the subdistribution, but only calculates the probability of the observation data in the overall distribution.The principle of the shadow elimination part is as follows:When a point is judged as a front scenic spot by the above detection algorithm, the change in the HSV domain of the point relative to the background point is detected. It is removed from the foreground.This module will finally obtain the binary result of the pixel domain separated from the front and background, the static background is represented by 0, and the moving foreground is represented by 1 [24].Since the YCrCb domain itself also directly characterizes the luminance and chrominance information, the work of the HSV domain should be replaced by the YCrCb domain to a certain extent. Since the common shadow elimination module considers that the chroma and saturation changes less and the brightness changes a lot, it is a shadow, so it can also be considered to directly use a large chroma change as the basis for foreground detection. Purely changing from subtraction logic to supplementary logic, even if noise may be introduced, these noises consist of two parts: one is true shadows that should be subtracted but not subtracted, and the other is false prospects that should not be supplemented but added. The large chromaticity change has prevented the false foreground from being supplemented. The only problem is the introduction of true shadows, which can be offset by increasing the brightness change threshold [25].Therefore, a prospect admission rule characterizing the YCrCb domain is designed here, which is briefly described as follows.LetYm, Crm, Cbm, and N represent the Y, Cr, and Cb component values of a certain pixel in the current frame. Ymn、Crmn、Cbmn, respectively, represent the values of Y, Cr, and Cb components of the corresponding pixels of the background frame.Delimit:(15)∆Y=Ym−Ymn,∆Cr=Crm−Crmn,∆Cb=Cbm−Cbmn,∆rb=∆Cr−∆Cb,Rm=1Foreground∆Y≥TY∪∆rb≥Trb.0Backgroundotherwise


#### 2.3.6. Realization of Moving Object Prediction Algorithm

In this paper, Kalman filter is used to predict the area of the moving object in the next frame, and the predicted area is obtained. In order to improve the real-time performance of the algorithm, a simple constant velocity model is used. Suppose the target position isxpn、xqn, the speed is vpn、vqn, and the frame interval is T (when tracking in real time, T is 1), assuming u1n、u2n is zero mean variance, corresponding to Gaussian white noise of σ12、σ22, respectively, and Eu1nu2n=0, then Here the equation of motion is
(16)xn+1=Axn+wnThen,(17)xn=xpnvpnxqnvqnT,wn=0u1n0u2nT,(18)A=1T000100001T0001.The matching template measures the horizontal and vertical positions of the moving objects, which are marked asa1n and a2n. The measured noise v1n、v2n is Gaussian white noise with zero mean and variance σp2、σq2, respectively. The equation is
(19)xn+1=Axn+wn.In particular,(20)an=a1na2nT,vn=v1nv2nT,H=10000010.Kalman predicts the iteration process as follows:(21)Bn=APn∣n−1HTHPn∣n−1HT+C−1,x^n+1n=Ax^nn−1+Gnxn−Hx^nn−1,pn=I−A−1GnHPn∣n−1,pn+1∣n=APnAT+D,In particular,(22)D=EwnwTn=00000σ12000000000σ22,(23)C=EvnvTn=σp200σq2.The initial conditions of Kalman iteration arex^10,P10, namely:
(24)x^1∣0=a12a12−a11/Ta12a22−a21/TT,P1∣0=AP0AT+D.


## 2.1. Embedded System

Embedded system is an application-centric, computer-based dedicated computer system. Software and equipment can be reduced, and it can meet the strict requirements of the implementation system in terms of operation, reliability, cost, volume and energy consumption, etc. The embedded system is highly specialized and is usually oriented to a specific application; the miniaturization of the volume is conducive to the realization of miniaturization, and it is convenient to embed the embedded system into the target system; the real-time performance is good. As shown in Figure1, this is an embedded system architecture based on ARM [7].Figure 1
Embedded system structure based on ARM.


### 2.1.1. Hardware System Platform

In order to save time and reduce investment costs, it is very important to choose a set of integrated development environment as the development environment of ARM so that when in use the PC can support editing, compiling, assembling, linking, and other tasks. The ARM processor itself is a bit design, but it is also equipped with a 16-bit instruction set, which retains all the advantages of a 32-bit system; the addition of the DSP instruction set to the CPU function provides enhanced 16-bit and 32-bit arithmetic operation capabilities, improving performance and flexibility. What is used here is the embedded development platform with S3C214 microprocessor as the core of the system. As shown in Figure2, this is the ARM program development process [8].Figure 2
ARM program development process.For the research of application platform, this system intends to adopt embedded platform as the operating environment, because compared with Windows platform, embedded platform has the characteristics of low power consumption, stability, reliability, and mobility. There are several issues that need to be addressed when developing on an embedded platform. First of all, on how to collect and store images, the technical solution to be adopted in this article is to build an ARM microprocessor system, plus appropriate peripheral equipment, to capture images through a camera connected to the ARM board. As for the storage of images, consider using SQLite, a unique database for embedded systems, because the database is syntactically similar to a relational database, which can be quickly mastered by those who have some experience in using databases. Next, we need to solve the tracking problem of moving objects in the frame sequence, and we plan to use the OpenCV open source library to design the tracking algorithm. The Opencv library is an open source library with mature computing vision. It is a cross-platform library that can be easily ported to the ARM panel without modification in the code. Finally, for the development platform of the system, it is planned to use Qt Creator. Qt is a commonly used graphical user interface development platform under Linux with abundant relevant technical documents [9].


## 2.1.1. Hardware System Platform

In order to save time and reduce investment costs, it is very important to choose a set of integrated development environment as the development environment of ARM so that when in use the PC can support editing, compiling, assembling, linking, and other tasks. The ARM processor itself is a bit design, but it is also equipped with a 16-bit instruction set, which retains all the advantages of a 32-bit system; the addition of the DSP instruction set to the CPU function provides enhanced 16-bit and 32-bit arithmetic operation capabilities, improving performance and flexibility. What is used here is the embedded development platform with S3C214 microprocessor as the core of the system. As shown in Figure2, this is the ARM program development process [8].Figure 2
ARM program development process.For the research of application platform, this system intends to adopt embedded platform as the operating environment, because compared with Windows platform, embedded platform has the characteristics of low power consumption, stability, reliability, and mobility. There are several issues that need to be addressed when developing on an embedded platform. First of all, on how to collect and store images, the technical solution to be adopted in this article is to build an ARM microprocessor system, plus appropriate peripheral equipment, to capture images through a camera connected to the ARM board. As for the storage of images, consider using SQLite, a unique database for embedded systems, because the database is syntactically similar to a relational database, which can be quickly mastered by those who have some experience in using databases. Next, we need to solve the tracking problem of moving objects in the frame sequence, and we plan to use the OpenCV open source library to design the tracking algorithm. The Opencv library is an open source library with mature computing vision. It is a cross-platform library that can be easily ported to the ARM panel without modification in the code. Finally, for the development platform of the system, it is planned to use Qt Creator. Qt is a commonly used graphical user interface development platform under Linux with abundant relevant technical documents [9].


## 2.2. Target Detection

Moving target detection is to extract the moving foreground from the background image. Firstly, the background model is obtained by the statistical method, and the morphological method and the area of the connected domain are used for post-processing to eliminate the influence of noise and background disturbance and obtain an accurate moving target. But often due to interference from external factors such as weather and light, motion detection is not a simple matter. Commonly used moving target detection methods include optical flow method, background difference method, and adjacent frame difference method.


### 2.2.1. Optical Flow Method

Optical flow refers to the brightness information of an image. The advantage of this method is that the target object can be extracted without knowing the historical data of the moving object in the image and the effect is good. The disadvantage is that the amount of calculation is too large, and the program implementation is complicated [10].The background difference method is a common method to identify and extract moving regions. The basic principle is to subtract the current frame in the image sequence and the acquired background reference model and calculate the pixel difference with the background image, so as to determine the position, outline, size, and other characteristics of the moving object. The creation of the background model is an important step to determine the effect of motion area detection. The creation of the background model is divided into a simple background model and a Gaussian background model. The so-called simple background model uses a still image as a background model. If the difference between the color value of the pixel at the same position in the background image and the color value of the pixel in the current frame is greater than the threshold, it is regarded as a moving target image; otherwise, it is regarded as a background image.This algorithm is relatively simple to operate, but it is easy to affect the effect due to weather factors such as brightness, because the selected limit value is obtained through a series of experiments and is not suitable for the dynamic changes of basketball. The mixed Gaussian model uses the weighted sum of multiple Gaussian components to obtain the approximate distribution of light points, has a good detection effect, improves the shortcomings of the simple background model, and can adapt to changes in background illumination. The disadvantage is that the amount of calculation is very large, so it will be very slow in the experiment [11].The principle of the adjacent frame difference method is to obtain the moving target area by making the difference between two adjacent frames. This algorithm is relatively easy and can adapt to changes in brightness and other natural environments. However, when this method detects high-speed moving targets, the output area will be much larger than the actual size of the target, and it is difficult to accurately identify the slow moving and stationary objects we perceive. When facing objects with relatively uniform gray values inside, it is not possible to extract all the relevant feature pixels, and the extracted image may have a hole effect, which will affect the next experiment [12]. The concept of the four-frame hybrid differential method is introduced below.
(1)
Flow chart of the algorithmThe overall flow chart of the algorithm is shown in Figure3.
(2)
Improvement of inter-frame difference method-hybrid difference methodFigure 3
Algorithm flow chartIn this method, the first three image frames are stored, and the fourth frame image and the stored image are correspondingly differentiated two by two so that the sensitivity of the first stage recognition of moving targets can be enhanced. LetYt(m,n) be the image at time t, Yt−k (m,n) be the image saved at time t−k, and (m,n) be the position of the same pixel in each frame of image; At−kt(m,n) represents the difference between the t and t−k frames at (m, n) pixels. In continuous experimentation, it is concluded that in using the hybrid difference method to obtain object images, when k=3 is the most accurate and clear.Which is(1)At−3tm,n=Ytm,n−Yt−3m,n,(2)At−2tm,n=Ytm,n−Yt−2m,n,(3)At−1tm,n=Ytm,n−Yt−1m,n.The difference image obtained by Formulas (1), (2), and (3), using threshold value discrimination, obtains the binarized image:
(4)At−ktm,n=1At−ktm,n≥T0At−ktm,n<T.Perform logical OR operation on the binarized image obtained in Formula (4), and the result obtained is the final image after mixing and difference; we get
(5)Am,n=At−1tm,n∨At−2tm,n∨∙∙∙∨Dt−ktm,n.TheAm,n obtained by Formula (5) is the final extracted and detected moving target [13].
(3)
Determination of the threshold of the hybrid difference methodIn this article, the threshold S is determined by an adaptive method. Choosing an accurate threshold is very important for the foreground and background of the entire segmented image. The most commonly used methods to determine the threshold are iterative method, histogram method, adaptive local threshold method, and maximum between-class variance method.The iterative method is easier to understand, but it has a large amount of calculation and slow processing speed. The histogram method is only suitable for the phenomenon where the image presents an obvious double-humped gray histogram. It can display the state of quality fluctuation and transmit information about the quality of the process more intuitively; after studying the state of quality fluctuation, you can grasp the state of the process and carry out quality improvement work. The adaptive local threshold method is suitable for scenes with brightness, and when there is sudden noise in the segmented image, the processing speed is also very slow, and artifacts may appear [14].OTSU is a method of maximizing the variance between classes. It uses the most accurate boundary value to divide the gray histogram into two parts and maximizes the difference between the variance values between the two parts, that is, the maximum separation. It divides the image into two parts: background and foreground according to the grayscale characteristics of the image. The greater the interclass variance between the background and the foreground, the greater the difference between the two parts that make up the image. The background is wrongly divided into the foreground, which will cause the difference between the two parts to become smaller. This method has fast calculation speed and strong real-time performance [15]. The steps are as follows: Assuming that the gray level of the image is in the region (0~255), the gray level m has nm pixels, and then the probability function is extracted from the gray level histogram:
(6)Pm=nmN.The thresholdS is selected to divide the gray levels into two categories: B1=0,1,2,⋯,S and B2=S+1,S+2,⋯,255; therefore:
(7)w0=prC1=∑m=0Spm=wt,(8)w1=prC2=∑m=S+1255pm=1−wt,(9)μ0=∑m=0Smpmw0=μtwt,(10)μ1=∑m=S+1255mpmw1=μT−μt1−wt.From Formulas (7), (8), (9), and (10), we can get
(11)μS=ω0μ0+ω1μ1,ω0+ω1=1.Among them,ω0 is the probability attributed to the foreground pixel, μ0 is the average gray level, ω1 is defined as the probability attributed to the background pixel, μ1 is the average gray level, and μS is the average gray level of the entire frame of image. The between-class variance of C1 and C2 is
(12)θ=ω0μ0−μS2+ω1μ1−μS2.Substitute (11) into (12) to get
(13)θ=ω0ω1μ0−μ12.In order to maximize the value of the variance between classes, the most appropriate thresholdS is selected, which is the final threshold.Table1 shows the calculated thresholds for some specific frames, as follows.Table 1
Thresholds calculated for different frame sequences.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold1001912019150101801020072307250152801530012330123201735017In this paper, the maximum between-class variance method is improved. The improved algorithm first divides the difference image into multiple regions and then uses the algorithm to calculate the threshold for each region and then adds all the thresholds, divides by the number of divided blocks, and calculates the average Threshold, this value is the threshold for binarization of the entire image [16]. The mathematical expression is as follows:
(14)S=∑m=0nsm/n.In the formula,S represents the output result,sm represents the threshold of the m-th small area of the image, and n represents the number of divided areas.This is the threshold of some specific frames calculated after improvement, as shown in Table2.Table 2
Thresholds calculated by different frame sequences after improvement.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold10020120121509180820062307250152801530013330133201335017The derivation process of the OTSU method shows that the final threshold is obtained by performing variance calculation on each gray value. Assuming that the time consumption for variance calculation for each gray level isT1, it takes 256 T1 time for the entire frame of image analyze the large amount of calculations on the whole, so appropriate improvements should be made in this regard to reduce the search time and achieve high calculation efficiency.The gray value of the image is between 0 and 255, so we choose to calculate every 10 gray levels to reduce the number of calculations and calculate the value that maximizes the between-class varianceθ and set it to t and then calculate each level of gray in the interval t−∆x,t+∆x to find the value of t that maximizes θ. There are two special cases for the required t:
(1)
t−∆x<0; then calculate each gray level in the interval [0,t- ∆x].(2)
)t+∆x>255; calculate each gray level on t+∆x,255.Using this method to calculate the threshold, the consumption time is 35T1 or 45T1, which is 5 to 6 times faster than the time required without improvement.


## 2.2.1. Optical Flow Method

Optical flow refers to the brightness information of an image. The advantage of this method is that the target object can be extracted without knowing the historical data of the moving object in the image and the effect is good. The disadvantage is that the amount of calculation is too large, and the program implementation is complicated [10].The background difference method is a common method to identify and extract moving regions. The basic principle is to subtract the current frame in the image sequence and the acquired background reference model and calculate the pixel difference with the background image, so as to determine the position, outline, size, and other characteristics of the moving object. The creation of the background model is an important step to determine the effect of motion area detection. The creation of the background model is divided into a simple background model and a Gaussian background model. The so-called simple background model uses a still image as a background model. If the difference between the color value of the pixel at the same position in the background image and the color value of the pixel in the current frame is greater than the threshold, it is regarded as a moving target image; otherwise, it is regarded as a background image.This algorithm is relatively simple to operate, but it is easy to affect the effect due to weather factors such as brightness, because the selected limit value is obtained through a series of experiments and is not suitable for the dynamic changes of basketball. The mixed Gaussian model uses the weighted sum of multiple Gaussian components to obtain the approximate distribution of light points, has a good detection effect, improves the shortcomings of the simple background model, and can adapt to changes in background illumination. The disadvantage is that the amount of calculation is very large, so it will be very slow in the experiment [11].The principle of the adjacent frame difference method is to obtain the moving target area by making the difference between two adjacent frames. This algorithm is relatively easy and can adapt to changes in brightness and other natural environments. However, when this method detects high-speed moving targets, the output area will be much larger than the actual size of the target, and it is difficult to accurately identify the slow moving and stationary objects we perceive. When facing objects with relatively uniform gray values inside, it is not possible to extract all the relevant feature pixels, and the extracted image may have a hole effect, which will affect the next experiment [12]. The concept of the four-frame hybrid differential method is introduced below.
(1)
Flow chart of the algorithmThe overall flow chart of the algorithm is shown in Figure3.
(2)
Improvement of inter-frame difference method-hybrid difference methodFigure 3
Algorithm flow chartIn this method, the first three image frames are stored, and the fourth frame image and the stored image are correspondingly differentiated two by two so that the sensitivity of the first stage recognition of moving targets can be enhanced. LetYt(m,n) be the image at time t, Yt−k (m,n) be the image saved at time t−k, and (m,n) be the position of the same pixel in each frame of image; At−kt(m,n) represents the difference between the t and t−k frames at (m, n) pixels. In continuous experimentation, it is concluded that in using the hybrid difference method to obtain object images, when k=3 is the most accurate and clear.Which is(1)At−3tm,n=Ytm,n−Yt−3m,n,(2)At−2tm,n=Ytm,n−Yt−2m,n,(3)At−1tm,n=Ytm,n−Yt−1m,n.The difference image obtained by Formulas (1), (2), and (3), using threshold value discrimination, obtains the binarized image:
(4)At−ktm,n=1At−ktm,n≥T0At−ktm,n<T.Perform logical OR operation on the binarized image obtained in Formula (4), and the result obtained is the final image after mixing and difference; we get
(5)Am,n=At−1tm,n∨At−2tm,n∨∙∙∙∨Dt−ktm,n.TheAm,n obtained by Formula (5) is the final extracted and detected moving target [13].
(3)
Determination of the threshold of the hybrid difference methodIn this article, the threshold S is determined by an adaptive method. Choosing an accurate threshold is very important for the foreground and background of the entire segmented image. The most commonly used methods to determine the threshold are iterative method, histogram method, adaptive local threshold method, and maximum between-class variance method.The iterative method is easier to understand, but it has a large amount of calculation and slow processing speed. The histogram method is only suitable for the phenomenon where the image presents an obvious double-humped gray histogram. It can display the state of quality fluctuation and transmit information about the quality of the process more intuitively; after studying the state of quality fluctuation, you can grasp the state of the process and carry out quality improvement work. The adaptive local threshold method is suitable for scenes with brightness, and when there is sudden noise in the segmented image, the processing speed is also very slow, and artifacts may appear [14].OTSU is a method of maximizing the variance between classes. It uses the most accurate boundary value to divide the gray histogram into two parts and maximizes the difference between the variance values between the two parts, that is, the maximum separation. It divides the image into two parts: background and foreground according to the grayscale characteristics of the image. The greater the interclass variance between the background and the foreground, the greater the difference between the two parts that make up the image. The background is wrongly divided into the foreground, which will cause the difference between the two parts to become smaller. This method has fast calculation speed and strong real-time performance [15]. The steps are as follows: Assuming that the gray level of the image is in the region (0~255), the gray level m has nm pixels, and then the probability function is extracted from the gray level histogram:
(6)Pm=nmN.The thresholdS is selected to divide the gray levels into two categories: B1=0,1,2,⋯,S and B2=S+1,S+2,⋯,255; therefore:
(7)w0=prC1=∑m=0Spm=wt,(8)w1=prC2=∑m=S+1255pm=1−wt,(9)μ0=∑m=0Smpmw0=μtwt,(10)μ1=∑m=S+1255mpmw1=μT−μt1−wt.From Formulas (7), (8), (9), and (10), we can get
(11)μS=ω0μ0+ω1μ1,ω0+ω1=1.Among them,ω0 is the probability attributed to the foreground pixel, μ0 is the average gray level, ω1 is defined as the probability attributed to the background pixel, μ1 is the average gray level, and μS is the average gray level of the entire frame of image. The between-class variance of C1 and C2 is
(12)θ=ω0μ0−μS2+ω1μ1−μS2.Substitute (11) into (12) to get
(13)θ=ω0ω1μ0−μ12.In order to maximize the value of the variance between classes, the most appropriate thresholdS is selected, which is the final threshold.Table1 shows the calculated thresholds for some specific frames, as follows.Table 1
Thresholds calculated for different frame sequences.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold1001912019150101801020072307250152801530012330123201735017In this paper, the maximum between-class variance method is improved. The improved algorithm first divides the difference image into multiple regions and then uses the algorithm to calculate the threshold for each region and then adds all the thresholds, divides by the number of divided blocks, and calculates the average Threshold, this value is the threshold for binarization of the entire image [16]. The mathematical expression is as follows:
(14)S=∑m=0nsm/n.In the formula,S represents the output result,sm represents the threshold of the m-th small area of the image, and n represents the number of divided areas.This is the threshold of some specific frames calculated after improvement, as shown in Table2.Table 2
Thresholds calculated by different frame sequences after improvement.
Frame sequence numberOTSU thresholdFrame sequence numberOTSU threshold10020120121509180820062307250152801530013330133201335017The derivation process of the OTSU method shows that the final threshold is obtained by performing variance calculation on each gray value. Assuming that the time consumption for variance calculation for each gray level isT1, it takes 256 T1 time for the entire frame of image analyze the large amount of calculations on the whole, so appropriate improvements should be made in this regard to reduce the search time and achieve high calculation efficiency.The gray value of the image is between 0 and 255, so we choose to calculate every 10 gray levels to reduce the number of calculations and calculate the value that maximizes the between-class varianceθ and set it to t and then calculate each level of gray in the interval t−∆x,t+∆x to find the value of t that maximizes θ. There are two special cases for the required t:
(1)
t−∆x<0; then calculate each gray level in the interval [0,t- ∆x].(2)
)t+∆x>255; calculate each gray level on t+∆x,255.Using this method to calculate the threshold, the consumption time is 35T1 or 45T1, which is 5 to 6 times faster than the time required without improvement.


## 2.3. Basketball Moving Test Method Based on Target Detection

### 2.3.1. System Composition

This system is mainly composed of a camera, an ARM development board, and a PC-side serial port auxiliary tool, as shown in Figure4.Figure 4
Composition of moving target detection system.The following describes the functions and characteristics of each part shown in Figure4:
(1)
The camera used in this topic supports HTTP service, with JPEG output function, and its output image size is320×240; it supports RTSP protocol and has MPEG4 video output function. This camera is the source of visual data for this system(2)
The ARM development board CPU used in this subject is ARM S3C2410, with a main frequency of 203 MHz, with one RJ-45 interface and two RS-232 interfaces. Embedded Linux is installed, kernel version 2.6.10. The main algorithm logic of this control system runs on this development board(3)
The PC serial port auxiliary tool is a program running on the PC, which can receive, interpret, and display the serial data sent by the development board to the PC in real time and make some prompts [17].


### 2.3.2. Design of System Software

The main control program here is an image acquisition, decoding, filtering, segmentation, and follow-up running on the ARM development board.In the trace multithreaded program, the main modules include image acquisition module, image decoding module, moving object detection and shadow elimination module, and moving object tracking module.Since the target system is an embedded software system that can run on the development board in quasi-real time, its operating environment is the embedded Linus operating system, which means that the development process is roughly divided into three steps:(1)
Implement various candidate algorithms on the PC to evaluate the effect and time and space complexity(2)
Porting from other platforms to Linus operating system and running on board(3)
According to the characteristics of the CPU, the key parts of the code are optimized at the C language level so that the running speed is improved and the quasi-real-time operation is realized.If the Linus operating system has been used on the PC from the beginning of development, step one and step two can be combined. Here, for convenience in the development process, step one is completed using VC6 on the Windows platform. At this time, you can easily observe the operating effect of the algorithm through the display module for debugging and make a subjective evaluation.Step two is completed on the Fedora Core4 release version Linus, which is mainly due to the fact that its kernel is close to the kernel used by the embedded Linus on the development board. This step uses samba, vnc, nfs, and other services. Samba is used to conveniently access the program code on Fedora on windows and to modify it with a convenient text editing tool. vnc is a universal remote desktop program that provides a way to access Fedora graphical interface on windows for compiling, debugging, and other operations. In this way, the entire development can be completed in front of a computer, which improves development efficiency. nfs is used to enable the development board to access and run cross-compiled executable programs without programming, avoiding the slow programming process [18]. The third step is to use the ARM integrated development environment to complete on the windows platform by establishing a unit project.


### 2.3.3. Image Acquisition Module

The camera we use can output compressed images in JPEG format via HTTP protocol. It can also output the MPEG4 format baseline video stream through the RTP protocol, the frame rate is 25 frames per second, and the I frame period is 30 frames.The reason why MPEG4 video stream is not used as the source of visual information is mainly due to the following considerations. Because the MPEG4 format baseline video stream essentially uses the H.263 protocol processing method, its P frame decoding complexity is relatively small, but the P frame decoding complexity is relatively large; if the H.263 protocol is used as the visual data source, it will cause a lot of frame loss due to the inability to process in time. If the P frame is lost, the decoding will fail, and the picture cannot be recomposed until the I frame appears. The I frame period is 30 frames and will only appear after about 1.2 seconds, which will cause serious real-time problems. Therefore, compressed images in JPEG format are used as visual data sources [19].The image acquisition module is responsible for using HTTP protocol to obtain JPEG format picture files from the web camera. Since the network is an unstable and unreliable environment, you must make full legality judgments before doing JPEG decoding. This can reduce the impact of the system from network equipment errors and improve the robustness of the system.The basic steps are as follows:(1)
Establish a TCP connection with port 80 of the camera(2)
Send HTTP GET request(3)
Receive the response, and judge whether the response code is OK; if not, return(4)
Extract the content and make some judgments to prevent the occurrence of errors(5)
If it is normal, the JPEG image is obtained, and the starting address of the image is returned to [20]


### 2.3.4. Implementation and Optimization of Image Decoding Module

JPEG image file decoding steps are roughly as follows:(1)
Read the file information from the file header. JPEG file data is divided into two parts: file header and image data. The file header records important information, such as image output, length and width, sampling factor, quantum table, and Huffman table. Therefore, before decoding, for image data decoding processing, the information in the file header should be read(2)
Read the MCU from the image data stream, and extract each internal color unit on how to separate continuously stored MCUs from the data stream and how to separate multiple color elements from each MCU(3)
The color component unit shall be restored from the data stream to the matrix data. Use the Huffman table provided in the file header to decode the component unit and return it to the8×8 data matrixThe8×8 data sheet should be further decoded. This part of the decryption work takes 8×8 data units as a unit and includes five steps: differential decoding of the direct current coefficients of adjacent matrices, reverse quantum data using the quantum table provided in the file header, reversezig-zag glyph encoding, interlaced positive and negative correction, and reverse discrete synthesis. The final output is still in the form of a data matrix8×8.
(4)
The color system YCrCb is converted to RGB. Integrate the decoding results of each color unit of the MCU to convert the image color system from YCrCb to RGB(5)
Classification and sorting of decoded data for each MCU. Continue to read and decode the MCU in the data stream until all MCU are read, and the decoded data of each MCU is correctly organized in the complete picture [21]


### 2.3.5. Realize the Moving Object Detection Algorithm

Moving object detection is an important technology used here. Moving object detection is one of the basic functions of image content analysis. It is usually a process of generating an alarm when it is confirmed that the suspicious target is indeed a foreign moving individual after a certain period of time. The currently implemented moving object detection algorithms have three simple background subtraction methods, single Gaussian background model method, and mixed Gaussian background model method. The principles and characteristics of the three algorithms are compared as follows:(i)
Simple background subtraction: Use a fixed frame as the scene, subtract the current frame from the background frame, and use the consistent threshold to determine whether the pixel is background. All calculations are done in the gray domain. The advantage is low time and space complexity, but due to the use of a unified threshold, the effect is moderate.(ii)
Single Gaussian model method: Each pixel uses a Gaussian model as the background point type and matches the current frame pixel with the background point model. If it falls within the model, it is judged as the background, and the model mean and variance are updated. On the contrary, it is judged as the foreground and background learning is not carried out. All calculations are done in the gray domain. The effect is moderate, the time complexity is greater than the background subtraction method, and the space complexity is greater [22].(iii)
Mixed Gaussian model method: Each pixel uses multiple Gaussian models as the background point model and uses the weight to represent the possibility that the model is a background. The model with the largest weight is considered the background, and the remaining models are considered the foreground. After each pixel is matched, the weight, model mean, and variance are updated once. All calculations are done in the gray domain. The adaptive ability is strong, and the effect is better, but the time and space complexity are large [23]. A mixture model is a probabilistic model that can be used to represent K subdistributions in the overall distribution. It does not require the observation data to provide information about the subdistribution, but only calculates the probability of the observation data in the overall distribution.The principle of the shadow elimination part is as follows:When a point is judged as a front scenic spot by the above detection algorithm, the change in the HSV domain of the point relative to the background point is detected. It is removed from the foreground.This module will finally obtain the binary result of the pixel domain separated from the front and background, the static background is represented by 0, and the moving foreground is represented by 1 [24].Since the YCrCb domain itself also directly characterizes the luminance and chrominance information, the work of the HSV domain should be replaced by the YCrCb domain to a certain extent. Since the common shadow elimination module considers that the chroma and saturation changes less and the brightness changes a lot, it is a shadow, so it can also be considered to directly use a large chroma change as the basis for foreground detection. Purely changing from subtraction logic to supplementary logic, even if noise may be introduced, these noises consist of two parts: one is true shadows that should be subtracted but not subtracted, and the other is false prospects that should not be supplemented but added. The large chromaticity change has prevented the false foreground from being supplemented. The only problem is the introduction of true shadows, which can be offset by increasing the brightness change threshold [25].Therefore, a prospect admission rule characterizing the YCrCb domain is designed here, which is briefly described as follows.LetYm, Crm, Cbm, and N represent the Y, Cr, and Cb component values of a certain pixel in the current frame. Ymn、Crmn、Cbmn, respectively, represent the values of Y, Cr, and Cb components of the corresponding pixels of the background frame.Delimit:(15)∆Y=Ym−Ymn,∆Cr=Crm−Crmn,∆Cb=Cbm−Cbmn,∆rb=∆Cr−∆Cb,Rm=1Foreground∆Y≥TY∪∆rb≥Trb.0Backgroundotherwise


### 2.3.6. Realization of Moving Object Prediction Algorithm

In this paper, Kalman filter is used to predict the area of the moving object in the next frame, and the predicted area is obtained. In order to improve the real-time performance of the algorithm, a simple constant velocity model is used. Suppose the target position isxpn、xqn, the speed is vpn、vqn, and the frame interval is T (when tracking in real time, T is 1), assuming u1n、u2n is zero mean variance, corresponding to Gaussian white noise of σ12、σ22, respectively, and Eu1nu2n=0, then Here the equation of motion is
(16)xn+1=Axn+wnThen,(17)xn=xpnvpnxqnvqnT,wn=0u1n0u2nT,(18)A=1T000100001T0001.The matching template measures the horizontal and vertical positions of the moving objects, which are marked asa1n and a2n. The measured noise v1n、v2n is Gaussian white noise with zero mean and variance σp2、σq2, respectively. The equation is
(19)xn+1=Axn+wn.In particular,(20)an=a1na2nT,vn=v1nv2nT,H=10000010.Kalman predicts the iteration process as follows:(21)Bn=APn∣n−1HTHPn∣n−1HT+C−1,x^n+1n=Ax^nn−1+Gnxn−Hx^nn−1,pn=I−A−1GnHPn∣n−1,pn+1∣n=APnAT+D,In particular,(22)D=EwnwTn=00000σ12000000000σ22,(23)C=EvnvTn=σp200σq2.The initial conditions of Kalman iteration arex^10,P10, namely:
(24)x^1∣0=a12a12−a11/Ta12a22−a21/TT,P1∣0=AP0AT+D.


## 2.3.1. System Composition

This system is mainly composed of a camera, an ARM development board, and a PC-side serial port auxiliary tool, as shown in Figure4.Figure 4
Composition of moving target detection system.The following describes the functions and characteristics of each part shown in Figure4:
(1)
The camera used in this topic supports HTTP service, with JPEG output function, and its output image size is320×240; it supports RTSP protocol and has MPEG4 video output function. This camera is the source of visual data for this system(2)
The ARM development board CPU used in this subject is ARM S3C2410, with a main frequency of 203 MHz, with one RJ-45 interface and two RS-232 interfaces. Embedded Linux is installed, kernel version 2.6.10. The main algorithm logic of this control system runs on this development board(3)
The PC serial port auxiliary tool is a program running on the PC, which can receive, interpret, and display the serial data sent by the development board to the PC in real time and make some prompts [17].


## 2.3.2. Design of System Software

The main control program here is an image acquisition, decoding, filtering, segmentation, and follow-up running on the ARM development board.In the trace multithreaded program, the main modules include image acquisition module, image decoding module, moving object detection and shadow elimination module, and moving object tracking module.Since the target system is an embedded software system that can run on the development board in quasi-real time, its operating environment is the embedded Linus operating system, which means that the development process is roughly divided into three steps:(1)
Implement various candidate algorithms on the PC to evaluate the effect and time and space complexity(2)
Porting from other platforms to Linus operating system and running on board(3)
According to the characteristics of the CPU, the key parts of the code are optimized at the C language level so that the running speed is improved and the quasi-real-time operation is realized.If the Linus operating system has been used on the PC from the beginning of development, step one and step two can be combined. Here, for convenience in the development process, step one is completed using VC6 on the Windows platform. At this time, you can easily observe the operating effect of the algorithm through the display module for debugging and make a subjective evaluation.Step two is completed on the Fedora Core4 release version Linus, which is mainly due to the fact that its kernel is close to the kernel used by the embedded Linus on the development board. This step uses samba, vnc, nfs, and other services. Samba is used to conveniently access the program code on Fedora on windows and to modify it with a convenient text editing tool. vnc is a universal remote desktop program that provides a way to access Fedora graphical interface on windows for compiling, debugging, and other operations. In this way, the entire development can be completed in front of a computer, which improves development efficiency. nfs is used to enable the development board to access and run cross-compiled executable programs without programming, avoiding the slow programming process [18]. The third step is to use the ARM integrated development environment to complete on the windows platform by establishing a unit project.


## 2.3.3. Image Acquisition Module

The camera we use can output compressed images in JPEG format via HTTP protocol. It can also output the MPEG4 format baseline video stream through the RTP protocol, the frame rate is 25 frames per second, and the I frame period is 30 frames.The reason why MPEG4 video stream is not used as the source of visual information is mainly due to the following considerations. Because the MPEG4 format baseline video stream essentially uses the H.263 protocol processing method, its P frame decoding complexity is relatively small, but the P frame decoding complexity is relatively large; if the H.263 protocol is used as the visual data source, it will cause a lot of frame loss due to the inability to process in time. If the P frame is lost, the decoding will fail, and the picture cannot be recomposed until the I frame appears. The I frame period is 30 frames and will only appear after about 1.2 seconds, which will cause serious real-time problems. Therefore, compressed images in JPEG format are used as visual data sources [19].The image acquisition module is responsible for using HTTP protocol to obtain JPEG format picture files from the web camera. Since the network is an unstable and unreliable environment, you must make full legality judgments before doing JPEG decoding. This can reduce the impact of the system from network equipment errors and improve the robustness of the system.The basic steps are as follows:(1)
Establish a TCP connection with port 80 of the camera(2)
Send HTTP GET request(3)
Receive the response, and judge whether the response code is OK; if not, return(4)
Extract the content and make some judgments to prevent the occurrence of errors(5)
If it is normal, the JPEG image is obtained, and the starting address of the image is returned to [20]


## 2.3.4. Implementation and Optimization of Image Decoding Module

JPEG image file decoding steps are roughly as follows:(1)
Read the file information from the file header. JPEG file data is divided into two parts: file header and image data. The file header records important information, such as image output, length and width, sampling factor, quantum table, and Huffman table. Therefore, before decoding, for image data decoding processing, the information in the file header should be read(2)
Read the MCU from the image data stream, and extract each internal color unit on how to separate continuously stored MCUs from the data stream and how to separate multiple color elements from each MCU(3)
The color component unit shall be restored from the data stream to the matrix data. Use the Huffman table provided in the file header to decode the component unit and return it to the8×8 data matrixThe8×8 data sheet should be further decoded. This part of the decryption work takes 8×8 data units as a unit and includes five steps: differential decoding of the direct current coefficients of adjacent matrices, reverse quantum data using the quantum table provided in the file header, reversezig-zag glyph encoding, interlaced positive and negative correction, and reverse discrete synthesis. The final output is still in the form of a data matrix8×8.
(4)
The color system YCrCb is converted to RGB. Integrate the decoding results of each color unit of the MCU to convert the image color system from YCrCb to RGB(5)
Classification and sorting of decoded data for each MCU. Continue to read and decode the MCU in the data stream until all MCU are read, and the decoded data of each MCU is correctly organized in the complete picture [21]


## 2.3.5. Realize the Moving Object Detection Algorithm

Moving object detection is an important technology used here. Moving object detection is one of the basic functions of image content analysis. It is usually a process of generating an alarm when it is confirmed that the suspicious target is indeed a foreign moving individual after a certain period of time. The currently implemented moving object detection algorithms have three simple background subtraction methods, single Gaussian background model method, and mixed Gaussian background model method. The principles and characteristics of the three algorithms are compared as follows:(i)
Simple background subtraction: Use a fixed frame as the scene, subtract the current frame from the background frame, and use the consistent threshold to determine whether the pixel is background. All calculations are done in the gray domain. The advantage is low time and space complexity, but due to the use of a unified threshold, the effect is moderate.(ii)
Single Gaussian model method: Each pixel uses a Gaussian model as the background point type and matches the current frame pixel with the background point model. If it falls within the model, it is judged as the background, and the model mean and variance are updated. On the contrary, it is judged as the foreground and background learning is not carried out. All calculations are done in the gray domain. The effect is moderate, the time complexity is greater than the background subtraction method, and the space complexity is greater [22].(iii)
Mixed Gaussian model method: Each pixel uses multiple Gaussian models as the background point model and uses the weight to represent the possibility that the model is a background. The model with the largest weight is considered the background, and the remaining models are considered the foreground. After each pixel is matched, the weight, model mean, and variance are updated once. All calculations are done in the gray domain. The adaptive ability is strong, and the effect is better, but the time and space complexity are large [23]. A mixture model is a probabilistic model that can be used to represent K subdistributions in the overall distribution. It does not require the observation data to provide information about the subdistribution, but only calculates the probability of the observation data in the overall distribution.The principle of the shadow elimination part is as follows:When a point is judged as a front scenic spot by the above detection algorithm, the change in the HSV domain of the point relative to the background point is detected. It is removed from the foreground.This module will finally obtain the binary result of the pixel domain separated from the front and background, the static background is represented by 0, and the moving foreground is represented by 1 [24].Since the YCrCb domain itself also directly characterizes the luminance and chrominance information, the work of the HSV domain should be replaced by the YCrCb domain to a certain extent. Since the common shadow elimination module considers that the chroma and saturation changes less and the brightness changes a lot, it is a shadow, so it can also be considered to directly use a large chroma change as the basis for foreground detection. Purely changing from subtraction logic to supplementary logic, even if noise may be introduced, these noises consist of two parts: one is true shadows that should be subtracted but not subtracted, and the other is false prospects that should not be supplemented but added. The large chromaticity change has prevented the false foreground from being supplemented. The only problem is the introduction of true shadows, which can be offset by increasing the brightness change threshold [25].Therefore, a prospect admission rule characterizing the YCrCb domain is designed here, which is briefly described as follows.LetYm, Crm, Cbm, and N represent the Y, Cr, and Cb component values of a certain pixel in the current frame. Ymn、Crmn、Cbmn, respectively, represent the values of Y, Cr, and Cb components of the corresponding pixels of the background frame.Delimit:(15)∆Y=Ym−Ymn,∆Cr=Crm−Crmn,∆Cb=Cbm−Cbmn,∆rb=∆Cr−∆Cb,Rm=1Foreground∆Y≥TY∪∆rb≥Trb.0Backgroundotherwise


## 2.3.6. Realization of Moving Object Prediction Algorithm

In this paper, Kalman filter is used to predict the area of the moving object in the next frame, and the predicted area is obtained. In order to improve the real-time performance of the algorithm, a simple constant velocity model is used. Suppose the target position isxpn、xqn, the speed is vpn、vqn, and the frame interval is T (when tracking in real time, T is 1), assuming u1n、u2n is zero mean variance, corresponding to Gaussian white noise of σ12、σ22, respectively, and Eu1nu2n=0, then Here the equation of motion is
(16)xn+1=Axn+wnThen,(17)xn=xpnvpnxqnvqnT,wn=0u1n0u2nT,(18)A=1T000100001T0001.The matching template measures the horizontal and vertical positions of the moving objects, which are marked asa1n and a2n. The measured noise v1n、v2n is Gaussian white noise with zero mean and variance σp2、σq2, respectively. The equation is
(19)xn+1=Axn+wn.In particular,(20)an=a1na2nT,vn=v1nv2nT,H=10000010.Kalman predicts the iteration process as follows:(21)Bn=APn∣n−1HTHPn∣n−1HT+C−1,x^n+1n=Ax^nn−1+Gnxn−Hx^nn−1,pn=I−A−1GnHPn∣n−1,pn+1∣n=APnAT+D,In particular,(22)D=EwnwTn=00000σ12000000000σ22,(23)C=EvnvTn=σp200σq2.The initial conditions of Kalman iteration arex^10,P10, namely:
(24)x^1∣0=a12a12−a11/Ta12a22−a21/TT,P1∣0=AP0AT+D.


## 3. Related Experiments of Basketball Movement Test Based on the Embedded Target Detection Intelligent System

### 3.1. Subjects

Because there are more basketball games on outdoor courts, the test was conducted in a mild outdoor environment with more uniform light and low wind speed. Choose an appropriate angle for easy collection of test material. The testing time is fixed from 2 pm to 5 pm to ensure that the influence of external factors is within acceptable limits. The experimental preparation stage is mainly aimed at the inspection of the material data playback material and the debugging of the equipment to ensure that no special failure occurs. Before the experiment, explain the experimental process and precautions to the basketball players. Table3 is the basic information of the six basketball players tested.Table 3
Basic information of tennis players.
NameXiao LingLi fenAverageAge262726.5Height (cm)175176175.5Weight (kg)696969Year of exercise (years)444Clapping handsRight handRight hand—Backhand styleBoth hands backhandBoth hands backhand—


### 3.2. Experimental Procedure

Use the RJ-45 interface used by the ARM development board to request pictures from the network camera via Ethernet, and receive the configuration information sent by the PC management program. Note that there are two RS-232 interfaces: One is used as a console to communicate with the host PC for development, and the other is used to send moving object detection information to the PC monitoring program and to record experimental data in time [26].


## 3.1. Subjects

Because there are more basketball games on outdoor courts, the test was conducted in a mild outdoor environment with more uniform light and low wind speed. Choose an appropriate angle for easy collection of test material. The testing time is fixed from 2 pm to 5 pm to ensure that the influence of external factors is within acceptable limits. The experimental preparation stage is mainly aimed at the inspection of the material data playback material and the debugging of the equipment to ensure that no special failure occurs. Before the experiment, explain the experimental process and precautions to the basketball players. Table3 is the basic information of the six basketball players tested.Table 3
Basic information of tennis players.
NameXiao LingLi fenAverageAge262726.5Height (cm)175176175.5Weight (kg)696969Year of exercise (years)444Clapping handsRight handRight hand—Backhand styleBoth hands backhandBoth hands backhand—


## 3.2. Experimental Procedure

Use the RJ-45 interface used by the ARM development board to request pictures from the network camera via Ethernet, and receive the configuration information sent by the PC management program. Note that there are two RS-232 interfaces: One is used as a console to communicate with the host PC for development, and the other is used to send moving object detection information to the PC monitoring program and to record experimental data in time [26].


## 4. System Performance Test and Evaluation

### 4.1. Effect and Performance Test of Moving Object Detection Algorithm

The renderings of each algorithm are given below.As shown in Figure5, when the light field is relatively stable, the first three algorithms have similar effects, and all have the phenomenon of foreground holes. This is mainly because the gray values of the foreground and background are relatively close, leading to missed judgments.Figure 5
Test effect diagram of single Gaussian model detection algorithm.As can be seen from Figure6, the background subtraction method of YCrCb color space can better protect the integrity of the foreground in this test. However, when the front and background brightness is close and the color is similar, the phenomenon of voids will also occur. Since the information used here comes from JPEG files, there is a large quantization error, and it is easy to produce shot noise on the background.Figure 6
Test effect diagram of YCrCb domain background subtraction model detection algorithm.As shown in Figure7, the running time test of the above four algorithms on the development board is as follows. The structure of the test is obtained by time stamping and subtracting, and the test sequence length is 1000 frames.Figure 7
Performance test of moving object detection algorithm.


### 4.2. The Effect and Performance Test of the Connected Domain Labeling Algorithm for Binary Images

As shown in Figure8, the following is the runtime test of this algorithm implementation on the development board. Use the YCrCb algorithm result as the test sequence; the test sequence length is 1000 frames.Figure 8
Performance test of moving object detection algorithm.


### 4.3. Performance Test and Comparison of Moving Object Tracking Algorithm

Table4 is the running time test of this algorithm implementation on the development board. The test sequence length is 1000 frames.Table 4
Performance test of moving object tracking algorithm.
AttributesIndex value (ms)Maximum0.0Minimum0.0Average0.0Since the background of the first few frames is almost pure and no effective moving object tracking window is detected, the minimum value is 0. The maximum value is also 0. This is mainly because the number of effective moving object tracking windows is small, the problem scale is extremely small, and the calculation complexity of the Kalman filter is fixed and extremely small, so this part of the time is extremely small [27].


### 4.4. Overall System Performance Evaluation

Figure9 is the sub-item performance test of the remaining modules on the development board and the overall performance of the system. The test input at this time is the picture collected from the camera in real time.Figure 9
Performance test of moving object detection algorithm.According to the experimental results, the overall time consumption of the system can be obtained as shown in Figure10.Figure 10
Performance test of moving object detection algorithm.Table5 shows the converted frame rate under the 4 algorithms.Table 5
Converted to frame rate.
Converted frame rateWhen using simple background subtraction3.0When using the single Gaussian model method3.2When using the mixed Gaussian model method2.0YCrCb domain detection algorithm3.5It can be seen from Figure10 that if the YCrCb domain detection algorithm is used, the average time consumption is 292 ms. From Table 5, it can be seen that the equivalent frame rate is about 3.5fps. When using other algorithms, the frame rate is also more than 2 frames, which can basically meet the requirements of quasi-real-time processing and can be used for the detection of slow objects [28]. But the YCrCb domain detection algorithm has better detection effect and higher efficiency.


## 4.1. Effect and Performance Test of Moving Object Detection Algorithm

The renderings of each algorithm are given below.As shown in Figure5, when the light field is relatively stable, the first three algorithms have similar effects, and all have the phenomenon of foreground holes. This is mainly because the gray values of the foreground and background are relatively close, leading to missed judgments.Figure 5
Test effect diagram of single Gaussian model detection algorithm.As can be seen from Figure6, the background subtraction method of YCrCb color space can better protect the integrity of the foreground in this test. However, when the front and background brightness is close and the color is similar, the phenomenon of voids will also occur. Since the information used here comes from JPEG files, there is a large quantization error, and it is easy to produce shot noise on the background.Figure 6
Test effect diagram of YCrCb domain background subtraction model detection algorithm.As shown in Figure7, the running time test of the above four algorithms on the development board is as follows. The structure of the test is obtained by time stamping and subtracting, and the test sequence length is 1000 frames.Figure 7
Performance test of moving object detection algorithm.


## 4.2. The Effect and Performance Test of the Connected Domain Labeling Algorithm for Binary Images

As shown in Figure8, the following is the runtime test of this algorithm implementation on the development board. Use the YCrCb algorithm result as the test sequence; the test sequence length is 1000 frames.Figure 8
Performance test of moving object detection algorithm.


## 4.3. Performance Test and Comparison of Moving Object Tracking Algorithm

Table4 is the running time test of this algorithm implementation on the development board. The test sequence length is 1000 frames.Table 4
Performance test of moving object tracking algorithm.
AttributesIndex value (ms)Maximum0.0Minimum0.0Average0.0Since the background of the first few frames is almost pure and no effective moving object tracking window is detected, the minimum value is 0. The maximum value is also 0. This is mainly because the number of effective moving object tracking windows is small, the problem scale is extremely small, and the calculation complexity of the Kalman filter is fixed and extremely small, so this part of the time is extremely small [27].


## 4.4. Overall System Performance Evaluation

Figure9 is the sub-item performance test of the remaining modules on the development board and the overall performance of the system. The test input at this time is the picture collected from the camera in real time.Figure 9
Performance test of moving object detection algorithm.According to the experimental results, the overall time consumption of the system can be obtained as shown in Figure10.Figure 10
Performance test of moving object detection algorithm.Table5 shows the converted frame rate under the 4 algorithms.Table 5
Converted to frame rate.
Converted frame rateWhen using simple background subtraction3.0When using the single Gaussian model method3.2When using the mixed Gaussian model method2.0YCrCb domain detection algorithm3.5It can be seen from Figure10 that if the YCrCb domain detection algorithm is used, the average time consumption is 292 ms. From Table 5, it can be seen that the equivalent frame rate is about 3.5fps. When using other algorithms, the frame rate is also more than 2 frames, which can basically meet the requirements of quasi-real-time processing and can be used for the detection of slow objects [28]. But the YCrCb domain detection algorithm has better detection effect and higher efficiency.


## 5. Conclusions

With the rapid development of embedded technology, embedded systems have been applied in many fields. This article uses knowledge in the field of embedded systems and target detection to complete the design of the system software, the preparation of the software and hardware environment, and the detection of moving targets. The design and implementation of the moving target detection system is based on traditional monitoring technology. The hardware platform uses the ARM development board with the S3C2410 processor as the core. The embedded operating system is a Linux system. The system has low power consumption and high reliability. The experiment is very applicable. The later research work can be improved from the following points: (1) The selected environment is relatively simple, and more changes should be made during the experiment time and venue and (2) how to make the detection more sensitive, optimize the algorithm, etc.



---

*Source: 5484706-2022-09-28.xml*