Using Bayes rule, the posteriori probability density of the deformed template given the input image is:
where is the normalization factor assuring the sum of all probabilities is equal to . Using Eqs and , the posterior results in:
As the objective is to maximize this probability, we seek to minimize the following objective function with respect to s, , d:
As in the work of Jain et al. [80], this function consists of two terms: a first term that measures the deviation of the deformed template from the prototype, and a second one which describes the fitness of the deformed template to the boundaries of the image.