haralickMatrix            package:EBImage            R Documentation

_C_o-_o_c_c_u_r_r_e_n_c_e _m_a_t_r_i_c_e_s (_G_L_C_M) _a_n_d _H_a_r_a_l_i_c_k _t_e_x_t_u_r_e _f_e_a_t_u_r_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     A set of functions to compute the co-occurrence matrix (GLCM -
     gray level  co-occurrence matrix) and haralick texture features of
     objects in an indexed image.

_U_s_a_g_e:

       ## S4 method for signature 'IndexedImage, Image':
       haralickMatrix(x, ref, nc = 32, ...)
       ## S4 method for signature 'IndexedImage, Image':
       haralickFeatures(x, ref, nc = 32, ...)

_A_r_g_u_m_e_n_t_s:

       x: An object of 'IndexedImage' used as a mask.

     ref: A 'Grayscale' object of 'Image-class'. The texture is
          calculated from the data in this image.

      nc: A numeric value. Specifies the number of gray levels to
          separate 'ref' into when calculating the co-occurrence
          matrix. Defaults to 32

     ...: Reserved. 

_D_e_t_a_i_l_s:

     'haralickMatrix' computes a co-occurrence matrix of dimension 'nc
     * nc'  for each object in an image.  The co-occurrence matrix is
     constructed by assigning to element '[i,j]' the number of times a
     pixel of value 'i' is adjacent to a pixel of value 'j'.

     In order to achieve rotational invariance the co-occurrence matrix
     is computed using four passes through each object.  Thus each
     pixel is compared to four neighbours: right, below, diagonally
     down left and diagonally down right.  In order to achieve symmetry
     in the co-occurrence matrix the reciprocal of each of these scores
     is also added.  Thus for each pixel we have have a score for
     comparison with each of the surrounding pixels.

     Finally the entire matrix is divided by the total number of
     comparisons, giving a probability for each of the possible
     combinations.

     'haralickFeatures' computes for each object in an image 12
     Haralick  texture features, calculated from the co-occurrence
     matrix. The feature names  carry a 't.' prefix (t for texture).
     The features and their calculations are:

     '_a_s_m' Angular second moment: 'sum[_i=1^nc] sum[_j=1^nc]p(i,j)^2'.

     '_c_o_n' 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'.

     '_c_o_r' Correlation of GLCM: 'sum[_i=1^nc] sum[_j=1^nc]((i * j) *
          p(i,j) - mu_x * mu_y) / sigma_x * sigma_y'.

     '_v_a_r' Variance: 'sum[_i=1^nc] sum[_j=1^nc](i - mu)^2. * p(i,j)'.

     '_i_d_m' Inverse difference moment: 'sum[_i=1^nc] sum[_j=1^nc] p(i,j)
          / (1 + (i - j)^2) '.

     '_s_a_v' Sum average: 'sum[_i=2^(2*nc)] i * Px+y(i)'.

     '_s_v_a' Sum variance: 'sum[_i=2^(2*nc)] (i - sen)^2 * Px+y(i)'.

     '_s_e_n' Sum entropy: '-sum[_i=2^(2*nc)] Px+y(i) * log( p(i,j) )'.

     '_e_n_t' Entropy: '-sum[_i=1^nc] sum[_j=1^nc] p(i,j) * log( p(i,j)
          )'.

     '_d_v_a' Difference variance: 'sum[_i=0^(nc-1)] (i^2) * Px-y(i)'.

     '_d_e_n' Difference entropy: 'sum[_i=0^(nc-1)] Px-y(i) * log(
          Px-y(i,j) )'.

     '_f_1_2' Measure of correlation: 'ABS(ent - HXY1) / HX'.

     '_f_1_3' Measure of correlation: 'sqrt( 1 - exp( -2 *(HXY2 - ent) )
          )'.

     Where:

     '_p(_i,_j)' The value in row i, column j of the co-occurrence matrix.

     '_P_x(_i)' Partial probability density function.  Defined by
          'sum[_j=1^nc] p(i,j) '.

     '_P_y(_j)' Partial probability density function.  Defined by
          'sum[_i=1^nc] p(i,j) '.

     '_m_u__x, _m_u__y' Are the means of 'Px' and 'Px', the partial
          probability density functions.

     '_s_i_g_m_a__x, _s_i_g_m_a__y' Are the standard deviations of 'Px' and 'Py'.

     '_P_x+_y' Is the probability of the co-occurrence matrix co-ordinates
          summing to 'x+y'.  It is defined as 'Px+y(k) = sum[_i=1^nc]
          sum[_j=1^nc] p(i,j), i + j = k and k = 2,3,...,2*nc'.

     '_P_x-_y' Is the probability of the absolute value of the difference
          between co-occurrence matrix co-ordinates being equal to
          'x-y'.  It is defined as 'Px-y(k) = sum[_i=1^nc] sum[_j=1^nc]
          p(i,j), ABS(i - j) = k and k = 2,3,...,2*nc'.

     '_H_X_Y_1' '-sum[_i=1^nc] sum[_j=1^nc] p(i,j) * log( Px(i),Py(j) ) '.

     '_H_X_Y_2' '-sum[_i=1^nc] sum[_j=1^nc] Px(i)*Py(j) * log( Px(i),Py(j)
          ) '.

_V_a_l_u_e:

     For a single frame in 'x' the result of 'haralickMatrix' is an
     array of  dimensions 'nc' * 'nc' * "the number of objects in the
     frame". 

     'haralickFeatures' returns a matrix of dimensions "number of
     objects in  the frame" * 12. 

     For multiple frames a list of each of the above will be returned.

_A_u_t_h_o_r(_s):

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

_R_e_f_e_r_e_n_c_e_s:

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

_S_e_e _A_l_s_o:

     ' IndexedImage, watershed, propagate '

_E_x_a_m_p_l_e_s:

       ## see example(getFeatures)

