ArticleslgStudy

computer science

Co-occurrence matrix

Co-occurrence matrix is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Co-occurrence matrix rather than just read about it. In short: 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.

Key takeaways

  • Co-occurrence matrix belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Co-occurrence matrix to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Co-occurrence matrix from memory before moving on to harder problems.

Reference excerpt

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.

Method Given a grey-level image I, co-occurrence matrix computes how often pairs of pixels with a specific value and offset occur in the image.

The offset, (Δx,Δy), is a position operator that can be applied to any pixel in the image (ignoring edge effects): for instance, (1,2) could indicate "one down, two right". An image with p different pixel values will produce a p×p co-occurrence matrix, for the given offset. The (i,j)th value of the co-occurrence matrix gives the number of times in the image that the ith and jth pixel values occur in the relation given by the offset. For an image with p different pixel values, the p×p co-occurrence matrix C is defined over an n×m image I, parameterized by an offset (Δx,Δy), as:

CΔx,Δy(i,j)=∑x=1n∑y=1m{1,if I(x,y)=i and I(x+Δx,y+Δy)=j0,otherwise where: i and j are the pixel values; x and y are the spatial positions in the image I; the offsets (Δx,Δy) define the spatial relation for which this matrix is calculated; and I(x,y) indicates the pixel value at pixel (x,y). 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, d, and an angle, θ, instead of an offset (Δx,Δy). 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. 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).

See also Gray level size zone matrix

References

External links A Grey Level Co-occurrence Matrix tutorial ImageCooccurrence function in Mathematica MATLAB doc for in-build function for co-occurrence matrix calculation Package for GLCM calculation in R

Worked examples

Example 1 — a first encounter with Co-occurrence matrix

Start with the simplest possible case. Write down what Co-occurrence matrix claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Co-occurrence matrix before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Co-occurrence matrix ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Co-occurrence matrix

In research
Co-occurrence matrix appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Co-occurrence matrix in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Co-occurrence matrix is common in secondary-school and first-year university syllabi. It links to neighbouring topics Feature detection (computer vision), Image processing, so understanding it makes those chapters shorter.
In everyday life
Look for Co-occurrence matrix outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Co-occurrence matrix” →

How to study Co-occurrence matrix in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Co-occurrence matrix means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Co-occurrence matrix out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Co-occurrence matrix in simple terms?

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 an…

Why does Co-occurrence matrix matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Co-occurrence matrix?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Co-occurrence matrix.

Tags

  • Feature detection (computer vision)
  • Image processing

Keep exploring