# The Theory and Method of Data Acquisition of Mixed Traffic Popular People and Nonmotor Vehicles Based on Image Processing

Authors: Chongjiao Wang; Changrong Yao; Siguang Zhao; Shida Zhao; Bin Qiang
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In road mixed traffic, pedestrians and nonmotor vehicles have a great impact on the driving of motor vehicles. This kind of influence not only threatens the road traffic safety but also leads to the increase of delay and the decrease of traffic capacity. The purpose of this paper is to study the theory and method of data acquisition of mixed traffic popular people and nonmotor vehicles based on image processing technology. Aiming at the problem that the basic state space model solves the phenomenon of “failure” such as mutual interference between mixed objects, this paper proposes a KF tracking model based on a fuzzy matching method to realize the effective and accurate tracking of mixed traffic objects. The experimental results show that, after extracting the morphological features of the detected pedestrian and nonmotor vehicle images and using the method of pattern recognition to classify, recognize, and count the mixed traffic objects, through the comparison of the two trajectory lines, we can see that the tracking accuracy of the algorithm is high under the mutual interference of pedestrian and nonmotor vehicle. Excluding the detection error, the pedestrian tracking error is less than 10 pixels, the average error is 2.366 pixels, the maximum error of nonmotor vehicle tracking is 19 pixels, and the average error is 2.5 pixels.


---

## Body

## 1. Introduction

Transportation is the artery of urban economic development, which plays an inestimable role in the development of urban economy, the improvement of people’s living standards, and the overall construction of smart city. With the development of urbanization, the number of people concentrated on the city is also growing, and the number of various vehicles is also increasing rapidly, such as traffic congestion, traffic accidents, traffic management, environmental pollution, and energy shortage. Urban mixed traffic problem has become the most common and difficult problem, no matter in the developed countries with strong economic and technological strength or in the developing countries with rapid rise; all of them are plagued by these problems without exception. The reason why serious traffic jams and jams occur in cities is that the characteristics of roads and various vehicles are quite different, and the supply of roads cannot meet the demand of various vehicles for traffic. Therefore, more and more intelligent traffic control systems are developed and applied in the actual traffic management and control. As the primary element of intelligent traffic system, traffic information collection facilities play an extremely critical role in many intelligent traffic systems.In the era of motorization, a traffic flow control system is a necessary condition to prevent traffic accidents and lighting jams. The system shall have the function of measuring the two-dimensional movement of each vehicle in a wide area. Hashimoto and Murai studied a new traffic flow measurement system based on periodic video image processing. The system can determine the size of each vehicle and measure its two-dimensional motion [1]. Herman et al. mainly study edge detection technologies such as Sobel, canny, and Prewitt and the influence of noise on edge detection. The experimental results show that PSNR, RMSE, and correlation coefficient are used to detect the edge of the original image and pay attention to the quality of the image. This paper also focuses on the application of optical flow method and Gaussian mixture model method in moving object detection, and analyzes [2]. Daniel Mortari’s system collects traffic congestion data from roads and provides it to users through openstreet maps. The monitoring camera installed on the road continuously inputs information to the system, and then the system calculates the number of vehicles on the road for a period of time to determine the congestion on the road. The system realizes background subtraction and thresholding to detect the vehicle from the image input received by the camera [3].First of all, based on the existing nonmotor vehicle video acquisition system, combined with the characteristics of large random fluctuation of pedestrian and nonmotor vehicle path, large mutual interference of moving objects, and large change of traffic object shape, a theoretical framework of video acquisition system with four modules of “object detection object tracking feature extraction object recognition” is proposed. Secondly, because it is difficult to get a more robust background image in real time from the traffic scene, the accuracy of object detection will be greatly disturbed. Therefore, this paper establishes a background extraction method based on mathematical morphology, which can improve the detection accuracy of the system and retain the original information in the video sequence to the greatest extent.


## 2. Proposed Method

### 2.1. Basic Theory of Traffic Flow

The traffic flow theory uses the laws of mathematics and mechanics to describe the characteristics of traffic flow and explains the traffic phenomenon and traffic mechanism, which is the theoretical basis of traffic signal control and traffic management [4, 5]. Through the detailed description of the traffic situation, people have a further in-depth understanding of the traffic phenomenon, so as to facilitate the urban traffic management [6].Traffic flow can be divided into: noninterrupted traffic flow or continuous traffic flow and intermittent traffic flow according to the impact of traffic facilities on traffic flow. The intersection of traffic flow can be divided into intersection, confluence, diversion, and interweaving flow; according to the internal operating conditions of the traffic flow and their feelings for drivers and passengers, it can be divided into free flow, stable flow, unstable flow, and forced flow.Macro parameters include traffic volume, flow rate, speed, and traffic flow density. Microscopic parameters include headway and headway. Traffic volume, also known as flow, refers to the number of vehicles passing through a designated location or section of a road (or a lane on a road) per unit time. The flow rate refers to the number of vehicles per hour obtained by equivalent conversion of the number of vehicles passing through a designated location or section of a road (or a lane on a road) within a time period of less than 1 hour (usually 15 minutes).The application in probability theory mainly applies the method of probability theory to study the distribution law of traffic flow. The statistical distribution of traffic flow is the basis for studying traffic phenomena with probability theory, and it is also directly applied in the design of the length of turning lanes, the design of pedestrian crossing control signals, the determination of traffic capacity, and vehicle speed standards. There are three types of traffic distributions commonly used in probability theory research: traffic count distribution, interval distribution, and vehicle speed distribution. Queuing theory is a mathematical theory that studies and analyzes the phenomenon of queue congestion in service objects. It is an important part of operations research. Queuing theory mainly studies the probability distribution of waiting time and queuing length, so as to reasonably coordinate the relationship between “service object” and “service system,” so that it can not only meet the requirements of “service object” but also save the service system to the greatest extent’s expenses.


#### 2.1.1. Statistical Distribution of Traffic Flow

Although to some extent the arrival of vehicles is random, there are certain statistical laws, which can be described by two methods: one is the discrete distribution method, which is considered to be a discrete distribution if the number of vehicles in each road section cannot be found through observation and statistics of traffic flow; the other is the continuous distribution method, studying the statistical characteristics of the time interval of arrival in traffic flow; it is considered a continuous distribution [7, 8]. According to different traffic conditions and different distribution models, we can use the limited known traffic data to predict the future traffic conditions. Therefore, mastering the statistical distribution law of traffic is the basis of effectively solving the problem of traffic flow prediction [9].Through a large number of actual observations and statistics on traffic, the results show that the number of vehicles arriving at a certain section of the road in a certain observation period obeys the discrete distribution law, which mainly includes Poisson distribution, binomial distribution, and negative binomial distribution [10, 11].


#### 2.1.2. Characteristics of Mixed Traffic Flow

In China’s cities, the mixture of motor and nonmotor vehicles is a typical traffic situation [12]. In recent years, with the rapid development of China’s economy, the number of cars is growing rapidly, while the number of e-bikes is also growing rapidly, especially in the second and third tier cities, which is determined by the economy, convenience, and rapidity of e-bikes [13]. Under certain road conditions, the number of motor vehicles and nonmotor vehicles keeps increasing, which causes serious congestion in urban traffic [14]. In this case, in order to avoid wasting time on the road, people will choose e-bike, which has gradually become the first choice of green travel tools. This also determines that the urban road intersection in China is a mixture of motor and nonmotor traffic flow characteristics [15]. At present, one of the main reasons for the congestion of urban intersections in China is the mixed driving of motor vehicles and electric bicycles [16].e-bike has the characteristics of flexibility, fast start, cluster, swing and occupying the motorway, but the characteristics of motor vehicle are different from e-bike. It is because they have their own characteristics that they often interact with each other when they meet, especially at intersections where traffic flows converge, and produce conflicts and interferences [17].Through the analysis of the characteristics of the mixed traffic flow at the intersection, it can be seen that there may be a lot of conflict points between the mixed traffic flows at the intersection, resulting in the intersection congestion and even traffic accidents. The collision point is caused by vehicles in different directions arriving at a certain point at the same time. When motor vehicles and nonmotor vehicles meet, there will be many convergence points, interweaving points, and conflict points, which interfere with each other and restrict each other [18, 19].


### 2.2. Image Processing Technology

