This paper is concerned with the use of template masks for locating ob
jects and their features in digital images. In an ideal case suitable
masks would take the form of spatial matched filters for the chosen ob
ject or feature profile. However, in practical situations, not only wi
ll noise be present but also the signals themselves may vary. This pap
er analyses the situation and formulates a procedure for generating su
itable masks in such cases. The overall filter can be construed as a s
pecial type of spatial matched filter with integral noise-whitening. T
he method is applied to edge, corner and hole detection, and tradeoff
formulae are derived connecting accuracy, sensitivity and computationa
l load, with number of masks as the single free parameter.