# The Application and Development Trend of Youth Sports Simulation Based on Computer Vision

Authors: Tong Zhou; Yilei Wang
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

Based on computer vision technology, this paper presents a human motion analysis and target tracking technology based on computer vision. In terms of moving target detection, the current moving target detection technology is summarized, and some experimental results of the algorithm are given. The background difference method under monocular camera is emphatically analyzed. The preliminary human contour is obtained by the background difference method. In order to obtain a smoother target contour, the mathematical morphology is used to remove the noise, and the judgment algorithm of the size of the image connected domain is added. A specific threshold is set to remove the connected domain of the noise block less than the threshold. In the aspect of human motion recognition, this paper selects human motion features, including minimum external rectangle aspect ratio, rectangularity, circularity, and moment invariant. The criteria for selecting human motion features are strong noise resistance and obvious distinction. Then, the three types of human motion images are classified and recognized. After cross-validation and parameter optimization, the recognition accuracy is significantly improved. The experimental results show that the video sequence collected in the field has a total of 376 frames, and the frame rate is 10 frames/s. Due to the small traffic, the mean shift algorithm based on adaptive feature fusion is used to track the target every 2-3 frames. And set the inverseX direction as the direction of entering the scene and the X direction as the direction of moving out of the scene so that the allowable error of the distance between the detection and tracking results is 10. The weight of each feature is dynamically updated by the similarity between the candidate model and the target model, which solves the problem that the mean shift algorithm is not robust enough when similar objects are occluded and interfered and achieves more accurate tracking.


---

## Body

## 1. Introduction

In today’s life, as people’s way of life is better, people today need more sports. Sport has become an integral part of human life. For teens, exercise helps them improve their physical and mental well-being. According to the future and development expectations of the country, the development of physical and mental health of young people has always been the goal of scientific research. Education and sports and physical education have helped to improve the mental and physical health of young people [1]. As science and technology develop in the past, more and more new technologies are being used in research games. For example, the main goal of computer vision science is to give the computer a human-like ability to make the computer see the environment, understand the content of thought, and do the necessary. At the same time, the combination of computer vision technology and sports can further improve the simulation effect of sports, help sports get rid of the defects of weather, venues, equipment, funds, and so on, and maximize the effect of sports [2]. Therefore, this paper proposes a human motion analysis and target tracking technology based on computer vision, in order to better integrate computer vision technology into the application of youth sports simulation.Object tracking is to create a corresponding matching problem between successive image frames based on position, speed, shape, texture, color, and other related features. At present, as far as the tracking object is human, it can track the body parts such as hands, faces, heads, legs, and the whole human body. In terms of tracking angle, there are single angle of view corresponding to a single camera, multiangle of view corresponding to multiple cameras, and omnidirectional angle of view [3]. According to the different numbers of tracking targets, it can be divided into single moving target and multimoving target. Of course, it can also be classified by tracking target category (rigid body, nonrigid body, etc.) and camera state (moving or fixed). The recognition and analysis of human motion have always been a complex research topic. So far, human motion analysis has gradually moved from theoretical research to practical application [4]. For example, tracking the markers attached to clothes has been widely used, but the markers attached to clothes will be deformed due to movement and prone to dislocation. In this paper, human motion recognition is based on the research of nonattached markers. There are still many difficulties in video analysis of human motion characteristics.There are different ways of human motion analysis in different fields and different objectives in practical applications, so there are different classification methods for human motion analysis. According to the number of cameras used, there are two kinds of methods: monocular camera based and multicamera based: as the name suggests, monocular camera uses a single camera to obtain images and analyze and process the obtained video. Multicamera is to use multiple cameras to acquire and process video. The advantage of multicamera is that it is conducive to obtain depth information, but the implementation is more complex, so in most cases, monocular camera is used to obtain video [5].Region-based human motion analysis method is widely used at present, which can be divided into two parts: the analysis based on the whole human body and the analysis based on the local human body. The former does not need to accurately establish the human model and initialize the model, but only needs to calculate the area of the foreground and set the constraints of the geometric structure. For the analysis based on the local part of the human body, the foreground needs to be more accurate. Through the analysis of different parts of the human body (such as hands, head, and limbs), the representation is classified and constructed. If a new area appears, the representation will be generated, and if the corresponding area disappears, the representation will be deleted. The difficulty of region-based human motion analysis lies in how to deal with shadow region and object occlusion. If the human motion is predicted by the filter, the tracking can be completed under the premise of occlusion [6].The research direction of Artificial Intelligence Research Institute is mainly artificial animation, which uses manual annotation of human feature points in the first frame to accurately estimate the occluded position. The Computer Institute of the Chinese Academy of Sciences is dedicated to the study of gesture recognition. The experimenter wears a special glove with a sensor. The researcher obtains data from the sensor to analyze gestures. In addition, the Institute of Computer Science of the Chinese Academy of Sciences has also extended its research to sports training, analyzing the training actions of national diving team athletes and performing three-dimensional reconstruction. From the development trend of human motion analysis at home and abroad, the types of sports analyzed are transiting from simple periodic sports (such as walking and running) to complex sports (such as gymnastics). The viewpoint of the analysis is transited from monocular vision to binocular or even multiocular vision. The tracking process transits from manual annotation to automatic annotation [7].


## 2. Analysis of Human Sports Based on Computer Vision

### 2.1. Human Moving Target Detection Technology

The objective search engine is divided into two parts: static image objective detection technology and dynamic sequence target search machine. The technology of capturing objects from images was also developed early on. Applications typically include the starting method, the image comparison method, the edge view, and the standard segmentation method. Static image object detection method only uses the spatial information of the image, but does not use the interframe correlation information in the video, which cannot meet the real-time contour extraction. Dynamic sequence object detection technology uses motion information from video to extract moving objects [8].


