# Robust Visual Tracking via Patch Descriptor and Structural Local Sparse Representation
## 4 Object Tracking  
The basic flow of the proposed tracking algorithm is illustrated in Figure 2.  
Figure 2: Schematic diagram of the proposed tracking method. Our tracking method was carried out within the filter framework. At any time \(t\), all target observations up to time \(t\) can be denoted by \(R_{t}=\{r_{1},r_{2},\ldots,r_{t}\}\), and the state of a tracked object can be represented by \(z_{t}\). The optimal state of the tracked object can be computed by the maximum a posteriori estimation, \(\hat{z}_{t}=\underset{z_{t}^{i}}{\operatorname{argmax}}p(z_{t}^{i}\bigg{|}R_{ t})\), where \(z_{t}^{i}\) is the \(i^{\text{th}}\) sample of the state \(z_{t}\). The posterior probability was computed by the Bayesian theorem recursively:  
\[p(z_{t}|R_{t})\propto p(r_{t}|z_{t})\int p(z_{t}|z_{t-1})p(z_{t-1}|R_{t-1})dz_{ t-1} \tag{5}\]  
where \(p(z_{t}|z_{t-1})\) is the motion model between two consecutive states and \(p(r_{t}|z_{t})\) is the observation model. We modeled the motion of the object between two consecutive frames by affine transform. The state transition was formulated by random walk, i.e., \(p(z_{t}|z_{t-1})=\mathcal{N}(z_{t}:z_{t-1},\Sigma)\), where \(z_{t}=\{\alpha_{t},\beta_{t},\mu_{t},v_{t}\}\) denotes the \(x\), \(y\) translations, scale and aspect ratio at time \(t\), respectively. \(\Sigma=diag\Big{(}\sigma_{\alpha\
u}^{2},\sigma_{\beta}^{2},\sigma_{\mu}^{2}, \sigma_{\
u}^{2}\Big{)}\) is a diagonal covariance matrix, of which elements are the variances of the affine parameters. The observation model \(p(r_{t}|z_{t})\) estimates the likelihood of observing \(r_{t}\) at a state \(z_{t}\). It plays an important role in object tracking, because it can reflect the variations of target appearance. In our algorithm,  
To further alleviate the problem of noise to be updated into the target templates, we introduced the outlier ratio \(\eta\) to describe the outlier degree of a target object, which is denoted as:  
\[\eta=1-\sum_{j=1}^{N}\rho_{j}/N. \tag{9}\]  
We set two thresholds tr1 and tr2 to control the update of the template. If \(\eta<\) tr1, we updated the templates with this sample. If \(\eta>\) tr2, it meant that a significant part of the target object was corrupted, and we discarded this sample without update. If tr1 \(\leq\eta\leq\) tr2, it indicated that the target was partially corrupted. We then replaced the corrupted patches by its corresponding parts of the average observation \(\mathbf{\mu}\), and used this recovered sample for update. In order to recover the sample from corruptions, we constructed the sparse reconstruction error map of sub-patches and obtained the patch descriptor \(\mathbf{\rho}\). Then, the mask map \(\mathbf{M}=\left[M_{1}^{T},M_{2}^{T},\dots,M_{N}^{T}\right]^{\mathrm{T}}\in\mathbb{ R}^{(d\times N)\times 1}\) can be obtained according to the patch descriptor \(\mathbf{\rho}\). If \(\mathbf{\rho}_{i}>0.7,M_{i}=1\), otherwise \(M_{i}=0\). Hence, the recovered sample was modeled as:  
\[\mathbf{r}_{\mathrm{new}}=\mathbf{M}\odot\mathbf{r}+(1-M)\odot\mathbf{\mu} \tag{10}\]  
where \(\odot\) denotes elementwise multiplication, \(\mathbf{r}\) is the partially corruption sample, and \(\mathbf{r}_{\mathrm{new}}\) represents the recovered sample. The template update method is summarized in Algorithm 1. After the target templates update, we updated the dictionary \(\mathbf{D}\) and the dictionary base \(\mathbf{P}\) of each patch accordingly.