At present, the application of image processing technology is very extensive. It has made remarkable achievements in the fields of transportation, medicine, communication, geology, and so on. This paper mainly studies the related content of image processing technology in the field of transportation, including the identification of moving objects in the traffic video image, the prediction of moving objects’ driving track, and the application in the intelligent transportation system [20, 21].The purpose of image enhancement is to improve the visual effect of images; it is a collection of various techniques and has not yet formed a general theory. Commonly used image enhancement techniques include contrast processing, histogram correction, noise processing, edge enhancement, transformation processing, and false color. In multimedia applications, image enhancement processing is mainly performed on various types of images, and various image processing software generally supports image enhancement technology. The purpose of image restoration is to maintain the original appearance of the image and to correct the deterioration and distortion of the image in the process of formation, transmission, storage, recording, and display. Image restoration must first establish the image deterioration model and then restore the image according to the inverse process of its fading.For each frame of the original image in the video, there are more or less problems such as unclear target, fuzzy environment background, and noise points, which cause image quality degradation. Through the study of image processing technology, it can provide higher quality images for the next experimental link, making the experimental results more accurate.The two-dimensional matrix constructed by multiple pixel regions forms a digital image. The digital image processing technology includes image enhancement, image restoration, image coding, image segmentation, image description and recognition, and other technologies [22]. For the processing of video image in this paper, it mainly involves image enhancement technology, image segmentation technology, and so on [23].Image processing techniques include point processing, group processing, geometric processing, and frame processing.The most basic method of processing images is the point processing method, which gets its name because the objects processed by this method are pixels. The point processing method is simple and effective and is mainly used for image brightness adjustment, image contrast adjustment, and image brightness inversion processing. The range of image group processing is larger than that of point processing, and the processing object is a group of pixels, so it is also called “area processing or block processing.” The application of group processing methods on images is mainly manifested in detecting image edges and enhancing edges, image softening and sharpening, and increasing and reducing image random noise.Image enhancement technology is to better highlight the key information in the image according to some needs and reduce the impact of unimportant information on the image as much as possible, so that the image can meet the requirements more. Commonly used image enhancement techniques include grayscale and histogram equalization, spatial filtering, and frequency filtering. Image segmentation technology can be used to divide the image into many regions, extract the region where the target is located, and apply the image enhancement technology and segmentation technology comprehensively, which can make technical preparation for the next target detection and feature extraction. Commonly used image segmentation techniques include edge detection, contour tracking, and threshold segmentation.


#### 2.2.1. Spatial Filtering

(1) Median Filter. As a nonlinear neighborhood average filtering method, median filtering can effectively deal with impulse noise, also can better retain the details of the image, and overcome the image blur caused by linear filtering. The median filter uses the principle of sorting statistics to find out the middle value of the template coverage area, then replace the middle position of the template, and assign a value.The median filter mainly processes image processing through template matching, gray value reading, gray value sorting, middle gray value selection, and reassignment matching.(2) Gauss Filter. As a linear smoothing filtering method, Gauss filtering selects the weight through Gauss function. Gauss filtering can effectively deal with the noise points which obey Gauss distribution. General Gaussian distribution includes one-dimensional and two-dimensional Gaussian distributions. In video image processing, a two-dimensional convolution operator of two-dimensional Gaussian distribution is often selected.Gauss filter mainly calculates the weighted gray mean of the neighboring pixels in the template coverage area through template matching and then replaces the middle position of the template and reassigns.Image processing technology is generally divided into two categories: analog image processing and digital image processing.Analog image processing includes optical processing (using lenses) and electronic processing, such as photography, remote sensing image processing, and television signal processing. The characteristics of analog image processing are fast, generally real-time processing; theoretically, it can reach the speed of light and can be processed in parallel at the same time. A typical example of analog signal processing is television images, which process moving images at 25 frames per second. The disadvantages of analog image processing are poor accuracy, poor flexibility, and difficulty in judgment and nonlinear processing.


### 2.3. Framework Design of Mixed Traffic Flow Data Acquisition System

Based on the traditional video acquisition system including moving object detection and object tracking module, this system adds feature extraction module and object recognition module to identify pedestrians and nonmotor vehicles and improve the adaptive background extraction and update in object detection, occlusion, and interference in mixed traffic object tracking and other functions. A mixed traffic data acquisition system based on video image processing is established, which includes four parts: object detection, object tracking, feature extraction, and object recognition.(1)
Object detection: the module processes video stream and detects moving objects according to real-time background image.(2)
Object tracking: this module is used to detect the same object in the continuous image, avoiding the repeated output or missing output of the same object.(3)
Feature extraction: the module is used to process the image blocks output by the tracking module, get the physical parameters and morphological parameters of the image blocks to be identified, and use these features to represent the characteristics of different traffic objects.(4)
Object recognition: the theory and method of artificial intelligence and pattern recognition of the module analyze and recognize the above parameters and output the detection results.Streets and urbanization on both sides of the highway are serious. When my country’s highways were built, some local governments made more roads pass through the streets out of consideration for local economic interests, even though some roads did not pass through towns and complied with the requirement of “near the city but not into the city,” but the local government. In order to develop the local economy, its urban construction is still getting closer and closer to the highway, and even the highway is used as the street of the town. This phenomenon of streetization and urbanization has become a prominent problem in various places. In these sections, a large number of agricultural vehicles are involved in the transportation of passengers and goods. In addition, traffic participants have weak awareness of traffic safety, lack knowledge of traffic rules, and ignore traffic regulations, which has serious lateral interference to traffic. Various traffic modes converge here, there are many traffic conflict points, traffic order is chaotic, and traffic management is difficult, which is another objective condition for the existence of mixed traffic.In mixed traffic, various vehicles with great disparity in speed are mixed together, and their lateral interference is great, which greatly suppresses the running speed of vehicles and reduces the road capacity. Various mixed vehicles are driving on the same road. Due to the large difference in driving speed, overtaking often occurs during driving. Each overtaking is accompanied by following, diverting, merging, accelerating, and decelerating. Sharp steering, shifting speed, etc., aggravate traffic noise, traffic vibration and vehicle exhaust gas and other traffic pollution, which affects the physical and mental health of traffic participants.The right of way for traffic participants entering the intersection is clearly marked with clear and clear signs. It is impossible for highway intersections to clarify the right of way of traffic participants through the application of signal control like urban roads. Highway intersections should use traffic language such as marking and marking to clarify the right of way for road users. The requirements for marking and marking are as follows: It is easy to understand, clear, and highly recognizable, so as to minimize traffic conflicts, ensure that those with the right of way can pass safely, and ensure that the traffic flow is orderly and controllable.


### 2.4. Mixed Traffic Flow Object Recognition Based on BP Artificial Neural Network

#### 2.4.1. BP Neural Network

The BP neural network is a kind of multilayer feed forward network trained by back propagation algorithm. The core of the algorithm is the negative gradient descent theory in mathematics. That is to say, in order to make the actual output of the signal network closer to the expected output and its error meeting the requirements, the weight and threshold in the network can be adjusted continuously through error feedback. The BP network can learn and store a large number of mapping relationships without revealing the mathematical equations describing the mapping relationship between input and output modes in advance and can realize any nonlinear mapping from input to output. In the artificial neural network, the BP neural network is the core content.An artificial neural network does not need to determine the mathematical equation of the mapping relationship between input and output in advance. It only learns certain rules through its own training, and obtains the result closest to the expected output value when the input value is given. As an intelligent information processing system, the core of artificial neural network to realize its function is algorithm. The BP neural network is a multilayer feedforward network trained by error back propagation (referred to as error back propagation). Its algorithm is called the BP algorithm. Its basic idea is the gradient descent method, which uses gradient search technology to make the network. The mean square error between the actual output value and the expected output value is the smallest.


#### 2.4.2. BP Neural Network Structure

As a multilayer feed forward neural network, the BP neural network is composed of input layer, output layer, and hidden layer. There is one input layer and one output layer, while the hidden layer has one or more, and each layer contains multiple neurons. The BP neural network has three characteristics: one is a fully connected network; that is, the neurons in any layer and all the neurons in its adjacent layers are connected; the strength between the neurons in the input layer and the hidden layer and between the neurons in the hidden layer and the neurons in the output layer is the weight of the network; the other is that there is no connection between the neurons in the same layer; that is, the neurons in each layer of the network do not have any way of connection; the third is that there can be one or more hidden layers in the network, from left to right signals flowing gradually.When all neurons in the hidden layer adopt S-type transfer function and all neurons in the output layer adopt linear transfer function, the output value can reach any precision of any continuous function. But up to now, there is no universal method to determine the number of nodes in the hidden layer. The number of hidden layer nodes is related to the number and mode of input nodes and affects the performance of BP network. In general, a large number of hidden layer nodes will have better performance, but there will be over fitting phenomenon, reducing the generalization ability of the network.The BP neural network is relatively mature in terms of network theory and performance. Its outstanding advantages are its strong nonlinear mapping ability and flexible network structure. The number of intermediate layers of the network and the number of neurons in each layer can be arbitrarily set according to the specific situation, and the performance varies with the difference of the structure. But the BP neural network also has some major flaws. The learning speed is slow, and even a simple problem generally requires hundreds or even thousands of times of learning to converge. It is easy to fall into local minima.


