Applied Intelligence

, Volume 41, Issue 3, pp 791–807 | Cite as

Template matching using an improved electromagnetism-like algorithm

  • Diego Oliva
  • Erik Cuevas
  • Gonzalo Pajares
  • Daniel Zaldivar


Template matching (TM) plays an important role in several image-processing applications such as feature tracking, object recognition, stereo matching, and remote sensing. The TM approach seeks for the best-possible resemblance between a subimage known as template and its coincident region within a source image. TM involves two critical aspects: similarity measurement and search strategy. The simplest available TM method aims for the best-possible coincidence between the images through an exhaustive computation of the normalized cross-correlation (NCC) values (similarity measurement) for all elements of the source image (search strategy). Recently, several TM algorithms that are based on evolutionary approaches have been proposed to reduce the number of NCC operations by calculating only a subset of search locations. In this paper, a new algorithm based on the electromagnetism-like algorithm (EMO) is proposed to reduce the number of search locations in the TM process. The algorithm uses an enhanced EMO version, which incorporates a modification of the local search procedure to accelerate the exploitation process. As a result, the new EMO algorithm can substantially reduce the number of fitness function evaluations while preserving the good search capabilities of the original EMO. In the proposed approach, particles represent search locations, which move throughout the positions of the source image. The NCC coefficient, considered as the fitness value (charge extent), evaluates the matching quality presented between the template image and the coincident region of the source image, for a determined search position (particle). The number of NCC evaluations is also reduced by considering a memory, which stores the NCC values previously visited to avoid the re-evaluation of the same search locations (particles). Guided by the fitness values (NCC coefficients), the set of candidate positions are evolved through EMO operators until the best-possible resemblance is determined. The conducted simulations show that the proposed method achieves the best balance over other TM algorithms in terms of estimation accuracy and computational cost.


Template matching Electromagnetism-like algorithm Evolutionary algorithms 