#### 2.1.1. Frame Division Difference Method

The different process is called time difference method and the simple difference method and is the simplest way to identify the transition images of the two frames. While the subject and the camera are still there, the video image has the same background. Comparing two images at different times can affect the movement of the object. The adjacent differences are shown in(1)Px,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.A schematic of the difference in variance is shown in Figure1.Figure 1
Flowchart of adjacent frame difference method.The key to a variety of differences is to choose a start. These differences will create different binaries. When selecting a small start, some pixel effects appear as the target. If the initial size is large, some pixels of the target image are filtered out according to the sound [9, 10].


#### 2.1.2. Symmetrical Frame Difference Method

The main idea of the symmetric difference is called the difference between the frames of three consecutive diagrams, to calculate the complete difference, get a binary diagram with the clear the beginning, and then do the “work of communication.” The binary difference is a binary diagram, and the output is objective. The structure of the symmetric frame different ways is shown in Figure2.Figure 2
Flowchart of symmetrical frame difference method.First frame:(2)P1x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Second frame:(3)P2x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Perform a “logical and” operation to obtain the detected targetP:
(4)Px,y=P1x,y∩P2x,y=255,ifP1x,y=255δδP2x,y=255,0,else.


#### 2.1.3. Background Difference Method

Background subtraction is one of the commonly used methods for moving target detection. The main idea is to compare the input video frame with the background image [11]. If the pixel features at the same position are different, the pixel area in this frame is considered to have changed. The background difference method extracts these changed areas through certain criteria to form the foreground target area. If these front spots are further processed, the target position, shape, size, and other information can be obtained. In this paper, the following contrast method is used to draw the individual contour. The first step in the difference in background is to get a stable, reliable background image, then count the differences between the current frame image and the image after to get a comparison image, and then make a binary diagram of the differences between the two to start the value to get the contour of the object moving [12]. The test is taught in
(5)Px,y=1,Ix,y−Bx,y>T,0,else.The specific process is shown in Figure3.Figure 3
Flowchart of background difference method.


#### 2.1.4. Optical Flow Method

The constraint equation of optical flow method meets(6)Ixt,yt,t≈Ixt+Δt,yt+Δt,t+Δt.The Taylor series is used to expand the right side of the inequality sign of the above formula, and the optical flow constraint equation is(7)It≈It+dItdtΔt+O2Δt,dItdt=0,where O2Δt is the second-order derivative and the higher-order derivative assumption can be ignored. According to the chain rule, the optical flow equation is
(8)∂I∂xdxdt+∂I∂ydydt+∂I∂t=0.It can also be written(9)Ixu+Iyv+It=0.After the optical flow field is determined, the random noise and other small interference factors are removed, and the motion vector is always consistent on an object within a certain time range so that the motion parameters of the moving target at each time include speed and direction. Optical flow field-based motion target detection can calculate the target speed, but it is difficult to achieve in real time due to the long count time of the iteration operation [13]. As seen in Figure 4, a uniform cylinder rotates around its base axis, the camera is constant, the cylindrical image does not change over time, and the optical flux does not move to the surface of the material. In this case, the optical flow field is zero. In Figure 5, the sphere does not move, but the light source is moving and the optical current moves on the surface of the object; the optical flow field in this case is not zero [14].Figure 4
Motion but no optical flow change.Figure 5
Optical flow change without movement.


#### 2.1.5. Gaussian Model Method

Ideally, the background of two adjacent frames is consistent, and the difference of gray value should also be zero. However, due to the slight jitter of the camera, the small change of the external environment, and the unstable noise of the sensor itself, the background gray difference between the two sensors is not all zero. While the pitch change at that point can indicate that the average of 0 in the normal distribution ofN0,σ2, the change in pixel gray value can be averaged by analyzing the rule changes the pixel value at some point in the same background over a period of time [15]. It is expressed by the regular division of μ, Nμ,σ2. Assuming that the average change of each pixel in a static result gives a normal distribution, its potential for speed is
(10)fx=12πσex−μ2/2σ2,−∞<x<∞.


#### 2.1.6. Basic Algorithm of Mathematical Morphology

Mathematical morphology is a new concept in imaging. The principle is to use design principles to measure and decompose similar images in the image, thus allowing the image to be identified and analyzed. Different processes will yield different results.(1)
Gray morphological expansion operation(11)f⊕bx,y=maxfx−s,y−t+bs,tx−s,y−t∈Df;s,t∈Db.(2)
Gray form decay candle operation(12)fΘbx,y=minfx−s,y−t−bs,tx−s,y−t∈Df;s,t∈Db.(3)
Gray form open operation(13)f∘b=fΘb⊕b.(4)
Gray morphological closure operation(14)f•b=f⊕bΘb.


#### 2.1.7. Tracking Method Based on Motion Detection

The time difference method is to compare relative changes in identical pixels of two adjacent images in a continuous image sequence and make an initial work in progress into the contrast image to get the moving part in the image. IfIii,j is a figure of time t, Ii−1i,j is a figure of time t−1, Di,j is the difference, and t is the beginning:
(15)Di,j=1,Iti,t−It−1i,t≥T,o,else.Time difference is a direct and simple method for moving target detection. It has the advantages of simple algorithm implementation, low complexity of program design, small amount of calculation, and good real-time performance. It has certain application value. The two-frame contrast method is used to extract moving objects from the video system, following the distribution and control goals. However, when the target moves slowly, the detected target may appear hollow or even ambiguous. If the target moves too fast, do not split the target [16].


### 2.2. Design of Human Moving Target Tracking System

#### 2.2.1. System Design Idea