#### 2.4.3. Working Process of BP Neural Network

The working process of BP neural network includes training process and testing process. The training process is to input the training samples into the neural network to get reasonable weights and thresholds; the test process is to input the test samples into the trained network to predict the output. The training process consists of two parts: forward propagation working signal and back propagation error signal. In the forward propagation stage, the training samples are input into the neural network from the input layer, and the predicted output value is obtained through the connection of weight, threshold, and transfer function. By comparing the predicted output with the expected output, we can judge whether the target function is reached. If it cannot meet the requirements, it will enter the stage of back propagation error; that is, error feedback continuously adjusts the weights and thresholds in the network and then enters the next training with new weights and thresholds, so that the predicted output of the signal network is closer to the expected output until the output meets the requirements.


#### 2.4.4. BP Neural Network for Mixed Object Recognition

In this paper, a three-layer BP neural network including am input layer, single hidden layer, and output layer is established to identify pedestrian and nonmotor vehicle objects.The input layer of the network consists of 36 neurons and receives the eigenvector x as the input vector. Its output layer contains two output neurons. When the input sample is a single pedestrian, the ideal output result is [10]T; when the output sample is a single nonmotor vehicle, the ideal output result is [01]T.For the neuron whose output result is 1, if the output result is greater than or equal to 0.90, the output result is 1; for the neuron whose output result is 0, if the output result is less than or equal to 0.10, the output result is 0; if the output result of the output layer is between 0.10 and 0.90, the output value cannot be judged for pedestrians or bicycles.In the selection of transfer function, because the transfer function of BP neural network must have the requirement of differentiability, the sigmoid function is usually selected as the transfer function. In addition, considering that the output of neural network in this paper may be greater than 1, and the output range of log sigmoid function is [0, 1]. Therefore, the linear transfer function is selected as the transfer function of the output node and the log sigmoid function as the transfer function of the hidden layer node.


### 2.5. Kalman Filter Tracking Model

The Kalman filter is a modern filtering method developed from the optimal prediction and estimation method. In short, Kalman filtering is an autoregressive optimization algorithm, whose important role is to estimate the state of the system. The prominent feature of Kalman filter is that it can effectively reduce the influence of random interference and measurement noise. When the noise is Gaussian white noise, the Kalman filter can give the minimum variance estimation of the system state; when the noise is non-Gaussian noise, the filter can give the linear minimum variance estimation of the system state. When the tracking system satisfies the linear stochastic differential system, i.e., the observation and measurement errors obey the Gaussian distribution, and the solution of Kalman filter is the optimal solution of the tracking problem, which means that in the linear Gaussian environment, the accuracy of Kalman filter is higher than any other algorithm.Considering that under nonlaboratory conditions, the tracking of mixed traffic flow objects will be affected by a large number of uncertain factors such as nonrigid body motion characteristics of pedestrians, nonlinear motion track, mutual occlusion, crowd aggregation, and pedestrian group splitting, the linear Kalman filter cannot describe the tracking of moving objects well in the above situations. Therefore, it is necessary to fuzzy match the observation vector extracted from the video image and the estimation vector estimated by the traditional Kalman model when the moving objects in the video image occlude each other; group split, crowd gathering, and other situations occur. Then the matched observations are tracked by the Kalman filter.


#### 2.5.1. Improved KF Tracking Model Based on Fuzzy Matching

In the Kalman filter, the system state model can be used to predict the target. In the process of object prediction and tracking, it is necessary to establish a system state model suitable for moving object tracking. Considering the slow moving speed of pedestrians and nonmotor vehicles and the small time interval between adjacent frames in the video sequence, it can be assumed that the displacement of moving objects between adjacent frames is the same, namely,(1)Pt=Pxt−1+pxt−1−pxt−2Pyt−1+pyt−1−pyt−2=2pxt−1−pxt−22pyt−1−pyt−2.Among them,pt is the position of the moving object’s center of mass at time t, and px,py are the components of the moving object’s center of mass at x-axis and y-axis, respectively. In addition, considering that pedestrian tracking belongs to the tracking of nonrigid objects under the condition of mixed traffic, the geometric characteristics of the external rectangle of the pedestrian’s contour appearance also have great changes. This change is not only reflected in the perspective change of the moving object but also reflected in the change of nonrigid body motion. Therefore, it is also necessary to predict the geometric characteristics of the moving object. Similar to the prediction of the motion state of the mixed traffic object, the geometric characteristics of the external rectangle of the moving object can be expressed as follows:
(2)gt=gxt−1+gxt−1−gxt−2gyt−1+gyt−1−gyt−2=2gxt−1−gxt−22gyt−1−gyt−2.Among them,gt is the size of the contour of the moving object at time t, and gx,gy are the components of the contour of the moving object in the X direction and Y direction, respectively. Therefore, this paper selects the position of the adjacent frames to replace the speed parameters in the traditional tracking model and establishes the state model and observation model.The state equation of the system is(3)xt=Ft−1xt−1+Gtwt.The measurement equation is(4)yt=Htxt+vt.The covariance error matrix of noise in the measurement equation is(5)Rt=EvtvTt=σpxt20000σpxt20000σpxt20000σpxt2.Next, the covariance matrix of the system prediction error needs to be calculated first:(6)P1−=FP0FT+Q.After obtaining the covariance matrix, the Kalman gain matrixKt of the system can be derived
(7)K1=P1−HTHP1−HT+R1−1.Then, after the Kalman gain matrix KT of the system is calculated, the predicted value of the system at that time can be modified. Because of the uncertainty of the predicted object movement in the traffic scene, based on the traditional Kalman filter, this paper firstly analyzes the observation value yt and the previous prediction by xt− to determine whether there are new traffic objects entering the scene from the boundary. Then, for the observation vector yt′ and prediction vector xt− excluding the new scene, they are, respectively, as follows:
(8)xt−>yt′,xt−<yt′,xt−=yt′.That is to say, the traffic objects in the scene are combined, split or moving normally to match. Finally, the observation vector result y is input to the system as the current observation value to improve the robustness of the system in dealing with the above problems.After obtaining the corrected system state through the above steps, the following formula can be used:(9)Pt=I−KtHPt−.The covariance matrix of prediction error in the state equation is updated.


## 2.1. Basic Theory of Traffic Flow

The traffic flow theory uses the laws of mathematics and mechanics to describe the characteristics of traffic flow and explains the traffic phenomenon and traffic mechanism, which is the theoretical basis of traffic signal control and traffic management [4, 5]. Through the detailed description of the traffic situation, people have a further in-depth understanding of the traffic phenomenon, so as to facilitate the urban traffic management [6].Traffic flow can be divided into: noninterrupted traffic flow or continuous traffic flow and intermittent traffic flow according to the impact of traffic facilities on traffic flow. The intersection of traffic flow can be divided into intersection, confluence, diversion, and interweaving flow; according to the internal operating conditions of the traffic flow and their feelings for drivers and passengers, it can be divided into free flow, stable flow, unstable flow, and forced flow.Macro parameters include traffic volume, flow rate, speed, and traffic flow density. Microscopic parameters include headway and headway. Traffic volume, also known as flow, refers to the number of vehicles passing through a designated location or section of a road (or a lane on a road) per unit time. The flow rate refers to the number of vehicles per hour obtained by equivalent conversion of the number of vehicles passing through a designated location or section of a road (or a lane on a road) within a time period of less than 1 hour (usually 15 minutes).The application in probability theory mainly applies the method of probability theory to study the distribution law of traffic flow. The statistical distribution of traffic flow is the basis for studying traffic phenomena with probability theory, and it is also directly applied in the design of the length of turning lanes, the design of pedestrian crossing control signals, the determination of traffic capacity, and vehicle speed standards. There are three types of traffic distributions commonly used in probability theory research: traffic count distribution, interval distribution, and vehicle speed distribution. Queuing theory is a mathematical theory that studies and analyzes the phenomenon of queue congestion in service objects. It is an important part of operations research. Queuing theory mainly studies the probability distribution of waiting time and queuing length, so as to reasonably coordinate the relationship between “service object” and “service system,” so that it can not only meet the requirements of “service object” but also save the service system to the greatest extent’s expenses.


### 2.1.1. Statistical Distribution of Traffic Flow

Although to some extent the arrival of vehicles is random, there are certain statistical laws, which can be described by two methods: one is the discrete distribution method, which is considered to be a discrete distribution if the number of vehicles in each road section cannot be found through observation and statistics of traffic flow; the other is the continuous distribution method, studying the statistical characteristics of the time interval of arrival in traffic flow; it is considered a continuous distribution [7, 8]. According to different traffic conditions and different distribution models, we can use the limited known traffic data to predict the future traffic conditions. Therefore, mastering the statistical distribution law of traffic is the basis of effectively solving the problem of traffic flow prediction [9].Through a large number of actual observations and statistics on traffic, the results show that the number of vehicles arriving at a certain section of the road in a certain observation period obeys the discrete distribution law, which mainly includes Poisson distribution, binomial distribution, and negative binomial distribution [10, 11].


