A general statistical approach is presented for the identification of objects in digital images, motivated by an application in aquaculture involving underwater images of fish. Using Procrustes analysis, a point distribution model is fitted on a set of training images and used as a prior distribution for the shape of a deformable template. The likelihood of a proposed template is calculated in terms of the response from a feature detector along the boundary of the template. The posterior distribution of template variables is examined by using Markov chain Monte Carlo analysis. A key challenge in the aquaculture application is the variable nature of edges arising from the surface curvature of fish and the low contrast between the foreground and background. Conventional gradient-based edge detection proves inadequate, but a parallel pattern detector copes much better. Results are presented for a fully automated analysis of the database. The strengths and weaknesses of this approach are discussed and future developments are outlined.