The processing process of the human moving target tracking system is as follows: firstly, the relevant image data of the detection and tracking area is collected through the visual sensor—CCD camera and image acquisition card, and then, the obtained video image sequence is preprocessed to reduce the impact of noise, and then, the collected video image is processed in real time to obtain the relevant motion information and extract the human moving target. Then, the video image is processed and analyzed, the target is tracked in the continuous image sequence, and the pedestrian motion trajectory is obtained. Finally, the motion behavior of the human target is understood. The core processing algorithm of the system is mainly composed of two parts: the segmentation and tracking algorithm of pedestrian target.


#### 2.2.2. System Composition

CCD camera and image acquisition card, as the image data acquisition sensor, are the input devices of the whole system and have the image acquisition function. CCD is responsible for collecting image information. The image acquisition card controls the camera to complete image acquisition and digitization and provides a bus interface to complete the real-time transmission of images and coordinate the whole system. The function of the image main processor is to realize the main algorithm of the human moving target tracking system. By analyzing and processing the collected sequence images, the human moving target in the video image is extracted, and its motion tracking and behavior analysis are realized. Finally, the image processing results are displayed on the connected display device, as shown in Figure6; they will be briefly introduced below.Figure 6
Overall system framework.Image acquisition module is the most front-end unit of the whole tracking system, providing input data for the whole system. In this system, the ultimate goal of target tracking is to determine the moving direction of the target in the scene, so the requirement for acquisition frequency is not high. Only one target is collected at least twice in the process of entering and leaving the scene, so the acquisition speed is 10 fps.Depending on the weather, changes in lighting, choice of sensor type, and blur caused by pedestrians, the images will be mixed with different sounds. In addition, the image collected by the light source in the lighting creates noise when captured, converted, and transmitted, which can lead to image degradation. The presence of these noises makes it difficult to identify vehicle targets. The main role of the image before working module is to filter and strip the image [17].Moving product segmentation is the process of deleting objects moving from the background to form images. This is the basis for product management. The quality of work at this stage directly affects the outcome of the next work. The main idea of improving the target mobile segmentation module is to separate the area of interest from the background, improve the segmented binary image, eliminate the distortion of the image, and apply the initialization method segmentation to get the finished image. Purpose section: the target location and similar features are extracted.Tracking is to extract some features of moving objects in image sequences and match these features from one frame image to another. The processing idea of the target tracking module is that the position, area, and shape of the same moving target in the two adjacent frames will not change much, so it can be tracked from the features obtained from the moving target extraction. Mean shift tracking algorithm is a matching method based on color features. It has many good properties in the tracking field. It can still be tracked when the target is partially occluded, but the color histogram is also a weak description of the target features. When the target is seriously occluded and similar objects appear around, the tracking effect is not good. Therefore, it is considered to add spatial texture features to describe them and give each feature a dynamically updatable weight, so as to strengthen the robustness of the algorithm and create conditions for the subsequent behavior analysis of human moving objects [18]. The purpose of human moving target tracking is to determine the trajectory of the target, so as to further analyze its motion state, as show in Figure 7.Figure 7
System processing flowchart.


## 2.1. Human Moving Target Detection Technology

The objective search engine is divided into two parts: static image objective detection technology and dynamic sequence target search machine. The technology of capturing objects from images was also developed early on. Applications typically include the starting method, the image comparison method, the edge view, and the standard segmentation method. Static image object detection method only uses the spatial information of the image, but does not use the interframe correlation information in the video, which cannot meet the real-time contour extraction. Dynamic sequence object detection technology uses motion information from video to extract moving objects [8].


### 2.1.1. Frame Division Difference Method

The different process is called time difference method and the simple difference method and is the simplest way to identify the transition images of the two frames. While the subject and the camera are still there, the video image has the same background. Comparing two images at different times can affect the movement of the object. The adjacent differences are shown in(1)Px,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.A schematic of the difference in variance is shown in Figure1.Figure 1
Flowchart of adjacent frame difference method.The key to a variety of differences is to choose a start. These differences will create different binaries. When selecting a small start, some pixel effects appear as the target. If the initial size is large, some pixels of the target image are filtered out according to the sound [9, 10].


### 2.1.2. Symmetrical Frame Difference Method

The main idea of the symmetric difference is called the difference between the frames of three consecutive diagrams, to calculate the complete difference, get a binary diagram with the clear the beginning, and then do the “work of communication.” The binary difference is a binary diagram, and the output is objective. The structure of the symmetric frame different ways is shown in Figure2.Figure 2
Flowchart of symmetrical frame difference method.First frame:(2)P1x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Second frame:(3)P2x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Perform a “logical and” operation to obtain the detected targetP:
(4)Px,y=P1x,y∩P2x,y=255,ifP1x,y=255δδP2x,y=255,0,else.


### 2.1.3. Background Difference Method

Background subtraction is one of the commonly used methods for moving target detection. The main idea is to compare the input video frame with the background image [11]. If the pixel features at the same position are different, the pixel area in this frame is considered to have changed. The background difference method extracts these changed areas through certain criteria to form the foreground target area. If these front spots are further processed, the target position, shape, size, and other information can be obtained. In this paper, the following contrast method is used to draw the individual contour. The first step in the difference in background is to get a stable, reliable background image, then count the differences between the current frame image and the image after to get a comparison image, and then make a binary diagram of the differences between the two to start the value to get the contour of the object moving [12]. The test is taught in
(5)Px,y=1,Ix,y−Bx,y>T,0,else.The specific process is shown in Figure3.Figure 3
Flowchart of background difference method.


### 2.1.4. Optical Flow Method

