Efficient Sliding Window Computation for NN-Based Template Matching
Template matching is a fundamental problem in computer vision, with many applications. Existing methods use sliding window computation for choosing an image-window that best matches the template. For classic algorithms based on SSD, SAD and normalized cross-correlation, efficient algorithms have been developed allowing them to run in real-time. Current state of the art algorithms are based on nearest neighbor (NN) matching of small patches within the template to patches in the image. These algorithms yield state-of-the-art results since they can deal better with changes in appearance, viewpoint, illumination, non-rigid transformations, and occlusion. However, NN-based algorithms are relatively slow not only due to NN computation for each image patch, but also since their sliding window computation is inefficient. We therefore propose in this paper an efficient NN-based algorithm. Its accuracy is similar (in some cases slightly better) than the existing algorithms and its running time is 43–200 times faster depending on the sizes of the images and templates used. The main contribution of our method is an algorithm for incrementally computing the score of each image window based on the score computed for the previous window. This is in contrast to computing the score for each image window independently, as in previous NN-based methods. The complexity of our method is therefore O(|I|) instead of O(|I||T|), where I and T are the image and the template respectively.
This work was partially supported by the Israel Science Foundation, grant no. 930/12, and by the Israeli Innovation Authority in the Ministry of Economy and Industry.
- 2.Bradski, G.: The OpenCV Library. Dr. Dobb’s Journal of Software Tools (2000)Google Scholar
- 5.Korman, S., Reichman, D., Tsur, G., Avidan, S.: Fast-match: fast affine template matching. In: Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, pp. 2331–2338 (2013)Google Scholar
- 6.Mercier, J.P., Trottier, L., Giguere, P., Chaib-draa, B.: Deep object ranking for template matching. In: IEEE Winter Conference on Applications of Computer Vision (WACV), pp. 734–742 (2017)Google Scholar
- 7.Moudgil, A., Gandhi, V.: Long-term visual object tracking benchmark. arXiv preprint arXiv:1712.01358 (2017)
- 9.Oron, S., Dekel, T., Xue, T., Freeman, W.T., Avidan, S.: Best-buddies similarity-robust template matching using mutual nearest neighbors. IEEE Trans. Pattern Anal. Mach. Intell. (2017)Google Scholar
- 11.Penate-Sanchez, A., Porzi, L., Moreno-Noguer, F.: Matchability prediction for full-search template matching algorithms. In: International Conference on 3D Vision (3DV), pp. 353–361 (2015)Google Scholar
- 12.Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014)
- 13.Talmi, I., Mechrez, R., Zelnik-Manor, L.: Template matching with deformable diversity similarity. In: Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (2017)Google Scholar
- 15.Wei, Y., Tao, L.: Efficient histogram-based sliding window. In: Proceedings of IEEE Confernece on Computer Vision Pattern Recognition, pp. 3003–3010 (2010)Google Scholar
- 16.Wu, Y., Lim, J., Yang, M.H.: Online object tracking: a benchmark. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2411–2418 (2013)Google Scholar
- 17.Zagoruyko, S., Komodakis, N.: Learning to compare image patches via convolutional neural networks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4353–4361 (2015)Google Scholar
- 19.Zhang, C., Akashi, T.: Fast affine template matching over Galois field. In: British Machine Vision Conference (BMVC), pp. 121.1–121.11 (2015)Google Scholar