The first author acknowledges The National Council of Science and Technology of Mexico (CONACyT) for the doctoral Grant number 215517, The Ministry of Education (SEP) and the Mexican Government for partially support this research.


  1. 1.
    Ramík D M, Sabourin C, Moreno R, Madani K (2014) A machine learning based intelligent vision system for autonomous object detection and recognition. Appl Intell 40 (2): 358–375CrossRefGoogle Scholar
  2. 2.
    Julius Hossain M, Ali Akber Dewan M, Oksam Chae A (2012) Flexible edge matching technique for object detection in dynamic environment. Appl Intell 36 (3): 638–648CrossRefGoogle Scholar
  3. 3.
    Cuevas E, González M (2013) Multi-circle detection on images inspired by collective animal behaviour. Appl Intell 39 (1): 101–120CrossRefGoogle Scholar
  4. 4.
    Brunelli R (2009) Template Matching Techniques in Computer Vision, Theory Pract. WileyGoogle Scholar
  5. 5.
    Crispin A J, Rankov V (2007) Automated inspection of PCB components using a genetic algorithm template-matching approach. The Int J Adv Manuf Technol 35: 293–300CrossRefGoogle Scholar
  6. 6.
    Li J, Yan J, Guo C (2011) Research and implementation of image correlation matching based on evolutionary algorithm International conference future computer science and education (ICFCSE). Aug. 2011., vol 20–21, pp 499–501Google Scholar
  7. 7.
    Wang Y, Qi Y (2013) Memory-based cognitive modeling for robust object extraction and tracking. Appl Intell 39 (3): 614–629MathSciNetCrossRefGoogle Scholar
  8. 8.
    Matei O, Pop P C, Vălean H (2013) Optical character recognition in real environments using neural networks and k-nearest neighbor. Appl Intell 39 (4): 739–748CrossRefGoogle Scholar
  9. 9.
    Hadi G, Mojtaba L, Hadi SY (2009) An improved pattern matching technique for lossy/lossless compression of binary printed Farsi and Arabic textual images. Int J Intell Comput Cybernet 2 (1): 120–147CrossRefzbMATHGoogle Scholar
  10. 10.
    Krattenthaler W, Mayer K J, Zeiler M (1994) Point correlation: A reduced-cost template matching technique. In: Proceedings of the first IEEE International Conference on Image Processing, pp 208–212Google Scholar
  11. 11.
    Dong N, Wu C-H, Ip W-H, Chen Z-Q, Chan C-Y, Yung K-L (2011) An improved species based genetic algorithm and its application in multiple template matching for embroidered pattern inspection. Expert Syst Appl 38: 15172–15182CrossRefGoogle Scholar
  12. 12.
    Fang L, Haibin D, Yimin D (2012) A chaotic quantum-behaved particle swarm optimization based on lateral inhibition for image matching. Optik 123: 1955–1960CrossRefGoogle Scholar
  13. 13.
    Wu C-H, Wang D-Z, Ip A, Wang D-W, Chan C-Y, Wang H-F (2009) A particle swarm optimization approach for components placement inspection on printed circuit boards. J Intell Manuf 20: 535–549CrossRefGoogle Scholar
  14. 14.
    Haibin D, Chunfang X, Senqi L, Shan S (2010) Template matching using chaotic imperialist competitive algorithm. Pattern Recogn Lett 31: 1868–1875CrossRefGoogle Scholar
  15. 15.
    Birbil S I, Fang S C, Sheu R L (2004) On the convergence of a population-based global optimization algorithm. J Glob Optim 30 (2): 301–318MathSciNetCrossRefzbMATHGoogle Scholar
  16. 16.
    Rocha A, Fernandes E (2009) Hybridizing the electromagnetism-like algorithm with descent search for solving engineering design problems. Int J Comput Math 86: 1932–1946CrossRefzbMATHGoogle Scholar
  17. 17.
    Afonso L D, Mariani V C, Coelho L (2013) Modified imperialist competitive algorithm based on attraction and repulsion concepts for reliability-redundancy optimization. Expert Syst Appl 40 (9): 3794–3802CrossRefGoogle Scholar
  18. 18.
    Arani B O, Mirzabeygi P, Panahi M S (2013) An improved PSO algorithm with a territorial diversity-preserving scheme and enhanced exploration–exploitation balance. Swarm Evol Comput 11: 1–15CrossRefGoogle Scholar
  19. 19.
    Cuevas E, Echavarría A, Ramírez-Ortegón (2014) An optimization algorithm inspired by the States of Matter that improves the balance between exploration and exploitation. Appl Intell 40 (2): 256–272CrossRefGoogle Scholar
  20. 20.
    Ilker B., Birbil S., Shu-Cherng F. (2003) An electromagnetism-like mechanism for global optimization. J Glob Optim 25: 263–282CrossRefzbMATHGoogle Scholar
  21. 21.
    Rocha A, Fernandes E (2009) Modified movement force vector in an electromagnetism-like mechanism for global optimization. Optim Methods Softw 24: 253–270MathSciNetCrossRefzbMATHGoogle Scholar
  22. 22.
    Naderi B, Tavakkoli-Moghaddam R, Khalili M (2010) Electromagnetism-like mechanism and simulated annealing algorithms for flowshop scheduling problems minimizing the total weighted tardiness and makespan. Knowl -Based Syst 23: 77–85CrossRefGoogle Scholar
  23. 23.
    Hung H-L, Huang Y-F (2011) Peak to average power ratio reduction of multicarrier transmission systems using electromagnetism-like method. Int J Innov Comput Inf Control 7 (5A): 2037–2050Google Scholar
  24. 24.
    Yurtkuran A, Emel E (2010) A new hybrid electromagnetism-like algorithm for capacitated vehicle routing problems. Expert Syst Appl 37: 3427–3433CrossRefGoogle Scholar
  25. 25.
    Jhen-Yan J, Kun-Chou L (2009) Array pattern optimization using electromagnetism-like algorithm. AEU Int J Electron Commun 63: 491–496CrossRefGoogle Scholar
  26. 26.
    Wu P, Wen-Hung Y, Nai-Chieh W (2004) An electromagnetism algorithm of neural network analysis an application to textile retail operation. J Chin Inst Ind Eng 21: 59–67Google Scholar
  27. 27.
    Lee C H, Chang F K (2010) Fractional-order PID controller optimization via improved electromagnetism-like algorithm. Expert Syst Appl 37: 8871–8878CrossRefGoogle Scholar
  28. 28.
    Cuevas E, Oliva D, Zaldivar D, Pérez-Cisneros M, Sossa H (2012) Circle detection using electro-magnetism optimization. Inf Sci 182 (1): 40–55CrossRefGoogle Scholar
  29. 29.
    Guan X, Dai X, Li J (2011) Revised electromagnetism-like mechanism for flow path design of unidirectional AGV systems. Int J Prod Res 49 (2): 401–429CrossRefGoogle Scholar
  30. 30.
    Cuevas E (2013) Block-matching algorithm based on harmony search optimization for motion estimation. Appl Intell 39 (1): 165–183CrossRefGoogle Scholar
  31. 31.
    Cowan E W (1968) Basic Electromagnetism. Academic Press, New YorkGoogle Scholar
  32. 32.
    Lee C H, Chang F K (2010) Fractional-order PID controller optimization via improved electromagnetism-like algorithm. Expert Syst Appl 37: 8871–8878CrossRefGoogle Scholar
  33. 33.
    Chunjiang Z, Xinyu L, Liang G, Qing W (2013) An improved electromagnetism-like mechanism algorithm for constrained optimization. Expert Syst Appl 40 (14): 5621–5634CrossRefGoogle Scholar
  34. 34.
    Pedersen M E H (2010) Good parameters for particle swarm optimization. Technical report HL1001. Hvass LaboratoriesGoogle Scholar
  35. 35.
    Wilcoxon F (1945) Individual comparisons by ranking methods. Biometrics 1: 80–83CrossRefGoogle Scholar
  36. 36.
    Garcia S, Molina D, Lozano M (2008) Astudy on the use of non-parametric tests for analyzing the evolutionary algorithms’ behaviour: a case study on the CEC’2005 special session on real parameter optimization. J HeuristGoogle Scholar

Copyright information

© Springer Science+Business Media New York 2014

Authors and Affiliations

  • Diego Oliva
    • 1
  • Erik Cuevas
    • 2
    • 3
  • Gonzalo Pajares
    • 1
  • Daniel Zaldivar
    • 2
    • 3
  1. 1.Departamento Ingeniería del Software e Inteligencia ArtificialFacultad Informática, Universidad ComplutenseMadridSpain
  2. 2.Departamento de ElectrónicaUniversidad de GuadalajaraGuadalajaraMéxico
  3. 3.Unidad de Investigación Centro Universitario AztecaGuadalajaraMéxico

Personalised recommendations