The constraint equation of optical flow method meets(6)Ixt,yt,t≈Ixt+Δt,yt+Δt,t+Δt.The Taylor series is used to expand the right side of the inequality sign of the above formula, and the optical flow constraint equation is(7)It≈It+dItdtΔt+O2Δt,dItdt=0,where O2Δt is the second-order derivative and the higher-order derivative assumption can be ignored. According to the chain rule, the optical flow equation is
(8)∂I∂xdxdt+∂I∂ydydt+∂I∂t=0.It can also be written(9)Ixu+Iyv+It=0.After the optical flow field is determined, the random noise and other small interference factors are removed, and the motion vector is always consistent on an object within a certain time range so that the motion parameters of the moving target at each time include speed and direction. Optical flow field-based motion target detection can calculate the target speed, but it is difficult to achieve in real time due to the long count time of the iteration operation [13]. As seen in Figure 4, a uniform cylinder rotates around its base axis, the camera is constant, the cylindrical image does not change over time, and the optical flux does not move to the surface of the material. In this case, the optical flow field is zero. In Figure 5, the sphere does not move, but the light source is moving and the optical current moves on the surface of the object; the optical flow field in this case is not zero [14].Figure 4
Motion but no optical flow change.Figure 5
Optical flow change without movement.


### 2.1.5. Gaussian Model Method

Ideally, the background of two adjacent frames is consistent, and the difference of gray value should also be zero. However, due to the slight jitter of the camera, the small change of the external environment, and the unstable noise of the sensor itself, the background gray difference between the two sensors is not all zero. While the pitch change at that point can indicate that the average of 0 in the normal distribution ofN0,σ2, the change in pixel gray value can be averaged by analyzing the rule changes the pixel value at some point in the same background over a period of time [15]. It is expressed by the regular division of μ, Nμ,σ2. Assuming that the average change of each pixel in a static result gives a normal distribution, its potential for speed is
(10)fx=12πσex−μ2/2σ2,−∞<x<∞.


### 2.1.6. Basic Algorithm of Mathematical Morphology

Mathematical morphology is a new concept in imaging. The principle is to use design principles to measure and decompose similar images in the image, thus allowing the image to be identified and analyzed. Different processes will yield different results.(1)
Gray morphological expansion operation(11)f⊕bx,y=maxfx−s,y−t+bs,tx−s,y−t∈Df;s,t∈Db.(2)
Gray form decay candle operation(12)fΘbx,y=minfx−s,y−t−bs,tx−s,y−t∈Df;s,t∈Db.(3)
Gray form open operation(13)f∘b=fΘb⊕b.(4)
Gray morphological closure operation(14)f•b=f⊕bΘb.


### 2.1.7. Tracking Method Based on Motion Detection

The time difference method is to compare relative changes in identical pixels of two adjacent images in a continuous image sequence and make an initial work in progress into the contrast image to get the moving part in the image. IfIii,j is a figure of time t, Ii−1i,j is a figure of time t−1, Di,j is the difference, and t is the beginning:
(15)Di,j=1,Iti,t−It−1i,t≥T,o,else.Time difference is a direct and simple method for moving target detection. It has the advantages of simple algorithm implementation, low complexity of program design, small amount of calculation, and good real-time performance. It has certain application value. The two-frame contrast method is used to extract moving objects from the video system, following the distribution and control goals. However, when the target moves slowly, the detected target may appear hollow or even ambiguous. If the target moves too fast, do not split the target [16].


## 2.1.1. Frame Division Difference Method

The different process is called time difference method and the simple difference method and is the simplest way to identify the transition images of the two frames. While the subject and the camera are still there, the video image has the same background. Comparing two images at different times can affect the movement of the object. The adjacent differences are shown in(1)Px,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.A schematic of the difference in variance is shown in Figure1.Figure 1
Flowchart of adjacent frame difference method.The key to a variety of differences is to choose a start. These differences will create different binaries. When selecting a small start, some pixel effects appear as the target. If the initial size is large, some pixels of the target image are filtered out according to the sound [9, 10].


## 2.1.2. Symmetrical Frame Difference Method

The main idea of the symmetric difference is called the difference between the frames of three consecutive diagrams, to calculate the complete difference, get a binary diagram with the clear the beginning, and then do the “work of communication.” The binary difference is a binary diagram, and the output is objective. The structure of the symmetric frame different ways is shown in Figure2.Figure 2
Flowchart of symmetrical frame difference method.First frame:(2)P1x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Second frame:(3)P2x,y=255,ifIix,y−Ii−1x,y>T,0,ifIix,y−Ii−1x,y≤T.Perform a “logical and” operation to obtain the detected targetP:
(4)Px,y=P1x,y∩P2x,y=255,ifP1x,y=255δδP2x,y=255,0,else.


## 2.1.3. Background Difference Method

Background subtraction is one of the commonly used methods for moving target detection. The main idea is to compare the input video frame with the background image [11]. If the pixel features at the same position are different, the pixel area in this frame is considered to have changed. The background difference method extracts these changed areas through certain criteria to form the foreground target area. If these front spots are further processed, the target position, shape, size, and other information can be obtained. In this paper, the following contrast method is used to draw the individual contour. The first step in the difference in background is to get a stable, reliable background image, then count the differences between the current frame image and the image after to get a comparison image, and then make a binary diagram of the differences between the two to start the value to get the contour of the object moving [12]. The test is taught in
(5)Px,y=1,Ix,y−Bx,y>T,0,else.The specific process is shown in Figure3.Figure 3
Flowchart of background difference method.


## 2.1.4. Optical Flow Method