### 2.1.2. Characteristics of Mixed Traffic Flow

In China’s cities, the mixture of motor and nonmotor vehicles is a typical traffic situation [12]. In recent years, with the rapid development of China’s economy, the number of cars is growing rapidly, while the number of e-bikes is also growing rapidly, especially in the second and third tier cities, which is determined by the economy, convenience, and rapidity of e-bikes [13]. Under certain road conditions, the number of motor vehicles and nonmotor vehicles keeps increasing, which causes serious congestion in urban traffic [14]. In this case, in order to avoid wasting time on the road, people will choose e-bike, which has gradually become the first choice of green travel tools. This also determines that the urban road intersection in China is a mixture of motor and nonmotor traffic flow characteristics [15]. At present, one of the main reasons for the congestion of urban intersections in China is the mixed driving of motor vehicles and electric bicycles [16].e-bike has the characteristics of flexibility, fast start, cluster, swing and occupying the motorway, but the characteristics of motor vehicle are different from e-bike. It is because they have their own characteristics that they often interact with each other when they meet, especially at intersections where traffic flows converge, and produce conflicts and interferences [17].Through the analysis of the characteristics of the mixed traffic flow at the intersection, it can be seen that there may be a lot of conflict points between the mixed traffic flows at the intersection, resulting in the intersection congestion and even traffic accidents. The collision point is caused by vehicles in different directions arriving at a certain point at the same time. When motor vehicles and nonmotor vehicles meet, there will be many convergence points, interweaving points, and conflict points, which interfere with each other and restrict each other [18, 19].


## 2.1.1. Statistical Distribution of Traffic Flow

Although to some extent the arrival of vehicles is random, there are certain statistical laws, which can be described by two methods: one is the discrete distribution method, which is considered to be a discrete distribution if the number of vehicles in each road section cannot be found through observation and statistics of traffic flow; the other is the continuous distribution method, studying the statistical characteristics of the time interval of arrival in traffic flow; it is considered a continuous distribution [7, 8]. According to different traffic conditions and different distribution models, we can use the limited known traffic data to predict the future traffic conditions. Therefore, mastering the statistical distribution law of traffic is the basis of effectively solving the problem of traffic flow prediction [9].Through a large number of actual observations and statistics on traffic, the results show that the number of vehicles arriving at a certain section of the road in a certain observation period obeys the discrete distribution law, which mainly includes Poisson distribution, binomial distribution, and negative binomial distribution [10, 11].


## 2.1.2. Characteristics of Mixed Traffic Flow

In China’s cities, the mixture of motor and nonmotor vehicles is a typical traffic situation [12]. In recent years, with the rapid development of China’s economy, the number of cars is growing rapidly, while the number of e-bikes is also growing rapidly, especially in the second and third tier cities, which is determined by the economy, convenience, and rapidity of e-bikes [13]. Under certain road conditions, the number of motor vehicles and nonmotor vehicles keeps increasing, which causes serious congestion in urban traffic [14]. In this case, in order to avoid wasting time on the road, people will choose e-bike, which has gradually become the first choice of green travel tools. This also determines that the urban road intersection in China is a mixture of motor and nonmotor traffic flow characteristics [15]. At present, one of the main reasons for the congestion of urban intersections in China is the mixed driving of motor vehicles and electric bicycles [16].e-bike has the characteristics of flexibility, fast start, cluster, swing and occupying the motorway, but the characteristics of motor vehicle are different from e-bike. It is because they have their own characteristics that they often interact with each other when they meet, especially at intersections where traffic flows converge, and produce conflicts and interferences [17].Through the analysis of the characteristics of the mixed traffic flow at the intersection, it can be seen that there may be a lot of conflict points between the mixed traffic flows at the intersection, resulting in the intersection congestion and even traffic accidents. The collision point is caused by vehicles in different directions arriving at a certain point at the same time. When motor vehicles and nonmotor vehicles meet, there will be many convergence points, interweaving points, and conflict points, which interfere with each other and restrict each other [18, 19].


## 2.2. Image Processing Technology

At present, the application of image processing technology is very extensive. It has made remarkable achievements in the fields of transportation, medicine, communication, geology, and so on. This paper mainly studies the related content of image processing technology in the field of transportation, including the identification of moving objects in the traffic video image, the prediction of moving objects’ driving track, and the application in the intelligent transportation system [20, 21].The purpose of image enhancement is to improve the visual effect of images; it is a collection of various techniques and has not yet formed a general theory. Commonly used image enhancement techniques include contrast processing, histogram correction, noise processing, edge enhancement, transformation processing, and false color. In multimedia applications, image enhancement processing is mainly performed on various types of images, and various image processing software generally supports image enhancement technology. The purpose of image restoration is to maintain the original appearance of the image and to correct the deterioration and distortion of the image in the process of formation, transmission, storage, recording, and display. Image restoration must first establish the image deterioration model and then restore the image according to the inverse process of its fading.For each frame of the original image in the video, there are more or less problems such as unclear target, fuzzy environment background, and noise points, which cause image quality degradation. Through the study of image processing technology, it can provide higher quality images for the next experimental link, making the experimental results more accurate.The two-dimensional matrix constructed by multiple pixel regions forms a digital image. The digital image processing technology includes image enhancement, image restoration, image coding, image segmentation, image description and recognition, and other technologies [22]. For the processing of video image in this paper, it mainly involves image enhancement technology, image segmentation technology, and so on [23].Image processing techniques include point processing, group processing, geometric processing, and frame processing.The most basic method of processing images is the point processing method, which gets its name because the objects processed by this method are pixels. The point processing method is simple and effective and is mainly used for image brightness adjustment, image contrast adjustment, and image brightness inversion processing. The range of image group processing is larger than that of point processing, and the processing object is a group of pixels, so it is also called “area processing or block processing.” The application of group processing methods on images is mainly manifested in detecting image edges and enhancing edges, image softening and sharpening, and increasing and reducing image random noise.Image enhancement technology is to better highlight the key information in the image according to some needs and reduce the impact of unimportant information on the image as much as possible, so that the image can meet the requirements more. Commonly used image enhancement techniques include grayscale and histogram equalization, spatial filtering, and frequency filtering. Image segmentation technology can be used to divide the image into many regions, extract the region where the target is located, and apply the image enhancement technology and segmentation technology comprehensively, which can make technical preparation for the next target detection and feature extraction. Commonly used image segmentation techniques include edge detection, contour tracking, and threshold segmentation.


### 2.2.1. Spatial Filtering

(1) Median Filter. As a nonlinear neighborhood average filtering method, median filtering can effectively deal with impulse noise, also can better retain the details of the image, and overcome the image blur caused by linear filtering. The median filter uses the principle of sorting statistics to find out the middle value of the template coverage area, then replace the middle position of the template, and assign a value.The median filter mainly processes image processing through template matching, gray value reading, gray value sorting, middle gray value selection, and reassignment matching.(2) Gauss Filter. As a linear smoothing filtering method, Gauss filtering selects the weight through Gauss function. Gauss filtering can effectively deal with the noise points which obey Gauss distribution. General Gaussian distribution includes one-dimensional and two-dimensional Gaussian distributions. In video image processing, a two-dimensional convolution operator of two-dimensional Gaussian distribution is often selected.Gauss filter mainly calculates the weighted gray mean of the neighboring pixels in the template coverage area through template matching and then replaces the middle position of the template and reassigns.Image processing technology is generally divided into two categories: analog image processing and digital image processing.Analog image processing includes optical processing (using lenses) and electronic processing, such as photography, remote sensing image processing, and television signal processing. The characteristics of analog image processing are fast, generally real-time processing; theoretically, it can reach the speed of light and can be processed in parallel at the same time. A typical example of analog signal processing is television images, which process moving images at 25 frames per second. The disadvantages of analog image processing are poor accuracy, poor flexibility, and difficulty in judgment and nonlinear processing.


## 2.2.1. Spatial Filtering

