# Multi-Vehicle Tracking Based on Monocular Camera in Driver View
## 3 Proposed Algorithm
### Motion Model  
In multiple vehicle tracking, we use the constant velocity as a motion model with a Kalman filter [15] when we assume the tracking system as a linear Gaussian process. In the following section, we derive the constant velocity motion model for objects represented with  
Figure 2: The pipeline of the data association algorithm that has two match steps and a Kalman filter. aspect ratio and height as well as the detected bounding box-center coordinate. Suppose each target follows a linear Gaussian model:  
\[f_{k|k-1}(x|\epsilon) =\mathcal{N}(x;F_{k-1}\epsilon,Q_{k-1}) \tag{6}\] \[g_{k}(z|x) =\mathcal{N}(z;H_{k}x,R_{k}) \tag{7}\]  
where \(f_{k|k-1}(\cdot|\epsilon)\) is the state transition probability of a single object at time \(k\) when given the previous state \(\epsilon\). \(g_{k}(z|x)\) is the likelihood function of the single object, which defines the probability that \(z\) is observed under conditions as state \(x\). \(\mathcal{N}(\cdot;m,P)\) is a Gaussian density whose mean and covariance are \(m\) and \(P\), respectively. \(F_{k-1}\) is the state transition matrix and \(Q_{k-1}\) denotes the covariance matrix of the process noises. \(H_{k}\) is the measurement matrix. \(R_{k}\) denotes the covariance matrix of the measurement noises, which can be measured from the detection and ground truth of training datasets. Our objective now is to obtain the formulation of \(F_{k}\), \(Q_{k}\), \(H_{k}\), and \(R_{k}\). Suppose that the centers of the detection box to be estimated are denoted by \((x_{b,k},y_{b,k})\) and that the aspect ratio and the height of the bounding box detected at the coordinates of the image to be estimated are represented by \(a_{b,k}\) and \(h_{b,k}\), respectively, at time \(k\). The velocity of the centers of the detected box, the bounding box, the aspect ratio, and the height are indicated by \((\dot{x}_{b,k},\dot{y}_{b,k})\), \(a_{b,k}\), and \(h_{b,k}\), respectively. The state space model can also be expressed as a vector-matrix representation as follows:  
\[\underbrace{ \begin{bmatrix}x_{b,k}\\ y_{b,k}\\ \dot{x}_{b,k}\\ \dot{y}_{b,k}\\ a_{b,k}\\ \dot{a}_{b,k}\\ \dot{a}_{b,k}\\ \dot{b}_{b,k}\\ \end{bmatrix} }_{X_{k}}=\underbrace{ \begin{bmatrix}1&0&\delta t&0&0&0&0&0\\ 0&1&0&\delta t&0&0&0&0\\ 0&0&1&0&0&0&0&0\\ 0&0&0&1&0&0&0&0\\ 0&0&0&0&1&0&\delta t&0\\ 0&0&0&0&0&1&0&\delta t\\ 0&0&0&0&0&1&0&\delta t\\ 0&0&0&0&0&0&1&0\\ 0&0&0&0&0&0&1&0\\ 0&0&0&0&0&0&1\end{bmatrix}\begin{bmatrix}x_{b,k-1}\\ y_{b,k-1}\\ \dot{x}_{b,k-1}\\ \dot{y}_{b,k-1}\\ \dot{a}_{b,k-1}\\ \dot{b}_{b,k-1}\\ \dot{a}_{b,k-1}\\ \dot{b}_{b,k-1}\\ \end{bmatrix} }_{X_{k-1}}+\underbrace{ \begin{bmatrix}\delta t^{2}w_{x,k-1}\\ \dot{x}_{b,k-1}\\ \dot{x}_{b,k-1}\\ \dot{a}_{b,k-1}\\ \dot{b}_{b,k-1}\\ \dot{a}_{b,k-1}\\ \dot{a}_{b,k-1}\\ \dot{b}_{b,k-1}\\ \end{bmatrix} }_{W_{k-1}} \tag{8}\]  
where \(w_{*,k-1}\) denotes a piece-wise constant white acceleration that can be described by a zero-mean Gaussian white noise as \(w_{*,k-1}\sim\mathcal{N}(0,\sigma_{*,k-1}^{2})\). The \(\sigma_{*,k-1}^{2}\) is a variance which determines the relaxation level of the constant velocity assumption. \(\delta t\) is the time between frames. Equation (8) can be also represented as:  
\[X_{k}=F_{k-1}X_{k-1}+W_{k-1} \tag{9}\]  
where the value of the state transition matrix \(F_{k-1}\) is given in Equation (8) and \(W_{k-1}\sim\mathcal{N}(0,Q_{k-1})\). Therefore, \(Q_{k-1}\) can be obtained by computing the covariance of \(W_{k-1}\) as:  
\[Q_{k-1}=Cov(W_{k-1})=E[W_{k-1}W_{k-1}^{T}] \tag{10}\]  
where \(E[W_{k-1}W_{k-1}^{T}]\) denotes the mean of \(W_{k-1}\) and \(W_{k-1}^{T}\).