The constraint equation of optical flow method meets(6)Ixt,yt,t≈Ixt+Δt,yt+Δt,t+Δt.The Taylor series is used to expand the right side of the inequality sign of the above formula, and the optical flow constraint equation is(7)It≈It+dItdtΔt+O2Δt,dItdt=0,where O2Δt is the second-order derivative and the higher-order derivative assumption can be ignored. According to the chain rule, the optical flow equation is
(8)∂I∂xdxdt+∂I∂ydydt+∂I∂t=0.It can also be written(9)Ixu+Iyv+It=0.After the optical flow field is determined, the random noise and other small interference factors are removed, and the motion vector is always consistent on an object within a certain time range so that the motion parameters of the moving target at each time include speed and direction. Optical flow field-based motion target detection can calculate the target speed, but it is difficult to achieve in real time due to the long count time of the iteration operation [13]. As seen in Figure 4, a uniform cylinder rotates around its base axis, the camera is constant, the cylindrical image does not change over time, and the optical flux does not move to the surface of the material. In this case, the optical flow field is zero. In Figure 5, the sphere does not move, but the light source is moving and the optical current moves on the surface of the object; the optical flow field in this case is not zero [14].Figure 4
Motion but no optical flow change.Figure 5
Optical flow change without movement.


## 2.1.5. Gaussian Model Method

Ideally, the background of two adjacent frames is consistent, and the difference of gray value should also be zero. However, due to the slight jitter of the camera, the small change of the external environment, and the unstable noise of the sensor itself, the background gray difference between the two sensors is not all zero. While the pitch change at that point can indicate that the average of 0 in the normal distribution ofN0,σ2, the change in pixel gray value can be averaged by analyzing the rule changes the pixel value at some point in the same background over a period of time [15]. It is expressed by the regular division of μ, Nμ,σ2. Assuming that the average change of each pixel in a static result gives a normal distribution, its potential for speed is
(10)fx=12πσex−μ2/2σ2,−∞<x<∞.


## 2.1.6. Basic Algorithm of Mathematical Morphology

Mathematical morphology is a new concept in imaging. The principle is to use design principles to measure and decompose similar images in the image, thus allowing the image to be identified and analyzed. Different processes will yield different results.(1)
Gray morphological expansion operation(11)f⊕bx,y=maxfx−s,y−t+bs,tx−s,y−t∈Df;s,t∈Db.(2)
Gray form decay candle operation(12)fΘbx,y=minfx−s,y−t−bs,tx−s,y−t∈Df;s,t∈Db.(3)
Gray form open operation(13)f∘b=fΘb⊕b.(4)
Gray morphological closure operation(14)f•b=f⊕bΘb.


## 2.1.7. Tracking Method Based on Motion Detection

The time difference method is to compare relative changes in identical pixels of two adjacent images in a continuous image sequence and make an initial work in progress into the contrast image to get the moving part in the image. IfIii,j is a figure of time t, Ii−1i,j is a figure of time t−1, Di,j is the difference, and t is the beginning:
(15)Di,j=1,Iti,t−It−1i,t≥T,o,else.Time difference is a direct and simple method for moving target detection. It has the advantages of simple algorithm implementation, low complexity of program design, small amount of calculation, and good real-time performance. It has certain application value. The two-frame contrast method is used to extract moving objects from the video system, following the distribution and control goals. However, when the target moves slowly, the detected target may appear hollow or even ambiguous. If the target moves too fast, do not split the target [16].


## 2.2. Design of Human Moving Target Tracking System

### 2.2.1. System Design Idea

The processing process of the human moving target tracking system is as follows: firstly, the relevant image data of the detection and tracking area is collected through the visual sensor—CCD camera and image acquisition card, and then, the obtained video image sequence is preprocessed to reduce the impact of noise, and then, the collected video image is processed in real time to obtain the relevant motion information and extract the human moving target. Then, the video image is processed and analyzed, the target is tracked in the continuous image sequence, and the pedestrian motion trajectory is obtained. Finally, the motion behavior of the human target is understood. The core processing algorithm of the system is mainly composed of two parts: the segmentation and tracking algorithm of pedestrian target.


### 2.2.2. System Composition

CCD camera and image acquisition card, as the image data acquisition sensor, are the input devices of the whole system and have the image acquisition function. CCD is responsible for collecting image information. The image acquisition card controls the camera to complete image acquisition and digitization and provides a bus interface to complete the real-time transmission of images and coordinate the whole system. The function of the image main processor is to realize the main algorithm of the human moving target tracking system. By analyzing and processing the collected sequence images, the human moving target in the video image is extracted, and its motion tracking and behavior analysis are realized. Finally, the image processing results are displayed on the connected display device, as shown in Figure6; they will be briefly introduced below.Figure 6
Overall system framework.Image acquisition module is the most front-end unit of the whole tracking system, providing input data for the whole system. In this system, the ultimate goal of target tracking is to determine the moving direction of the target in the scene, so the requirement for acquisition frequency is not high. Only one target is collected at least twice in the process of entering and leaving the scene, so the acquisition speed is 10 fps.Depending on the weather, changes in lighting, choice of sensor type, and blur caused by pedestrians, the images will be mixed with different sounds. In addition, the image collected by the light source in the lighting creates noise when captured, converted, and transmitted, which can lead to image degradation. The presence of these noises makes it difficult to identify vehicle targets. The main role of the image before working module is to filter and strip the image [17].Moving product segmentation is the process of deleting objects moving from the background to form images. This is the basis for product management. The quality of work at this stage directly affects the outcome of the next work. The main idea of improving the target mobile segmentation module is to separate the area of interest from the background, improve the segmented binary image, eliminate the distortion of the image, and apply the initialization method segmentation to get the finished image. Purpose section: the target location and similar features are extracted.Tracking is to extract some features of moving objects in image sequences and match these features from one frame image to another. The processing idea of the target tracking module is that the position, area, and shape of the same moving target in the two adjacent frames will not change much, so it can be tracked from the features obtained from the moving target extraction. Mean shift tracking algorithm is a matching method based on color features. It has many good properties in the tracking field. It can still be tracked when the target is partially occluded, but the color histogram is also a weak description of the target features. When the target is seriously occluded and similar objects appear around, the tracking effect is not good. Therefore, it is considered to add spatial texture features to describe them and give each feature a dynamically updatable weight, so as to strengthen the robustness of the algorithm and create conditions for the subsequent behavior analysis of human moving objects [18]. The purpose of human moving target tracking is to determine the trajectory of the target, so as to further analyze its motion state, as show in Figure 7.Figure 7
System processing flowchart.