(1) Median Filter. As a nonlinear neighborhood average filtering method, median filtering can effectively deal with impulse noise, also can better retain the details of the image, and overcome the image blur caused by linear filtering. The median filter uses the principle of sorting statistics to find out the middle value of the template coverage area, then replace the middle position of the template, and assign a value.The median filter mainly processes image processing through template matching, gray value reading, gray value sorting, middle gray value selection, and reassignment matching.(2) Gauss Filter. As a linear smoothing filtering method, Gauss filtering selects the weight through Gauss function. Gauss filtering can effectively deal with the noise points which obey Gauss distribution. General Gaussian distribution includes one-dimensional and two-dimensional Gaussian distributions. In video image processing, a two-dimensional convolution operator of two-dimensional Gaussian distribution is often selected.Gauss filter mainly calculates the weighted gray mean of the neighboring pixels in the template coverage area through template matching and then replaces the middle position of the template and reassigns.Image processing technology is generally divided into two categories: analog image processing and digital image processing.Analog image processing includes optical processing (using lenses) and electronic processing, such as photography, remote sensing image processing, and television signal processing. The characteristics of analog image processing are fast, generally real-time processing; theoretically, it can reach the speed of light and can be processed in parallel at the same time. A typical example of analog signal processing is television images, which process moving images at 25 frames per second. The disadvantages of analog image processing are poor accuracy, poor flexibility, and difficulty in judgment and nonlinear processing.


## 2.3. Framework Design of Mixed Traffic Flow Data Acquisition System

Based on the traditional video acquisition system including moving object detection and object tracking module, this system adds feature extraction module and object recognition module to identify pedestrians and nonmotor vehicles and improve the adaptive background extraction and update in object detection, occlusion, and interference in mixed traffic object tracking and other functions. A mixed traffic data acquisition system based on video image processing is established, which includes four parts: object detection, object tracking, feature extraction, and object recognition.(1)
Object detection: the module processes video stream and detects moving objects according to real-time background image.(2)
Object tracking: this module is used to detect the same object in the continuous image, avoiding the repeated output or missing output of the same object.(3)
Feature extraction: the module is used to process the image blocks output by the tracking module, get the physical parameters and morphological parameters of the image blocks to be identified, and use these features to represent the characteristics of different traffic objects.(4)
Object recognition: the theory and method of artificial intelligence and pattern recognition of the module analyze and recognize the above parameters and output the detection results.Streets and urbanization on both sides of the highway are serious. When my country’s highways were built, some local governments made more roads pass through the streets out of consideration for local economic interests, even though some roads did not pass through towns and complied with the requirement of “near the city but not into the city,” but the local government. In order to develop the local economy, its urban construction is still getting closer and closer to the highway, and even the highway is used as the street of the town. This phenomenon of streetization and urbanization has become a prominent problem in various places. In these sections, a large number of agricultural vehicles are involved in the transportation of passengers and goods. In addition, traffic participants have weak awareness of traffic safety, lack knowledge of traffic rules, and ignore traffic regulations, which has serious lateral interference to traffic. Various traffic modes converge here, there are many traffic conflict points, traffic order is chaotic, and traffic management is difficult, which is another objective condition for the existence of mixed traffic.In mixed traffic, various vehicles with great disparity in speed are mixed together, and their lateral interference is great, which greatly suppresses the running speed of vehicles and reduces the road capacity. Various mixed vehicles are driving on the same road. Due to the large difference in driving speed, overtaking often occurs during driving. Each overtaking is accompanied by following, diverting, merging, accelerating, and decelerating. Sharp steering, shifting speed, etc., aggravate traffic noise, traffic vibration and vehicle exhaust gas and other traffic pollution, which affects the physical and mental health of traffic participants.The right of way for traffic participants entering the intersection is clearly marked with clear and clear signs. It is impossible for highway intersections to clarify the right of way of traffic participants through the application of signal control like urban roads. Highway intersections should use traffic language such as marking and marking to clarify the right of way for road users. The requirements for marking and marking are as follows: It is easy to understand, clear, and highly recognizable, so as to minimize traffic conflicts, ensure that those with the right of way can pass safely, and ensure that the traffic flow is orderly and controllable.


## 2.4. Mixed Traffic Flow Object Recognition Based on BP Artificial Neural Network

### 2.4.1. BP Neural Network

The BP neural network is a kind of multilayer feed forward network trained by back propagation algorithm. The core of the algorithm is the negative gradient descent theory in mathematics. That is to say, in order to make the actual output of the signal network closer to the expected output and its error meeting the requirements, the weight and threshold in the network can be adjusted continuously through error feedback. The BP network can learn and store a large number of mapping relationships without revealing the mathematical equations describing the mapping relationship between input and output modes in advance and can realize any nonlinear mapping from input to output. In the artificial neural network, the BP neural network is the core content.An artificial neural network does not need to determine the mathematical equation of the mapping relationship between input and output in advance. It only learns certain rules through its own training, and obtains the result closest to the expected output value when the input value is given. As an intelligent information processing system, the core of artificial neural network to realize its function is algorithm. The BP neural network is a multilayer feedforward network trained by error back propagation (referred to as error back propagation). Its algorithm is called the BP algorithm. Its basic idea is the gradient descent method, which uses gradient search technology to make the network. The mean square error between the actual output value and the expected output value is the smallest.


### 2.4.2. BP Neural Network Structure

As a multilayer feed forward neural network, the BP neural network is composed of input layer, output layer, and hidden layer. There is one input layer and one output layer, while the hidden layer has one or more, and each layer contains multiple neurons. The BP neural network has three characteristics: one is a fully connected network; that is, the neurons in any layer and all the neurons in its adjacent layers are connected; the strength between the neurons in the input layer and the hidden layer and between the neurons in the hidden layer and the neurons in the output layer is the weight of the network; the other is that there is no connection between the neurons in the same layer; that is, the neurons in each layer of the network do not have any way of connection; the third is that there can be one or more hidden layers in the network, from left to right signals flowing gradually.When all neurons in the hidden layer adopt S-type transfer function and all neurons in the output layer adopt linear transfer function, the output value can reach any precision of any continuous function. But up to now, there is no universal method to determine the number of nodes in the hidden layer. The number of hidden layer nodes is related to the number and mode of input nodes and affects the performance of BP network. In general, a large number of hidden layer nodes will have better performance, but there will be over fitting phenomenon, reducing the generalization ability of the network.The BP neural network is relatively mature in terms of network theory and performance. Its outstanding advantages are its strong nonlinear mapping ability and flexible network structure. The number of intermediate layers of the network and the number of neurons in each layer can be arbitrarily set according to the specific situation, and the performance varies with the difference of the structure. But the BP neural network also has some major flaws. The learning speed is slow, and even a simple problem generally requires hundreds or even thousands of times of learning to converge. It is easy to fall into local minima.


### 2.4.3. Working Process of BP Neural Network

The working process of BP neural network includes training process and testing process. The training process is to input the training samples into the neural network to get reasonable weights and thresholds; the test process is to input the test samples into the trained network to predict the output. The training process consists of two parts: forward propagation working signal and back propagation error signal. In the forward propagation stage, the training samples are input into the neural network from the input layer, and the predicted output value is obtained through the connection of weight, threshold, and transfer function. By comparing the predicted output with the expected output, we can judge whether the target function is reached. If it cannot meet the requirements, it will enter the stage of back propagation error; that is, error feedback continuously adjusts the weights and thresholds in the network and then enters the next training with new weights and thresholds, so that the predicted output of the signal network is closer to the expected output until the output meets the requirements.


### 2.4.4. BP Neural Network for Mixed Object Recognition

In this paper, a three-layer BP neural network including am input layer, single hidden layer, and output layer is established to identify pedestrian and nonmotor vehicle objects.The input layer of the network consists of 36 neurons and receives the eigenvector x as the input vector. Its output layer contains two output neurons. When the input sample is a single pedestrian, the ideal output result is [10]T; when the output sample is a single nonmotor vehicle, the ideal output result is [01]T.For the neuron whose output result is 1, if the output result is greater than or equal to 0.90, the output result is 1; for the neuron whose output result is 0, if the output result is less than or equal to 0.10, the output result is 0; if the output result of the output layer is between 0.10 and 0.90, the output value cannot be judged for pedestrians or bicycles.In the selection of transfer function, because the transfer function of BP neural network must have the requirement of differentiability, the sigmoid function is usually selected as the transfer function. In addition, considering that the output of neural network in this paper may be greater than 1, and the output range of log sigmoid function is [0, 1]. Therefore, the linear transfer function is selected as the transfer function of the output node and the log sigmoid function as the transfer function of the hidden layer node.


## 2.4.1. BP Neural Network

The BP neural network is a kind of multilayer feed forward network trained by back propagation algorithm. The core of the algorithm is the negative gradient descent theory in mathematics. That is to say, in order to make the actual output of the signal network closer to the expected output and its error meeting the requirements, the weight and threshold in the network can be adjusted continuously through error feedback. The BP network can learn and store a large number of mapping relationships without revealing the mathematical equations describing the mapping relationship between input and output modes in advance and can realize any nonlinear mapping from input to output. In the artificial neural network, the BP neural network is the core content.An artificial neural network does not need to determine the mathematical equation of the mapping relationship between input and output in advance. It only learns certain rules through its own training, and obtains the result closest to the expected output value when the input value is given. As an intelligent information processing system, the core of artificial neural network to realize its function is algorithm. The BP neural network is a multilayer feedforward network trained by error back propagation (referred to as error back propagation). Its algorithm is called the BP algorithm. Its basic idea is the gradient descent method, which uses gradient search technology to make the network. The mean square error between the actual output value and the expected output value is the smallest.


