Co-occurrence matrix

From HandWiki

A co-occurrence matrix or co-occurrence distribution (also referred to as : gray-level co-occurrence matrices GLCMs) is a matrix that is defined over an image to be the distribution of co-occurring pixel values (grayscale values, or colors) at a given offset. It is used as an approach to texture analysis with various applications especially in medical image analysis.[1][2]

Method

Given a grey-level image [math]\displaystyle{ I }[/math], co-occurrence matrix computes how often pairs of pixels with a specific value and offset occur in the image.

  • The offset, [math]\displaystyle{ (\Delta x, \Delta y) }[/math], is a position operator that can be applied to any pixel in the image (ignoring edge effects): for instance, [math]\displaystyle{ (1, 2) }[/math] could indicate "one down, two right".
  • An image with [math]\displaystyle{ p }[/math] different pixel values will produce a [math]\displaystyle{ p \times p }[/math] co-occurrence matrix, for the given offset.
  • The [math]\displaystyle{ (i, j)^\text{th} }[/math] value of the co-occurrence matrix gives the number of times in the image that the [math]\displaystyle{ i^\text{th} }[/math] and [math]\displaystyle{ j^\text{th} }[/math] pixel values occur in the relation given by the offset.

For an image with [math]\displaystyle{ p }[/math] different pixel values, the [math]\displaystyle{ p \times p }[/math] co-occurrence matrix C is defined over an [math]\displaystyle{ n \times m }[/math] image [math]\displaystyle{ I }[/math], parameterized by an offset [math]\displaystyle{ (\Delta x, \Delta y) }[/math], as:

[math]\displaystyle{ C_{\Delta x, \Delta y}(i,j)=\sum_{x=1}^n\sum_{y=1}^m\begin{cases} 1, & \text{if }I(x, y)=i\text{ and }I(x+\Delta x, y+\Delta y)=j \\ 0, & \text{otherwise}\end{cases} }[/math]

where: [math]\displaystyle{ i }[/math] and [math]\displaystyle{ j }[/math] are the pixel values; [math]\displaystyle{ x }[/math] and [math]\displaystyle{ y }[/math] are the spatial positions in the image I; the offsets [math]\displaystyle{ (\Delta x, \Delta y) }[/math] define the spatial relation for which this matrix is calculated; and [math]\displaystyle{ I(x, y) }[/math] indicates the pixel value at pixel [math]\displaystyle{ (x, y) }[/math].

The 'value' of the image originally referred to the grayscale value of the specified pixel, but could be anything, from a binary on/off value to 32-bit color and beyond. (Note that 32-bit color will yield a 232 × 232 co-occurrence matrix!)

Co-occurrence matrices can also be parameterized in terms of a distance, [math]\displaystyle{ d }[/math], and an angle, [math]\displaystyle{ \theta }[/math], instead of an offset [math]\displaystyle{ (\Delta x, \Delta y) }[/math].

Any matrix or pair of matrices can be used to generate a co-occurrence matrix, though their most common application has been in measuring texture in images, so the typical definition, as above, assumes that the matrix is an image.

It is also possible to define the matrix across two different images. Such a matrix can then be used for color mapping.

Aliases

Co-occurrence matrices are also referred to as:

  • GLCMs (gray-level co-occurrence matrices)
  • GLCHs (gray-level co-occurrence histograms)
  • spatial dependence matrices

Application to image analysis

Whether considering the intensity or grayscale values of the image or various dimensions of color, the co-occurrence matrix can measure the texture of the image. Because co-occurrence matrices are typically large and sparse, various metrics of the matrix are often taken to get a more useful set of features. Features generated using this technique are usually called Haralick features, after Robert Haralick.[3]

Texture analysis is often concerned with detecting aspects of an image that are rotationally invariant. To approximate this, the co-occurrence matrices corresponding to the same relation, but rotated at various regular angles (e.g. 0, 45, 90, and 135 degrees), are often calculated and summed.

Texture measures like the co-occurrence matrix, wavelet transforms, and model fitting have found application in medical image analysis in particular.

Other applications

Co-occurrence matrices are also used for words processing in natural language processing (NLP).[4][5]

See also

References

  1. "Texture Analysis Using the Gray-Level Co-Occurrence Matrix (GLCM) - MATLAB & Simulink - MathWorks United Kingdom". https://uk.mathworks.com/help/images/texture-analysis-using-the-gray-level-co-occurrence-matrix-glcm.html. 
  2. Nanni, Loris; Brahnam, Sheryl; Ghidoni, Stefano; Menegatti, Emanuele; Barrier, Tonya (2013-12-26). "Different Approaches for Extracting Information from the Co-Occurrence Matrix". PLOS ONE 8 (12): e83554. doi:10.1371/journal.pone.0083554. ISSN 1932-6203. PMID 24386228. Bibcode2013PLoSO...883554N. 
  3. Robert M Haralick; K Shanmugam; Its'hak Dinstein (1973). "Textural Features for Image Classification". IEEE Transactions on Systems, Man, and Cybernetics SMC-3 (6): 610–621. doi:10.1109/TSMC.1973.4309314. http://haralick.org/journals/TexturalFeatures.pdf. 
  4. [Francois Chaubard, Rohit Mundra, Richard Socher. CS 224D: Deep Learning for NLP. Lecture Notes. Spring 2016.
  5. Bryan Bischof. Higher order co-occurrence tensors for hypergraphs via face-splitting. Published 15 February 2020, Mathematics, Computer Science, ArXiv

External links