## 2.2.1. System Design Idea

The processing process of the human moving target tracking system is as follows: firstly, the relevant image data of the detection and tracking area is collected through the visual sensor—CCD camera and image acquisition card, and then, the obtained video image sequence is preprocessed to reduce the impact of noise, and then, the collected video image is processed in real time to obtain the relevant motion information and extract the human moving target. Then, the video image is processed and analyzed, the target is tracked in the continuous image sequence, and the pedestrian motion trajectory is obtained. Finally, the motion behavior of the human target is understood. The core processing algorithm of the system is mainly composed of two parts: the segmentation and tracking algorithm of pedestrian target.


## 2.2.2. System Composition

CCD camera and image acquisition card, as the image data acquisition sensor, are the input devices of the whole system and have the image acquisition function. CCD is responsible for collecting image information. The image acquisition card controls the camera to complete image acquisition and digitization and provides a bus interface to complete the real-time transmission of images and coordinate the whole system. The function of the image main processor is to realize the main algorithm of the human moving target tracking system. By analyzing and processing the collected sequence images, the human moving target in the video image is extracted, and its motion tracking and behavior analysis are realized. Finally, the image processing results are displayed on the connected display device, as shown in Figure6; they will be briefly introduced below.Figure 6
Overall system framework.Image acquisition module is the most front-end unit of the whole tracking system, providing input data for the whole system. In this system, the ultimate goal of target tracking is to determine the moving direction of the target in the scene, so the requirement for acquisition frequency is not high. Only one target is collected at least twice in the process of entering and leaving the scene, so the acquisition speed is 10 fps.Depending on the weather, changes in lighting, choice of sensor type, and blur caused by pedestrians, the images will be mixed with different sounds. In addition, the image collected by the light source in the lighting creates noise when captured, converted, and transmitted, which can lead to image degradation. The presence of these noises makes it difficult to identify vehicle targets. The main role of the image before working module is to filter and strip the image [17].Moving product segmentation is the process of deleting objects moving from the background to form images. This is the basis for product management. The quality of work at this stage directly affects the outcome of the next work. The main idea of improving the target mobile segmentation module is to separate the area of interest from the background, improve the segmented binary image, eliminate the distortion of the image, and apply the initialization method segmentation to get the finished image. Purpose section: the target location and similar features are extracted.Tracking is to extract some features of moving objects in image sequences and match these features from one frame image to another. The processing idea of the target tracking module is that the position, area, and shape of the same moving target in the two adjacent frames will not change much, so it can be tracked from the features obtained from the moving target extraction. Mean shift tracking algorithm is a matching method based on color features. It has many good properties in the tracking field. It can still be tracked when the target is partially occluded, but the color histogram is also a weak description of the target features. When the target is seriously occluded and similar objects appear around, the tracking effect is not good. Therefore, it is considered to add spatial texture features to describe them and give each feature a dynamically updatable weight, so as to strengthen the robustness of the algorithm and create conditions for the subsequent behavior analysis of human moving objects [18]. The purpose of human moving target tracking is to determine the trajectory of the target, so as to further analyze its motion state, as show in Figure 7.Figure 7
System processing flowchart.


## 3. Moving Object Segmentation

### 3.1. Basic Methods of Image Segmentation

Image segmentation is an important technology for image analysis. In learning and using pictures, people usually only like certain parts of the picture. These sections are often called objectives or perspectives (other sections are called backgrounds). They are usually related to specific and unique areas in the figure. What can be special about this can be the gray value of the pixel, the curve of the object, the color, the texture, and so on. In order to identify the targets in the figure, they must be separated from the figure. Based on this, further objective measurements can be made and images can be used [19]. Thus, image segmentation is a technology and process of dividing images into areas of different objects and subtracting favorite objects. The classic image segmentation method is shown in Figure 8.Figure 8
Image segmentation method.The simple idea is to assume that the image has a purpose and background with gray wings in a pattern. The gray values of the pixels that are adjacent to the target or background are related, but the gray values of the pixels on either side of the boundary between the target and the background are large and have two peaks (Figure9). Therefore, the gray value corresponding to the difference between the two peaks can be selected as the starting point of the appropriate segmentation of the target and the background.Figure 9
Bimodal histogram.


### 3.2. Human Motion Target Segmentation

By studying the video images collected in the field, this paper selects the head of the moving target as the recognition object. This is because the human head is a face image similar to an irregular circle. It not only has a uniform gray distribution but also has a lower gray value compared with the surrounding objects and the background, so it has obvious distinguishability. In addition, although the background in the video is relatively simple, we cannot use simple background difference which is sensitive to its changes due to the influence of shadows [20]. However, if the background update mechanism is introduced to eliminate the interference, it cannot meet the real-time requirements, so this paper adopts a two-step segmentation method to extract moving objects. The whole process of moving object segmentation is shown in Figure 10.Figure 10
Flowchart of target segmentation.In this paper, the method of target extraction uses the gray value and the position characteristics of pixels and classifies by threshold. It mainly includes several steps: target segmentation, target identification, and target feature extraction.


#### 3.2.1. Image Segmentation

Through half threshold segmentation, a large number of background images and some irrelevant interference images can be removed, and the concerned motion region can be extracted.The gray value of the pixels in the head area of the moving target is mainly concentrated in the range of 0-40. However, considering the influence of external light, the thresholdT is taken as 50 so that the head region can be roughly extracted from the image sequence. However, in the application environment of this paper, the background of the image sequence is close to the gray value of the target. Taking an image sequence of any frame in the image sequence as an example, it can be seen that the gray level of the image sequence is mainly distributed in the interval of 0100, and there is no particularly obvious boundary between the background pixel and the target pixel.For the video images collected in the field, a method based on the combination of gray statistical half threshold and adaptive threshold segmentation of the head image is proposed to segment the image, and the head of the moving human target can be obtained through subsequent processing. The results show that this method can segment the moving objects in the image in real time [21].


