## 2 Theory
### The Mean Shift Algorithm
\begin{array}{ll}\hat{\
abla}f_{h,K}(x)=\
abla\hat{f}_{h,K}(x)&=\frac{2c_{ k,d}}{nh^{d+2}}\sum_{i=1}^{n}(x-x_{i})k^{\prime}\bigg{(}\Big{|}\Big{|}\frac{x-x_{i}}{h} \Big{|}\Big{|}^{2}\bigg{)}\\ &=\frac{2c_{k,d}}{nh^{d+2}}\sum_{i=1}^{n}\xi\bigg{(}\Big{|}\Big{|}\Big{|} \frac{x-x_{i}}{h}\Big{|}\Big{|}^{2}\bigg{)}\bigg{(}\frac{\sum_{i=1}^{n}x_{i} \big{(}\big{|}\frac{x-x_{i}}{h}\big{|}\big{|}\big{)}^{2}}{\sum_{i=1}^{n}\xi \big{(}\big{|}\Big{|}\Big{|}^{x-x_{i}}\big{|}\big{|}\big{)}^{2}}-x\bigg{)}\\ &=f_{h,G}(x)m_{h,G}(x)\end{array}  \tag{14}\]  
in which \(f_{h,G}(x)\) is the non-parametric density estimation function based on kernel G(x) at point x, and \(m_{h,G}(x)\) is a mean shift vector. Besides, \(g(x)=-k^{\prime}(x)\) is the profile function of kernel G(x). In general, the shorter the distance of the sample point to the central point, the more significant the statistical property of the estimated point x becomes. Thus, the concept of kernel density function is introduced, giving each sample point a different weight associating with their distance to the center point. Also, the mean shift procedure is guaranteed to make the kernel function converge at a nearby point where the estimate density gradient is zero. Epanechikov kernel function is used for model description. In initial frame, supposing that there are n pixels \(\{x_{i}\}_{i=1,\ldots n}\) in the target region, and the center point is \(x_{0}\). If the bandwidth of the kernel function is h, and we uniformly divide the feature space into m subintervals, the probability density estimation of the eigenvalue of the target model u = 1, \(\ldots\).m is  
\[\hat{P}_{u}(y)=C\sum_{i=1}^{n}k\bigg{(}\Big{|}\Big{|}\frac{x_{0}-x_{i}}{h} \Big{|}\Big{|}^{2}\bigg{)}\delta(b(x_{i})-u) \tag{15}\]  
Because of the excellent fitness between Bhattacharyya coefficient and the mean shift algorithm, the Bhattacharyya coefficient is selected to measure the similarity between target model and candidate model in our proposed algorithm. The eigenvalue of each model in the feature space is divided into m parts. If public members of two models in a part can be found when the Bhattacharyya coefficient is being computed in each part, the value of Bhattacharyya coefficient grows. The value of m depends on the range of eigenvalue in the feature space. The accuracy of the Bhattacharyya coefficient will be influenced whether m is too large or too small. Here is the definition of Bhattacharyya coefficient:  
\[\rho(y)=\rho(\hat{p}(y),\hat{q})=\sum_{u=1}^{m}\sqrt{\hat{p}_{u}(y)\hat{q}_{u}} \tag{17}\]  
where \(\rho(y)\in[0,1]\), whose value represents the similarity between the two models. The candidate region that make the maximum value of \(\rho(y)\) is believed to be the position of the target. The value of Bhattacharyya coefficient \(\rho(y)\) should be maximized if we want to get the most accurate position of the target. Normally, the center point \(y_{0}\) of the target in last frame is treated as the initial position of the target in current frame, where the algorithm begins searching for the goal of optimal matching, whose center point is y. Firstly, calculate the probability density estimation \(\hat{p}_{u}(y_{0})\) of the candidate target at point \(y_{0}\) in the current frame, the current Bhattacharyya coefficient satisfying:  
\[\rho(y_{0})=\sum_{u=1}^{m}\sqrt{\hat{p}_{u}(y_{0})\hat{q}_{u}} \tag{18}\]  
whose Taylor expansion is computed by:  
\[\rho(y_{0})=\sum_{u=1}^{m}\sqrt{\hat{p}_{u}(y_{0})\hat{q}_{u}}=\frac{1}{2} \sum_{u=1}^{m}\sqrt{\hat{p}_{u}(y_{0})\hat{q}_{u}}+\frac{C_{h}}{2}\sum_{i=1}^ {n_{k}}w_{i}k\left(\left|\left|\frac{y-x_{i}}{h}\right|\right|^{2}\right) \tag{19}\]  
in which \(w_{i}\) is the weight of each pixel, whose definition is:  
\[w_{i}=\sum_{u=1}^{m}\sqrt{\frac{\hat{q}_{u}}{\hat{p}_{u}(y_{0})}}\delta(b(x_{ i}-u)) \tag{20}\]  
It is easy to notice that only the second term of Equation (19) is associated with y. If it gets the maximum value, the value of Bhattacharyya coefficient is maximized too.