Learning algorithms can only perform well when the model is trained using sufficient number of training examples with respect to the complexity of the model. To obtain good generalization performance with a limited training data set, it is essential that prior knowledge of the problem is included in the representation of the objects or in the model of the data. Here we will consider image data and we propose to explicitly include the spatial connectivity of pixels in image data into the (estimated) covariance matrix of the data. This spatial regularization biases the model to solutions where remote pixels are uncorrelated. This adjusted covariance matrix can then be used in a supervised classification setting, or in unsupervised clustering or PCA. Examples for classification and feature extraction on image data are given.