## 3.1. Basic Methods of Image Segmentation

Image segmentation is an important technology for image analysis. In learning and using pictures, people usually only like certain parts of the picture. These sections are often called objectives or perspectives (other sections are called backgrounds). They are usually related to specific and unique areas in the figure. What can be special about this can be the gray value of the pixel, the curve of the object, the color, the texture, and so on. In order to identify the targets in the figure, they must be separated from the figure. Based on this, further objective measurements can be made and images can be used [19]. Thus, image segmentation is a technology and process of dividing images into areas of different objects and subtracting favorite objects. The classic image segmentation method is shown in Figure 8.Figure 8
Image segmentation method.The simple idea is to assume that the image has a purpose and background with gray wings in a pattern. The gray values of the pixels that are adjacent to the target or background are related, but the gray values of the pixels on either side of the boundary between the target and the background are large and have two peaks (Figure9). Therefore, the gray value corresponding to the difference between the two peaks can be selected as the starting point of the appropriate segmentation of the target and the background.Figure 9
Bimodal histogram.


## 3.2. Human Motion Target Segmentation

By studying the video images collected in the field, this paper selects the head of the moving target as the recognition object. This is because the human head is a face image similar to an irregular circle. It not only has a uniform gray distribution but also has a lower gray value compared with the surrounding objects and the background, so it has obvious distinguishability. In addition, although the background in the video is relatively simple, we cannot use simple background difference which is sensitive to its changes due to the influence of shadows [20]. However, if the background update mechanism is introduced to eliminate the interference, it cannot meet the real-time requirements, so this paper adopts a two-step segmentation method to extract moving objects. The whole process of moving object segmentation is shown in Figure 10.Figure 10
Flowchart of target segmentation.In this paper, the method of target extraction uses the gray value and the position characteristics of pixels and classifies by threshold. It mainly includes several steps: target segmentation, target identification, and target feature extraction.


### 3.2.1. Image Segmentation

Through half threshold segmentation, a large number of background images and some irrelevant interference images can be removed, and the concerned motion region can be extracted.The gray value of the pixels in the head area of the moving target is mainly concentrated in the range of 0-40. However, considering the influence of external light, the thresholdT is taken as 50 so that the head region can be roughly extracted from the image sequence. However, in the application environment of this paper, the background of the image sequence is close to the gray value of the target. Taking an image sequence of any frame in the image sequence as an example, it can be seen that the gray level of the image sequence is mainly distributed in the interval of 0100, and there is no particularly obvious boundary between the background pixel and the target pixel.For the video images collected in the field, a method based on the combination of gray statistical half threshold and adaptive threshold segmentation of the head image is proposed to segment the image, and the head of the moving human target can be obtained through subsequent processing. The results show that this method can segment the moving objects in the image in real time [21].


## 3.2.1. Image Segmentation

Through half threshold segmentation, a large number of background images and some irrelevant interference images can be removed, and the concerned motion region can be extracted.The gray value of the pixels in the head area of the moving target is mainly concentrated in the range of 0-40. However, considering the influence of external light, the thresholdT is taken as 50 so that the head region can be roughly extracted from the image sequence. However, in the application environment of this paper, the background of the image sequence is close to the gray value of the target. Taking an image sequence of any frame in the image sequence as an example, it can be seen that the gray level of the image sequence is mainly distributed in the interval of 0100, and there is no particularly obvious boundary between the background pixel and the target pixel.For the video images collected in the field, a method based on the combination of gray statistical half threshold and adaptive threshold segmentation of the head image is proposed to segment the image, and the head of the moving human target can be obtained through subsequent processing. The results show that this method can segment the moving objects in the image in real time [21].


## 4. Application of Target Tracking in Population Statistics

### 4.1. Establishment of Target Chain

In order to realize multitarget tracking and count the number of people entering and leaving the scene, it is not only necessary to record the head position of the detected moving target and carry out subsequent tracking processing according to the characteristic value of each target but also to record the results obtained by the mean shift tracking algorithm to judge the moving direction of the target and update the counter. When the target is detected for the first time, the size information of the human head target must be obtained. Only in this way can all pixels in the target area be included in the mean shift algorithm, and then, the human head target can be described as accurately as possible.


### 4.2. Realization of Counting Process

The specific process of this paper is as follows: firstly, the head target in each frame is extracted by using the target segmentation algorithm introduced in the previous chapter, and the center position and size range of the target are obtained. The target center is the results=x,y obtained in the target detection phase. At the same time, although the length L and width W of the external rectangle of the target can completely contain the pixels of the head area of the moving target, it may also contain the edge information of some other parts (such as the shoulder). In order to reduce the interference as much as possible and accurately reflect the characteristics of the target area, the kernel function bandwidth used in the process of determining the mean shift algorithm to implement target tracking is smaller than the length L and width W of the external rectangle of the target. We set minL,w as the bandwidth of the kernel function. Then, according to the target node of each tracked target, track all targets in the new video sequence, determine the position of each target in the new video sequence, and then refresh the target node for subsequent image tracking. Here, the target chain records the characteristics and motion state of the target and saves the position of the target in the latest image frame.


### 4.3. Experimental Results and Analysis