## 2.4.2. BP Neural Network Structure

As a multilayer feed forward neural network, the BP neural network is composed of input layer, output layer, and hidden layer. There is one input layer and one output layer, while the hidden layer has one or more, and each layer contains multiple neurons. The BP neural network has three characteristics: one is a fully connected network; that is, the neurons in any layer and all the neurons in its adjacent layers are connected; the strength between the neurons in the input layer and the hidden layer and between the neurons in the hidden layer and the neurons in the output layer is the weight of the network; the other is that there is no connection between the neurons in the same layer; that is, the neurons in each layer of the network do not have any way of connection; the third is that there can be one or more hidden layers in the network, from left to right signals flowing gradually.When all neurons in the hidden layer adopt S-type transfer function and all neurons in the output layer adopt linear transfer function, the output value can reach any precision of any continuous function. But up to now, there is no universal method to determine the number of nodes in the hidden layer. The number of hidden layer nodes is related to the number and mode of input nodes and affects the performance of BP network. In general, a large number of hidden layer nodes will have better performance, but there will be over fitting phenomenon, reducing the generalization ability of the network.The BP neural network is relatively mature in terms of network theory and performance. Its outstanding advantages are its strong nonlinear mapping ability and flexible network structure. The number of intermediate layers of the network and the number of neurons in each layer can be arbitrarily set according to the specific situation, and the performance varies with the difference of the structure. But the BP neural network also has some major flaws. The learning speed is slow, and even a simple problem generally requires hundreds or even thousands of times of learning to converge. It is easy to fall into local minima.


## 2.4.3. Working Process of BP Neural Network

The working process of BP neural network includes training process and testing process. The training process is to input the training samples into the neural network to get reasonable weights and thresholds; the test process is to input the test samples into the trained network to predict the output. The training process consists of two parts: forward propagation working signal and back propagation error signal. In the forward propagation stage, the training samples are input into the neural network from the input layer, and the predicted output value is obtained through the connection of weight, threshold, and transfer function. By comparing the predicted output with the expected output, we can judge whether the target function is reached. If it cannot meet the requirements, it will enter the stage of back propagation error; that is, error feedback continuously adjusts the weights and thresholds in the network and then enters the next training with new weights and thresholds, so that the predicted output of the signal network is closer to the expected output until the output meets the requirements.


## 2.4.4. BP Neural Network for Mixed Object Recognition

In this paper, a three-layer BP neural network including am input layer, single hidden layer, and output layer is established to identify pedestrian and nonmotor vehicle objects.The input layer of the network consists of 36 neurons and receives the eigenvector x as the input vector. Its output layer contains two output neurons. When the input sample is a single pedestrian, the ideal output result is [10]T; when the output sample is a single nonmotor vehicle, the ideal output result is [01]T.For the neuron whose output result is 1, if the output result is greater than or equal to 0.90, the output result is 1; for the neuron whose output result is 0, if the output result is less than or equal to 0.10, the output result is 0; if the output result of the output layer is between 0.10 and 0.90, the output value cannot be judged for pedestrians or bicycles.In the selection of transfer function, because the transfer function of BP neural network must have the requirement of differentiability, the sigmoid function is usually selected as the transfer function. In addition, considering that the output of neural network in this paper may be greater than 1, and the output range of log sigmoid function is [0, 1]. Therefore, the linear transfer function is selected as the transfer function of the output node and the log sigmoid function as the transfer function of the hidden layer node.


## 2.5. Kalman Filter Tracking Model

The Kalman filter is a modern filtering method developed from the optimal prediction and estimation method. In short, Kalman filtering is an autoregressive optimization algorithm, whose important role is to estimate the state of the system. The prominent feature of Kalman filter is that it can effectively reduce the influence of random interference and measurement noise. When the noise is Gaussian white noise, the Kalman filter can give the minimum variance estimation of the system state; when the noise is non-Gaussian noise, the filter can give the linear minimum variance estimation of the system state. When the tracking system satisfies the linear stochastic differential system, i.e., the observation and measurement errors obey the Gaussian distribution, and the solution of Kalman filter is the optimal solution of the tracking problem, which means that in the linear Gaussian environment, the accuracy of Kalman filter is higher than any other algorithm.Considering that under nonlaboratory conditions, the tracking of mixed traffic flow objects will be affected by a large number of uncertain factors such as nonrigid body motion characteristics of pedestrians, nonlinear motion track, mutual occlusion, crowd aggregation, and pedestrian group splitting, the linear Kalman filter cannot describe the tracking of moving objects well in the above situations. Therefore, it is necessary to fuzzy match the observation vector extracted from the video image and the estimation vector estimated by the traditional Kalman model when the moving objects in the video image occlude each other; group split, crowd gathering, and other situations occur. Then the matched observations are tracked by the Kalman filter.


### 2.5.1. Improved KF Tracking Model Based on Fuzzy Matching

In the Kalman filter, the system state model can be used to predict the target. In the process of object prediction and tracking, it is necessary to establish a system state model suitable for moving object tracking. Considering the slow moving speed of pedestrians and nonmotor vehicles and the small time interval between adjacent frames in the video sequence, it can be assumed that the displacement of moving objects between adjacent frames is the same, namely,(1)Pt=Pxt−1+pxt−1−pxt−2Pyt−1+pyt−1−pyt−2=2pxt−1−pxt−22pyt−1−pyt−2.Among them,pt is the position of the moving object’s center of mass at time t, and px,py are the components of the moving object’s center of mass at x-axis and y-axis, respectively. In addition, considering that pedestrian tracking belongs to the tracking of nonrigid objects under the condition of mixed traffic, the geometric characteristics of the external rectangle of the pedestrian’s contour appearance also have great changes. This change is not only reflected in the perspective change of the moving object but also reflected in the change of nonrigid body motion. Therefore, it is also necessary to predict the geometric characteristics of the moving object. Similar to the prediction of the motion state of the mixed traffic object, the geometric characteristics of the external rectangle of the moving object can be expressed as follows:
(2)gt=gxt−1+gxt−1−gxt−2gyt−1+gyt−1−gyt−2=2gxt−1−gxt−22gyt−1−gyt−2.Among them,gt is the size of the contour of the moving object at time t, and gx,gy are the components of the contour of the moving object in the X direction and Y direction, respectively. Therefore, this paper selects the position of the adjacent frames to replace the speed parameters in the traditional tracking model and establishes the state model and observation model.The state equation of the system is(3)xt=Ft−1xt−1+Gtwt.The measurement equation is(4)yt=Htxt+vt.The covariance error matrix of noise in the measurement equation is(5)Rt=EvtvTt=σpxt20000σpxt20000σpxt20000σpxt2.Next, the covariance matrix of the system prediction error needs to be calculated first:(6)P1−=FP0FT+Q.After obtaining the covariance matrix, the Kalman gain matrixKt of the system can be derived
(7)K1=P1−HTHP1−HT+R1−1.Then, after the Kalman gain matrix KT of the system is calculated, the predicted value of the system at that time can be modified. Because of the uncertainty of the predicted object movement in the traffic scene, based on the traditional Kalman filter, this paper firstly analyzes the observation value yt and the previous prediction by xt− to determine whether there are new traffic objects entering the scene from the boundary. Then, for the observation vector yt′ and prediction vector xt− excluding the new scene, they are, respectively, as follows:
(8)xt−>yt′,xt−<yt′,xt−=yt′.That is to say, the traffic objects in the scene are combined, split or moving normally to match. Finally, the observation vector result y is input to the system as the current observation value to improve the robustness of the system in dealing with the above problems.After obtaining the corrected system state through the above steps, the following formula can be used:(9)Pt=I−KtHPt−.The covariance matrix of prediction error in the state equation is updated.


## 2.5.1. Improved KF Tracking Model Based on Fuzzy Matching

