## Co-occurence theoretical background

Co-occurrence matrices can be used to describe the texture of a data set in a statistical fashion. A co-occurrence matrix can be seen as a generalized 2D histogram. In a 2D histogram of a two-channel image one axes represents the pixel values in the first channel; the other axis of the second channel. The bins in the 2D histogram each represent the amount a specific combination of values in the channels occurs in the image. The co-occurrence matrix takes this idea one step further: the second axis of the histogram is not limited to represent another channel, but for example can also be a neighbor pixel, or the pixel in the next time frame. If the cooccurrence matrix describes the relation between each pixel and its right neighbor, then in a smooth low contrast image the values of neighboring pixels tend to be similar. In the matrix

such combinations will be assigned to bins on the diagonal. If on the other hand the image is full of high contrast checkerboard like textures, most pixels will have a neighbor with an opposite value. The co-occurrence matrix will in this extreme case be empty along the diagonal and largely concentrated near the top-left and bottom right corners.

The content of the co-occurrence matrix can be described by a number of shape parameters. For a complete discussion see

*Digital Image Processing*(Gonzalez & Woods, 1992, Addison-Wesley, ISBN 0-201-50803-6, pp 508-510.), below we summarize their description of the co-occurrence matrix and its meaning.

### Difference moment

High when values are far from the diagonal, so in high contrast fine(high

spatial frequency) textures. It is defined as follows:

$$ \displaystyle\sum_i \sum_j c_{i, j}(i-j)^k $$

Here the c

_{i,j}are the matrix elements; i,j are the coordinates in the matrix. k is the order of the moment. With high values of k this coefficient becomes more sensitive to contributions far from the diagonal where i - j = 0.

### Inverse difference moment

High when the values are on the diagonal.

$$ \displaystyle\sum_{i \neq j} \sum_{j \neq i} \frac {c_{i, j}} {(i-j)^k} + \sum_i c_{i, i} $$

Similarly as in the previous case the value of k can be chosen to react more strongly on values near the diagonal.

### Entropy

Highest when the matrix is flat. It is not sensitive on the shape of the matrix, just the value of the individual elements.

$$ \, - \displaystyle\sum_i \sum_j c_{i, j} \log c_{i, j} $$

### Uniformity

Highest when the values are unequal. Like the entropy coefficient uniformity is

not sensitive to the spatial distribution in the matrix.

$$ \displaystyle\sum_i \sum_j c_{i, j}^2 $$

## Co-occurence in the Huygens Software

See the Tcl Huygens command

`cooccurence`

.