According to the tracking algorithm proposed in this paper, the motion trajectories of two moving targets in the image sequence are obtained, as shown in Figure11. From the central coordinate position of the tracking target window, it can be seen that the circle marks the motion track of the head centroid of one person in the image sequence, while the square marks the motion track of the head centroid of another person in the image sequence, which reproduces the motion process of the moving target out of the scene [22].Figure 11
Moving track of tracking target center coordinate.The amount of calculation of tracking varies with the number of targets to be tracked, and the ultimate goal of tracking is to determine the moving direction of the target in the scene, as long as one target is tracked at least twice in the process of entering and leaving the scene. The video sequence collected in the field is 376 frames in total, and the frame rate is 10 frames/s. Due to the small traffic, the mean shift algorithm based on adaptive feature fusion is used to track the target every 2-3 frames. And set the inverseX direction as the direction of entering the scene and the X direction as the direction of moving out of the scene so that the allowable error of the distance between the detection and tracking results is 10. Using the tracking algorithm proposed in this paper, although the target disappears briefly, the distinguishability between the target and the background is enhanced due to the rotation invariance of LBP texture operator and the effective description of spatial information. Therefore, although the detection results show that there is no target at this position during the correlation counting of targets, the tracking algorithm can still track each target accurately at this time, which has strong robustness and plays a substitute role in the correlation counting method. Therefore, when the target reappears and is detected, the tracking window still tracks it on the target, so the number of people in and out of the scene can be counted accurately.


## 4.1. Establishment of Target Chain

In order to realize multitarget tracking and count the number of people entering and leaving the scene, it is not only necessary to record the head position of the detected moving target and carry out subsequent tracking processing according to the characteristic value of each target but also to record the results obtained by the mean shift tracking algorithm to judge the moving direction of the target and update the counter. When the target is detected for the first time, the size information of the human head target must be obtained. Only in this way can all pixels in the target area be included in the mean shift algorithm, and then, the human head target can be described as accurately as possible.


## 4.2. Realization of Counting Process

The specific process of this paper is as follows: firstly, the head target in each frame is extracted by using the target segmentation algorithm introduced in the previous chapter, and the center position and size range of the target are obtained. The target center is the results=x,y obtained in the target detection phase. At the same time, although the length L and width W of the external rectangle of the target can completely contain the pixels of the head area of the moving target, it may also contain the edge information of some other parts (such as the shoulder). In order to reduce the interference as much as possible and accurately reflect the characteristics of the target area, the kernel function bandwidth used in the process of determining the mean shift algorithm to implement target tracking is smaller than the length L and width W of the external rectangle of the target. We set minL,w as the bandwidth of the kernel function. Then, according to the target node of each tracked target, track all targets in the new video sequence, determine the position of each target in the new video sequence, and then refresh the target node for subsequent image tracking. Here, the target chain records the characteristics and motion state of the target and saves the position of the target in the latest image frame.


## 4.3. Experimental Results and Analysis

According to the tracking algorithm proposed in this paper, the motion trajectories of two moving targets in the image sequence are obtained, as shown in Figure11. From the central coordinate position of the tracking target window, it can be seen that the circle marks the motion track of the head centroid of one person in the image sequence, while the square marks the motion track of the head centroid of another person in the image sequence, which reproduces the motion process of the moving target out of the scene [22].Figure 11
Moving track of tracking target center coordinate.The amount of calculation of tracking varies with the number of targets to be tracked, and the ultimate goal of tracking is to determine the moving direction of the target in the scene, as long as one target is tracked at least twice in the process of entering and leaving the scene. The video sequence collected in the field is 376 frames in total, and the frame rate is 10 frames/s. Due to the small traffic, the mean shift algorithm based on adaptive feature fusion is used to track the target every 2-3 frames. And set the inverseX direction as the direction of entering the scene and the X direction as the direction of moving out of the scene so that the allowable error of the distance between the detection and tracking results is 10. Using the tracking algorithm proposed in this paper, although the target disappears briefly, the distinguishability between the target and the background is enhanced due to the rotation invariance of LBP texture operator and the effective description of spatial information. Therefore, although the detection results show that there is no target at this position during the correlation counting of targets, the tracking algorithm can still track each target accurately at this time, which has strong robustness and plays a substitute role in the correlation counting method. Therefore, when the target reappears and is detected, the tracking window still tracks it on the target, so the number of people in and out of the scene can be counted accurately.


## 5. Conclusion and Development Trend

Due to its high real-time performance and accuracy, mean shift algorithm is widely used in the field of target tracking. However, in the case of similar object occlusion interference, the tracking results often deviate. This paper makes corresponding improvements to this defect and realizes the statistics of the number of people in and out of the scene on the basis of these studies. Firstly, the tracked target is extracted from the video image sequence. After studying some commonly used segmentation algorithms and analyzing the characteristics of video scene and moving target, this paper adopts a method combining half-threshold segmentation and adaptive threshold segmentation to segment the head of human moving target in the scene from the image in two steps and identify, locate, and extract the target features. Secondly, because a single feature cannot describe the target in detail, this paper combines HSV color space with local binary mode by introducing texture feature. The weight of each feature is dynamically updated through the similarity between the candidate model and the target model, which solves the problem that the mean shift algorithm is not robust enough when similar objects are occluded and interfered and achieves more accurate tracking. Finally, on the basis of the above research, the target chain is established, and the number of people in and out based on adaptive feature fusion tracking is realized. Experiments show that it can effectively achieve the statistics of the number of people entering and leaving the scene and has high accuracy and feasibility.However, due to the limited personal ability and time, this paper only makes some preliminary exploration in human moving target tracking, and there are still many problems to be solved in the algorithm. At present, the intelligent monitoring system based on multicameras has attracted a lot of attention. It can not only greatly improve the monitoring range but also provide multiple different directional perspectives to solve the occlusion problem. It is currently considered the most effective method to solve the occlusion problem. However, when using multiple cameras to monitor the target, how to coordinate and schedule multiple cameras according to the events in the scene is a very difficult thing, which needs people to conduct in-depth research.



---

*Source: 8500869-2022-08-21.xml*