haralickMatrix {EBImage} | R Documentation |
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.
haralickFeatures(x, ref, nc = 32) haralickMatrix(x, ref, nc = 32)
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. |
haralickFeatures
computes the following set of statistics on
the GLCM matrix:
h.asm
sum[i=1^nc] sum[j=1^nc]p(i,j)^2
.h.con
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
sum[i=1^nc]
sum[j=1^nc]((i * j) * p(i,j) - mu_x * mu_y) / sigma_x * sigma_y
.h.var
sum[i=1^nc] sum[j=1^nc](i - mu)^2.
* p(i,j)
.h.idm
sum[i=1^nc]
sum[j=1^nc] p(i,j) / (1 + (i - j)^2)
.h.sav
sum[i=2^(2*nc)] i * Px+y(i)
.h.sva
sum[i=2^(2*nc)] (i - sen)^2 * Px+y(i)
.h.sen
-sum[i=2^(2*nc)] Px+y(i) * log(p(i,j))
.h.ent
-sum[i=1^nc] sum[j=1^nc] p(i,j) *
log( p(i,j) )
.h.dva
sum[i=0^(nc-1)] (i^2) * Px-y(i)
.h.den
sum[i=0^(nc-1)] Px-y(i)
* log( Px-y(i,j) )
.h.f12
abs(ent - HXY1) / HX
.h.f13
sqrt( 1 - exp(2*(ent - HXY2)))
.where:
p
Px(i)
Px(i) = sum[j=1^nc] p(i,j)
.Py(j)
Py(j) = sum[i=1^nc] p(i,j)
.mu_x, mu_y
Px
and Px
.sigma_x, sigma_y
Px
and Py
.Px+y
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
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.
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.
Mike Smith, msmith@ebi.ac.uk; Oleg Sklyar, osklyar@ebi.ac.uk, 2007
R. M. Haralick, K Shanmugam and Its'Hak Deinstein (1979). Textural Features for Image Classification. IEEE Transactions on Systems, Man and Cybernetics.
example(getFeatures)