# Parallelization of the Honeybee Search Algorithm for Object Tracking
## 2 Materials And Methods
### Normalized Cross-Correlation  
As discussed in Section 1, the Normalized Cross-Correlation (NCC) is one of the less complicated approaches to object tracking, but is top tier compared to other trackers which used the ALOV video dataset for performance evaluation [3]. We use NCC as fitness function for HSA and describe the adaptations in further sections. NCC is used to measure the correlation between two image templates, i.e., NCC quantifies how similar these image templates are [33; 34; 35]. The grade of similarity is a scalar number, the greater it is, the more correlated these images are. Usually, the aim of using NCC is to find the point \((u,v)\) where certain template \(t\) is located within a certain image frame \(I\) (illustrated in Figure 1). In order to find the optimal \((u,v)\), every suitable point \((u,v)\) in \(I\) must be checked using NCC. The range of possible values for \((u,v)\) is limited by the dimensions \(w\times h\) of \(I\) as well as the dimensions \(m\times n\) of \(t\). The range of \(u\) extends from \(0\) to \(w-m\) while the range of \(v\) goes from \(0\) to \(h-n\). The formula used to compute NCC for any given \((u,v)\) is based on the squared Euclidean distance. Equation (8) shows how the squared Euclidean distance \(d^{2}_{I,t}(u,v)\) is obtained. The term \(I(x,y)\) refers to the value used to describe the gray level of pixel located at point \((x,y)\) within frame \(I\). Similarly, \(t(x-u,y-v)\) is the value of gray assigned to the pixel \((x-u,y-v)\) of template \(t\). Note \((x,y)\) is any point contained by the rectangular window that has point \((u,v)\) as the top left corner and \((u+m,v+n)\) as bottom right corner, meaning \(u\leq x\leq u+m\) and \(v\leq y\leq v+n\). Such inequalities ensure the top left corner of template \(t\) will always be \((0,0)\) while the bottom right corner will always be \((m,n)\). \[d^{2}_{I,t}(u,v)=\sum_{x,y}\left[I(x,y)-t(x-u,y-v)\right]^{2} \tag{8}\]  
\[d^{2}_{I,t}(u,v)=\sum_{x,y}I^{2}(x,y)-2I(x,y)t(x-u,y-v)+t^{2}(x-u,y-v) \tag{9}\]  
The expression used to obtain \(d^{2}_{I,t}(u,v)\) may be expanded, as in Equation (9). This manipulation reveals that the result depends on three terms. The term \(\sum_{x,y}t^{2}(x-u,y-v)\), which remains constant,  
Figure 1: Template \(t\) can be contained in frame \(I\) in a rectangle of size \(m\times n\) which has point \((u,v)\) as top left corner. is ignored since it does not change for two different points \((u,v)\). On the other hand, the term \(\sum_{x,y}l^{2}(x,y)\) does change for different values \((u,v)\), but this change reflects the fact that the selected point is different rather than measuring the similarity between pixels \(l(x,y)\) and \(t(x-u,y-v)\). Only the term \(\sum_{x,y}l(x,y)t(x-u,y-v)\) is useful to get the cross-correlation \(c(u,v)\) (Equation (10)) and thus it is established as a starting point for NCC. \[c(u,v)=\sum_{x,y}l(x,y)t(x-u,y-v) \tag{10}\]  
NCC presents an improvement over \(c(u,v)\), since it provides resistance to changes across the frames of a video sequence. For example, a difference in the illumination of the targeted object that occurs between frames of the video. Another common problem that occurs when using \(c(u,v)\) is that bright spots in the image or template can cause confusion by provoking greater correlation values than actual features of the targeted object. In order to give NCC a greater resistance to the mentioned errors, the formula for \(c(u,v)\) is altered by normalizing the image and feature vectors to the unit length (see Equation (11)). The mean of all the pixels \((x,y)\) in the region were \(u\leq x\leq u+m\) and \(v\leq y\leq v+n\) is denoted as \(\bar{I}_{u,v}\) and found using Equation (12). The term \(\bar{t}\) is the mean of the pixels contained in \(t\) and requires Equation (13) to be evaluated.