  Anomaly detection in random fields is an important problem in many
applications including the detection of cancerous cells in medicine, obstacles
in autonomous driving and cracks in the construction material of buildings.
Such anomalies are often visible as areas with different expected values
compared to the background noise. Scan statistics based on local means have the
potential to detect such local anomalies by enhancing relevant features. We
derive limit theorems for a general class of such statistics over M-dependent
random fields of arbitrary but fixed dimension. By allowing for a variety of
combinations and contrasts of sample means over differently-shaped local
windows, this yields a flexible class of scan statistics that can be tailored
to the particular application of interest. The latter is demonstrated for crack
detection in 2D-images of different types of concrete. Together with a
simulation study this indicates the potential of the proposed methodology for
the detection of anomalies in a variety of situations.