In the Kalman filter, the system state model can be used to predict the target. In the process of object prediction and tracking, it is necessary to establish a system state model suitable for moving object tracking. Considering the slow moving speed of pedestrians and nonmotor vehicles and the small time interval between adjacent frames in the video sequence, it can be assumed that the displacement of moving objects between adjacent frames is the same, namely,(1)Pt=Pxt−1+pxt−1−pxt−2Pyt−1+pyt−1−pyt−2=2pxt−1−pxt−22pyt−1−pyt−2.Among them,pt is the position of the moving object’s center of mass at time t, and px,py are the components of the moving object’s center of mass at x-axis and y-axis, respectively. In addition, considering that pedestrian tracking belongs to the tracking of nonrigid objects under the condition of mixed traffic, the geometric characteristics of the external rectangle of the pedestrian’s contour appearance also have great changes. This change is not only reflected in the perspective change of the moving object but also reflected in the change of nonrigid body motion. Therefore, it is also necessary to predict the geometric characteristics of the moving object. Similar to the prediction of the motion state of the mixed traffic object, the geometric characteristics of the external rectangle of the moving object can be expressed as follows:
(2)gt=gxt−1+gxt−1−gxt−2gyt−1+gyt−1−gyt−2=2gxt−1−gxt−22gyt−1−gyt−2.Among them,gt is the size of the contour of the moving object at time t, and gx,gy are the components of the contour of the moving object in the X direction and Y direction, respectively. Therefore, this paper selects the position of the adjacent frames to replace the speed parameters in the traditional tracking model and establishes the state model and observation model.The state equation of the system is(3)xt=Ft−1xt−1+Gtwt.The measurement equation is(4)yt=Htxt+vt.The covariance error matrix of noise in the measurement equation is(5)Rt=EvtvTt=σpxt20000σpxt20000σpxt20000σpxt2.Next, the covariance matrix of the system prediction error needs to be calculated first:(6)P1−=FP0FT+Q.After obtaining the covariance matrix, the Kalman gain matrixKt of the system can be derived
(7)K1=P1−HTHP1−HT+R1−1.Then, after the Kalman gain matrix KT of the system is calculated, the predicted value of the system at that time can be modified. Because of the uncertainty of the predicted object movement in the traffic scene, based on the traditional Kalman filter, this paper firstly analyzes the observation value yt and the previous prediction by xt− to determine whether there are new traffic objects entering the scene from the boundary. Then, for the observation vector yt′ and prediction vector xt− excluding the new scene, they are, respectively, as follows:
(8)xt−>yt′,xt−<yt′,xt−=yt′.That is to say, the traffic objects in the scene are combined, split or moving normally to match. Finally, the observation vector result y is input to the system as the current observation value to improve the robustness of the system in dealing with the above problems.After obtaining the corrected system state through the above steps, the following formula can be used:(9)Pt=I−KtHPt−.The covariance matrix of prediction error in the state equation is updated.


## 3. Experiments

### 3.1. Experimental Environment

AMD Athlon (Barton) 250+@1800MHz is the processor used. Memory size is 512 M. Microsoft Windows XP with SPZ is the operating system. The development platform is as follows: Microsoft Visual Studio.Net. There are two environments for video sample collection: no interference and natural conditions. Video sample collection frequency is 25 frames/second. The number of video samples is as follows: 20 for nonmotor vehicle, pedestrian, and mixed interference.


### 3.2. System Initialization

In the experiment, it is difficult to get the initial states of x0 and P0 accurately. Since the Kalman filter constantly uses new information to modify the state in the recursive process, the influence of the initial position of the moving object on the tracking effect of the whole system is very small when the filtering time is sufficiently long, and the influence of the initial covariance matrix on the covariance matrix of filter estimation will also be attenuated to nearly zero. Considering that the measurement error of the collected video image is relatively small during the experiment and the error mainly comes from the system error WT, the initial value of the whole system is set as follows:(10)P0=1010101010101010,Q0=101010100000,(11)H0=10000000010000000010000000010000,R0=5555.


### 3.3. Test Steps

In this paper, the fuzzy reasoning is used to evaluate the matching degree of the moving object in a certain position through the motion track of the moving object, the size of the contour of the moving object, and the matching of the color template (the membership functions of the input and output aref1,f2,f3,andf4, respectively). The minimum operation rule of Mamdani is adopted in fuzzy reasoning. At last, the best matching relationship between the detection value and the prediction value is obtained by making the reasoning result of miso’s fuzzy reasoning function clear.In each recursive operation, the positionxt− of pedestrians and nonmotor vehicles is predicted first, then the variance Pt− of the motion error of travelers and nonmotor vehicles is calculated according to the predicted value, and the Kalman gain Kt is calculated by the optimal filtering rule. After the error compensation of Kalman gain, the optimal filtering value of the motion target position is obtained, and then the predicted value of pedestrians and nonmotor vehicles is calculated by the prediction equation.


## 3.1. Experimental Environment

AMD Athlon (Barton) 250+@1800MHz is the processor used. Memory size is 512 M. Microsoft Windows XP with SPZ is the operating system. The development platform is as follows: Microsoft Visual Studio.Net. There are two environments for video sample collection: no interference and natural conditions. Video sample collection frequency is 25 frames/second. The number of video samples is as follows: 20 for nonmotor vehicle, pedestrian, and mixed interference.


## 3.2. System Initialization

In the experiment, it is difficult to get the initial states of x0 and P0 accurately. Since the Kalman filter constantly uses new information to modify the state in the recursive process, the influence of the initial position of the moving object on the tracking effect of the whole system is very small when the filtering time is sufficiently long, and the influence of the initial covariance matrix on the covariance matrix of filter estimation will also be attenuated to nearly zero. Considering that the measurement error of the collected video image is relatively small during the experiment and the error mainly comes from the system error WT, the initial value of the whole system is set as follows:(10)P0=1010101010101010,Q0=101010100000,(11)H0=10000000010000000010000000010000,R0=5555.


## 3.3. Test Steps

In this paper, the fuzzy reasoning is used to evaluate the matching degree of the moving object in a certain position through the motion track of the moving object, the size of the contour of the moving object, and the matching of the color template (the membership functions of the input and output aref1,f2,f3,andf4, respectively). The minimum operation rule of Mamdani is adopted in fuzzy reasoning. At last, the best matching relationship between the detection value and the prediction value is obtained by making the reasoning result of miso’s fuzzy reasoning function clear.In each recursive operation, the positionxt− of pedestrians and nonmotor vehicles is predicted first, then the variance Pt− of the motion error of travelers and nonmotor vehicles is calculated according to the predicted value, and the Kalman gain Kt is calculated by the optimal filtering rule. After the error compensation of Kalman gain, the optimal filtering value of the motion target position is obtained, and then the predicted value of pedestrians and nonmotor vehicles is calculated by the prediction equation.


## 4. Discussion

### 4.1. Single Nonmotor Vehicle Sample

The effect of using the algorithm to track a single nonmotor vehicle object in a video sample is shown in Figure1. Among them are the tracking diagram and prediction error diagram of nonmotor vehicles in the experimental video sequence, respectively. The experimental results show that in the nonmotor vehicle video sequence, the maximum value of tracking error in the X direction is -1.5 pixels, which is generated from the initial state of nonmotor vehicle object tracking. The mean value of the whole sequence error is 0.009 pixels, and the variance is 0.345 pixels; the maximum value of tracking error in the Y direction is 14.967 pixels, which is generated in frame 22, and the mean value of the whole sequence error is 1.177 pixels, and the variance is 5.051 pixels.Figure 1
Nonmotor vehicle tracking results.It can be found that the error in the Y direction is significantly greater than that in the X direction. This is because the video taken in this experiment is perpendicular to the nonmotorized vehicle lane, the movement of nonmotorized vehicle in the video is mainly concentrated in the Y direction, and the X direction displacement changes little, which makes the prediction of X direction displacement of this model more accurate than that of Y direction displacement.


### 4.2. Single Pedestrian Sample

In the pedestrian sequence, the experiment approximately simulates the tracking effect when the moving object is occluded by deleting some frames in the video sequence. The effect of tracking a single pedestrian object in a video sample is shown in Figure2, which shows the schematic diagram of pedestrian prediction error in the video sequence.Figure 2
Pedestrian tracking results with missing data.The maximum value of pedestrian tracking error in the X direction is 9.247 pixels, which is generated in the last frame when the image is occluded. The mean value of error is 0.430 pixels, and the variance is 16.353 pixels. The maximum value of error in the Y direction is 14.321 pixels, which is generated in the last frame when the image is occluded. The mean value of error is 0.530 pixels, and the variance is 20.394 pixels. After excluding the influence of occlusion, the maximum error of X direction of pedestrian tracking is -5.727 pixels, which is generated from the initial state of pedestrian tracking. The mean value of error is -0.001 pixels, and the variance is 8.286 pixels. The maximum value of Y direction error is 1.198 pixels, which is generated in frame 5. The mean value of the whole sequence error is 0.013 pixels, and the variance is 3.05 pixels.When the object is occluded in the pedestrian tracking sequence, the system will automatically predict the position of the moving object through the position of the previous several frames, and the prediction error is less than 16 pixels, which is similar to the shape size of the moving object. Moreover, when the moving object reappears, the system can quickly fit to the real motion state and track the moving object effectively.


### 4.3. Mixed Samples of Nonmotor Vehicles and Pedestrians

