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)

