## 2 The Orientation Compressed Map
### Similarity Measure and Possible Object Locations  
In order to improve the matching speed, the gradient orientations are encoded and compressed. Naturally, both the template and the input image are implemented by the same operation, which can generate the binarized orientation compressing map respectively. The similarity measure based on the orientation compressing map is designed to fulfill the requirements of robustness to deformation and occlusion. The orientation compressing map of the template (CMT) can be compared with the orientation compressing map of the input image (CMI) pixel by pixel according to the bitwise AND operation:  
\[\delta^{\mathrm{C}}_{l+k,k}(\mathcal{I},\mathcal{T},r^{\mathrm{c}})=\mathrm{ POPCNT}(\mathrm{ori}^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})\&\mathrm{ori}^{ \mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})), \tag{4}\]  
where \(\mathrm{ori}^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})\) is the compressed orientation at location \(k\) in the CMT and \(\mathrm{ori}^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})\) is the compressed orientation at location \(k\) shifted by \(l\) in the CMI. POPCNT is returning the number of bits set to 1 and \(\delta^{\mathrm{C}}_{l+k,k}(\mathcal{I},\mathcal{T},r^{\mathrm{c}})\) counts the number of matched quantized orientations between \(\mathrm{ori}^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})\) and \(\mathrm{ori}^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})\). As shown in Figure 3a,b, the CMT in Figure 3a is compared with the shadow region of the CMI by Equation (4) and the matched quantized orientations are represented by the arrows with blue and hollow in the Figure 3b. Figure 2: An example to explain the process of producing the binarized orientation compressing map. (**a**) The model image; (**b**) Original quantized gradient orientations in the red box of model edge map; (**c**) The quantized orientation compressing map of Figure 2b; (**d**) The edge map of the model; (**e**) The orientation compressing map of the template image. Given that parts of the model are occlusive in the input image, the similarity score is calculated for each pixel between the CMI and the CMT, which can be formalized as:  
\[S^{\mathrm{C}}_{l+k,k}(\mathcal{I},\mathcal{T},r^{\mathrm{c}})=\frac{\delta^{ \mathrm{C}}_{l+k,k}(\mathcal{I},\mathcal{T},r^{\mathrm{c}})}{\kappa_{l+k,k}}, \tag{5}\]  
where \(\kappa_{l+k,k}\) usually indicates the number of quantized orientations at location \(k\) in the CMT. There are many different quantized orientations if the CMT matches a cluttered region in the CMI. To improve the robustness of clutter, \(\kappa_{l+k,k}\) needs to be adjusted according to the number of quantized orientations at location \(k\) shifted by \(l\) in the CMI as follows:  
\[\kappa_{l+k,k}=\left\{ \begin{array}{ll}\delta^{\mathrm{C}}_{k}(\mathcal{T}, r^{\mathrm{c}})&\mathrm{if}(\delta^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}}) \ \geq\delta^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}}))\\ \min(\delta^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}}),\lambda\cdot\delta^ {\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}}))&\mathrm{otherwise}\end{array}  \right., \tag{6}\]  
where  
\[\delta^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})=\mathrm{POCNT}(\mathrm{ ori}^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})), \tag{7}\]  
and  
\[\delta^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})=\mathrm{POCNT}(\mathrm{ ori}^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})), \tag{8}\]  
\(\delta^{\mathrm{C}}_{k}(\mathcal{T},r^{\mathrm{c}})\) is the number of quantized orientations at location \(k\) in the CMT. Similarly, \(\delta^{\mathrm{C}}_{l+k}(\mathcal{I},r^{\mathrm{c}})\) returns the number of quantized orientations at location \(k\) shifted by \(l\) in the CMI. According to the experimental results, \(\lambda\) is set to 3.