Template matching is a basic and crucial process for image processing. In this paper, a hybrid method of stochastic fractal search (SFS) and lateral inhibition (LI) is proposed to solve complicated template matching problems. The proposed template matching technique is called LI-SFS. SFS is a new metaheuristic algorithm inspired by random fractals. Furthermore, lateral inhibition mechanism has been verified to have good effects on image edge extraction and image enhancement. In this work, lateral inhibition is employed for image preprocessing. LI-SFS takes both the advantages of SFS and lateral inhibition which leads to better performance. Our simulation results show that LI-SFS is more effective and robust for this template matching mission than other algorithms based on LI.