In view of the overlap and split of some objects in the video sequence, this paper uses 20 video sequences of pedestrian, nonmotor vehicle, and mixed case to verify it. When pedestrians and nonmotor vehicles interfere with each other, the tracking effect based on this algorithm is shown in Figure3.Figure 3
Actual tracking under mutual interference of pedestrians and nonmotor vehicles.The algorithm can effectively judge the pedestrian occlusion of nonmotor vehicles. When the two are combined, the method can estimate the motion of pedestrians and nonmotor vehicles, respectively. With the continuous motion of pedestrian and nonmotor vehicle objects, this algorithm can effectively continue to identify and track the moving objects when they are divided into two separate sub individuals.The red rectangle represents the detected object border; when there is an object aggregation, the red rectangle represents the detected object external border after the algorithm correction. The green border in the figure indicates that the algorithm can predict the outer border of the moving object in the next frame. The lines in the scene represent the predicted trajectory of Kalman filter of different objects and the actual motion trajectory obtained by image detection.Comparing the two trajectory lines, we can see that the tracking accuracy of the algorithm is relatively high under the mutual interference of pedestrian and nonmaneuvering. Excluding the detection error, the pedestrian tracking error is less than 10 pixels, the average error is 2.366 pixels, the maximum error of nonmotor vehicle tracking is 19 pixels, and the average error is 2.5 pixels.


### 4.4. Traditional Kalian vs. Improved Kalman

Compared with the traditional Kalman filter tracking model, the 60 video sequence samples given in this paper are used for model verification, as shown in Table1 and Figure 4: (1) under the condition of mixed traffic, the improved Kalman filter model proposed in this paper can effectively improve the applicability of the traditional Kalman filter tracking model, which cannot deal with the mutual interference between traffic objects in mixed traffic; (2) in addition, this model in the processing of pedestrian or nonmotor vehicle samples and the tracking accuracy are improved to some extent; (3) the tracking accuracy of nonmotor vehicle samples is better than that of pedestrian samples. Through the analysis, it can be found that the motion characteristics of the nonmotor vehicle objects tend to the rigid body motion characteristics, which is much better than the pedestrian samples in the motion stability, resulting in the model having a higher accuracy in tracking the nonmotor vehicle samples.Table 1
Tracking results of traditional Kalian filtering model.
Actual traffic objectsTracking objectsTracked correctlyFalse trackingTrackingLeakage trackingFalse reportPedestrian201916380%20%15%Nonmotor vehicle201919095%5%0%Mixed situation40——————Figure 4
Tracking results of the improved Kalman filtering model.


## 4.1. Single Nonmotor Vehicle Sample

The effect of using the algorithm to track a single nonmotor vehicle object in a video sample is shown in Figure1. Among them are the tracking diagram and prediction error diagram of nonmotor vehicles in the experimental video sequence, respectively. The experimental results show that in the nonmotor vehicle video sequence, the maximum value of tracking error in the X direction is -1.5 pixels, which is generated from the initial state of nonmotor vehicle object tracking. The mean value of the whole sequence error is 0.009 pixels, and the variance is 0.345 pixels; the maximum value of tracking error in the Y direction is 14.967 pixels, which is generated in frame 22, and the mean value of the whole sequence error is 1.177 pixels, and the variance is 5.051 pixels.Figure 1
Nonmotor vehicle tracking results.It can be found that the error in the Y direction is significantly greater than that in the X direction. This is because the video taken in this experiment is perpendicular to the nonmotorized vehicle lane, the movement of nonmotorized vehicle in the video is mainly concentrated in the Y direction, and the X direction displacement changes little, which makes the prediction of X direction displacement of this model more accurate than that of Y direction displacement.


## 4.2. Single Pedestrian Sample

In the pedestrian sequence, the experiment approximately simulates the tracking effect when the moving object is occluded by deleting some frames in the video sequence. The effect of tracking a single pedestrian object in a video sample is shown in Figure2, which shows the schematic diagram of pedestrian prediction error in the video sequence.Figure 2
Pedestrian tracking results with missing data.The maximum value of pedestrian tracking error in the X direction is 9.247 pixels, which is generated in the last frame when the image is occluded. The mean value of error is 0.430 pixels, and the variance is 16.353 pixels. The maximum value of error in the Y direction is 14.321 pixels, which is generated in the last frame when the image is occluded. The mean value of error is 0.530 pixels, and the variance is 20.394 pixels. After excluding the influence of occlusion, the maximum error of X direction of pedestrian tracking is -5.727 pixels, which is generated from the initial state of pedestrian tracking. The mean value of error is -0.001 pixels, and the variance is 8.286 pixels. The maximum value of Y direction error is 1.198 pixels, which is generated in frame 5. The mean value of the whole sequence error is 0.013 pixels, and the variance is 3.05 pixels.When the object is occluded in the pedestrian tracking sequence, the system will automatically predict the position of the moving object through the position of the previous several frames, and the prediction error is less than 16 pixels, which is similar to the shape size of the moving object. Moreover, when the moving object reappears, the system can quickly fit to the real motion state and track the moving object effectively.


## 4.3. Mixed Samples of Nonmotor Vehicles and Pedestrians

In view of the overlap and split of some objects in the video sequence, this paper uses 20 video sequences of pedestrian, nonmotor vehicle, and mixed case to verify it. When pedestrians and nonmotor vehicles interfere with each other, the tracking effect based on this algorithm is shown in Figure3.Figure 3
Actual tracking under mutual interference of pedestrians and nonmotor vehicles.The algorithm can effectively judge the pedestrian occlusion of nonmotor vehicles. When the two are combined, the method can estimate the motion of pedestrians and nonmotor vehicles, respectively. With the continuous motion of pedestrian and nonmotor vehicle objects, this algorithm can effectively continue to identify and track the moving objects when they are divided into two separate sub individuals.The red rectangle represents the detected object border; when there is an object aggregation, the red rectangle represents the detected object external border after the algorithm correction. The green border in the figure indicates that the algorithm can predict the outer border of the moving object in the next frame. The lines in the scene represent the predicted trajectory of Kalman filter of different objects and the actual motion trajectory obtained by image detection.Comparing the two trajectory lines, we can see that the tracking accuracy of the algorithm is relatively high under the mutual interference of pedestrian and nonmaneuvering. Excluding the detection error, the pedestrian tracking error is less than 10 pixels, the average error is 2.366 pixels, the maximum error of nonmotor vehicle tracking is 19 pixels, and the average error is 2.5 pixels.


## 4.4. Traditional Kalian vs. Improved Kalman

Compared with the traditional Kalman filter tracking model, the 60 video sequence samples given in this paper are used for model verification, as shown in Table1 and Figure 4: (1) under the condition of mixed traffic, the improved Kalman filter model proposed in this paper can effectively improve the applicability of the traditional Kalman filter tracking model, which cannot deal with the mutual interference between traffic objects in mixed traffic; (2) in addition, this model in the processing of pedestrian or nonmotor vehicle samples and the tracking accuracy are improved to some extent; (3) the tracking accuracy of nonmotor vehicle samples is better than that of pedestrian samples. Through the analysis, it can be found that the motion characteristics of the nonmotor vehicle objects tend to the rigid body motion characteristics, which is much better than the pedestrian samples in the motion stability, resulting in the model having a higher accuracy in tracking the nonmotor vehicle samples.Table 1
Tracking results of traditional Kalian filtering model.
Actual traffic objectsTracking objectsTracked correctlyFalse trackingTrackingLeakage trackingFalse reportPedestrian201916380%20%15%Nonmotor vehicle201919095%5%0%Mixed situation40——————Figure 4
Tracking results of the improved Kalman filtering model.


## 5. Conclusions

In this paper, for moving object detection, an adaptive difference threshold selection method based on Gaussian mixture model is proposed, and the causes of image noise are further classified. Based on the characteristics of different types of noise, the current theory and method of moving object detection are improved by using image neighborhood information, light change information, and color space information.Firstly, the feasibility and limitation of using Kalman filter to track complex traffic objects in real traffic scenes are analyzed. On this basis, a Kalman tracking model based on fuzzy matching is proposed, which uses Kalman filtering theory to model the tracking of pedestrians and nonmotor vehicles. The fuzzy matching theory is used to deal with the occlusion, merging, and splitting of different traffic objects in the traffic scene and forecast the tracking.In the two-dimensional plane moving target tracking model, the position, shape, and color information of the observed object are fully used to predict the position of the target in the next image. The feasibility of object tracking and prediction based on the Kalman filter model of fuzzy matching is verified by an example, and it can track the moving track of the moving object more accurately when the foreground object is occluded or the experimental data is missing and when the objects are occluded with each other. Future research should make recommendations for addressing the problem of mixed traffic flows.



---

*Source: 9699162-2022-04-22.xml*