ImageCooccurrence
✖
ImageCooccurrence
computes a co-occurrence matrix for arbitrary spatial relationships specified by a kernel ker.
Details and Options

- ImageCooccurrence[image,n] returns an n×n matrix m whose elements mij represent the probability of all occurrences of a pixel with intensity i to the left or bottom of a pixel with intensity j, assuming all pixels to lie in one of n successive bins.
- With ImageCooccurrence[image,n,ker], the co-occurrence matrix can be computed for arbitrary spatial relationships specified by a matrix ker.
- The default two-dimensional kernel used by ImageCooccurrence is
.
- ImageCooccurrence[{image1,image2},…] computes the co-occurrence matrix across two images. The images must have the same dimensions.
- ImageCooccurrence supports a Masking option. The default setting is Masking->All, constructing the co-occurrence matrix based on all of the image pixels.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Scope (4)Survey of the scope of standard use cases
Graylevel co-occurrence matrix, computed for a color image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-642qcz

Joint histogram of two color channels of the same image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-eb8gso

Specify a horizontally symmetric kernel:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-fh3v8u

Specify a diagonal kernel that matches the pattern of the image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-uwfhd

Options (1)Common values & functionality for each option
Applications (2)Sample problems that can be solved with this function
Define a function that computes the Haralick texture contrast measure:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-860u67
Contrast of a checkerboard image and a flat image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-32i90x

Haralick texture correlation measure for grayscale images:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-ntrsr3
Compute the horizontal correlation:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-1cehmx


https://wolfram.com/xid/0hyu2oefqhhzvwq8-sygydq

Properties & Relations (4)Properties of the function, and connections to other functions
Co-occurrence matrix of a random image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-9dsh14

The total of all elements of the co-occurrence matrix is 1:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-vja2oh

Co-occurrence matrix of a checkerboard image:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-57nkt7

Co-occurrence matrix of a striped image using a horizontal kernel:

https://wolfram.com/xid/0hyu2oefqhhzvwq8-kwujl3

Wolfram Research (2010), ImageCooccurrence, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCooccurrence.html.
Text
Wolfram Research (2010), ImageCooccurrence, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCooccurrence.html.
Wolfram Research (2010), ImageCooccurrence, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageCooccurrence.html.
CMS
Wolfram Language. 2010. "ImageCooccurrence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageCooccurrence.html.
Wolfram Language. 2010. "ImageCooccurrence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageCooccurrence.html.
APA
Wolfram Language. (2010). ImageCooccurrence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageCooccurrence.html
Wolfram Language. (2010). ImageCooccurrence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageCooccurrence.html
BibTeX
@misc{reference.wolfram_2025_imagecooccurrence, author="Wolfram Research", title="{ImageCooccurrence}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/ImageCooccurrence.html}", note=[Accessed: 26-April-2025
]}
BibLaTeX
@online{reference.wolfram_2025_imagecooccurrence, organization={Wolfram Research}, title={ImageCooccurrence}, year={2010}, url={https://reference.wolfram.com/language/ref/ImageCooccurrence.html}, note=[Accessed: 26-April-2025
]}