In the area of image analysis of templates, we have proposed and implemented a method for locating landmarks in 2D-images of faces. The weights are selected in the optimal way to improve the discrimination of parts of the image which correspond to the template from those which do not.