haralickMatrix {EBImage} | R Documentation

## Co-occurrence matrices (GLCM) and Haralick texture features

### Description

Computes the gray level co-occurrence matrix (GLCM, frequency of pixel intensities given the mean intensity of their 4 neighbouring pixels) and corresponding Haralick features from image objects.

### Usage

      haralickFeatures(x, ref, nc = 32)
      haralickMatrix(x, ref, nc = 32)

### Arguments

`x` | An `Image` object or an array containing object masks. Object masks are sets of pixels with the same unique integer value.
`ref` | An `Image` object or an array, containing the intensity values of the objects.
`nc` | A numeric value. Specifies the number of gray levels used to compute the co-occurrence matrix. Default value is 32.

### Details

`haralickFeatures` computes the following set of statistics on the GLCM matrix:

`h.asm`
  Angular second moment: `sum[i=1^nc] sum[j=1^nc]p(i,j)^2`.
`h.con`
  Contrast: `sum[i=2^(2*nc)] n^2 * sum[i=1^nc] sum[j=1^nc] p(i,j), for all i,j s.t ABS(i - j) = n`.
`h.cor`
  Correlation: `sum[i=1^nc] sum[j=1^nc]((i * j) * p(i,j) - mu_x * mu_y) / sigma_x * sigma_y`.
`h.var`
  Variance: `sum[i=1^nc] sum[j=1^nc](i - mu)^2. * p(i,j)`.
`h.idm`
  Inverse difference moment: `sum[i=1^nc] sum[j=1^nc] p(i,j) / (1 + (i - j)^2)` .
`h.sav`
  Sum average: `sum[i=2^(2*nc)] i * Px+y(i)`.
`h.sva`
  Sum variance: `sum[i=2^(2*nc)] (i - sen)^2 * Px+y(i)`.
`h.sen`
  Sum entropy: `-sum[i=2^(2*nc)] Px+y(i) * log(p(i,j))`.
`h.ent`
  Entropy: `-sum[i=1^nc] sum[j=1^nc] p(i,j) * log( p(i,j) )`.
`h.dva`
  Difference variance: `sum[i=0^(nc-1)] (i^2) * Px-y(i)`.
`h.den`
  Difference entropy: `sum[i=0^(nc-1)] Px-y(i) * log( Px-y(i,j) )`.
`h.f12`
  Measure of correlation: `abs(ent - HXY1) / HX`.
`h.f13`
  Measure of correlation: `sqrt( 1 - exp(2*(ent - HXY2)))`.

where:

`p`
  is the GLCM matrix.
`Px(i)`
  Marginal frequency. Defined by `Px(i) = sum[j=1^nc] p(i,j)`.
`Py(j)`
  Marginal frequency. Defined by `Py(j) = sum[i=1^nc] p(i,j)`.
`mu_x, mu_y`
  Means of `Px` and `Px`.
`sigma_x, sigma_y`
  Standard deviations of `Px` and `Py`.
`Px+y`
  Probability of the co-occurrence matrix coordinates sums to `x+y`. Defined by `Px+y(k) = sum[i=1^nc] sum[j=1^nc] p(i,j), i + j = k and k = 2,3,...,2*nc`.
`Px-y`
  Probability of the absolute value of the difference between co-occurrence matrix cooordinates being equal to `x-y`. Defined by `Px-y(k) = sum[i=1^nc] sum[j=1^nc] p(i,j), abs(i - j) = k and k = 2,3,...,2*nc`.
`HXY1`
  `-sum[i=1^nc] sum[j=1^nc] p(i,j) * log( Px(i),Py(j))`.
`HXY2`
  `-sum[i=1^nc] sum[j=1^nc] Px(i)*Py(j) * log( Px(i),Py(j))`.

Computed Haralick features are rotational invariant and good descriptors of object textures.

### Value

`haralickFeatures` returns a matrix (or a list of matrices if `x` contains multiple frames) of features computed of the objects present in `x` and using the intensity values of `ref`.
`haralickMatrix` returns an array (or a list of arrays if `x` contains multiple frames) of dimension `nc*nc*nobj`, where `nobj` is the number of objects in `x`, containing the GLCM values of image objects.

### Author(s)

Mike Smith, msmith@ebi.ac.uk; Oleg Sklyar, osklyar@ebi.ac.uk, 2007

### References

R. M. Haralick, K Shanmugam and Its'Hak Deinstein (1979). Textural Features for Image Classification. IEEE Transactions on Systems, Man and Cybernetics.

### See Also

`getFeatures`, `zernikeMoments`

### Examples

      example(getFeatures)

[Package EBImage version 3.0.5 Index]