Haralick Textural Features: Difference between revisions
| (5 intermediate revisions by the same user not shown) | |||
| Line 23: | Line 23: | ||
|} | |} | ||
Then <math>P(i,j,d,\alpha)</math> is the number of occurrences where a pixel with value <math>i</math> and a pixel with value <math>j</math> are distance <math>d</math> apart along angle <math>\alpha \in \{0^\circ, 45^\circ, 90^\circ, 135^\circ\}</math>. | Then <math>P(i,j,d,\alpha)</math> is the number of occurrences where a pixel with value <math>i</math> and a pixel with value <math>j</math> are distance <math>d</math> apart along angle <math>\alpha \in \{0^\circ, 45^\circ, 90^\circ, 135^\circ\}</math>. Note that each neighbor pair is counted twice (e.g. pixel 1 is neighbor of 0 and 0 is neighbor of 1). | ||
If we fix <code>d=1</code>, then we get four matrices of co-occurances along each direction: | If we fix <code>d=1</code>, then we get four matrices of co-occurances along each direction: | ||
| Line 33: | Line 33: | ||
For horizontal and vertical directions with resolution N, each row or column will have 2(N-1) neighbors. Thus in total, there will be <math>R=2 N_x(N_y-1)</math> or <math>R=2 N_y(N_x-1)</math> neighbors.<br> | For horizontal and vertical directions with resolution N, each row or column will have 2(N-1) neighbors. Thus in total, there will be <math>R=2 N_x(N_y-1)</math> or <math>R=2 N_y(N_x-1)</math> neighbors.<br> | ||
For diagonal directions, there will be <math>R=2 (N_x - 1)(N_y-1)</math> neighbors.<br> | For diagonal directions, there will be <math>R=2 (N_x - 1)(N_y-1)</math> neighbors.<br> | ||
Each co-occurance matrix <math>P</math> can be normalized by dividing each entry by R | Each co-occurance matrix <math>P</math> can be normalized by dividing each entry by <math>R</math> to get <math> p= P/R</math>. | ||
===Features=== | ===Features=== | ||
There are 14 values Haralick ''et al.'' compute per co-occurance matrix. The mean and range among the matrices are used to get 28 features. | There are 14 values Haralick ''et al.'' compute per co-occurance matrix. The mean and range among the four matrices are used to get 28 features. | ||
# Angular second moment: <math>f_1 = \sum_i \sum_j p(i,j)^2</math> | # Angular second moment: <math>f_1 = \sum_i \sum_j p(i,j)^2</math> | ||
# Contrast: | # Contrast: <math>f_2 = \sum_{n=0}^{N_{g-1}} n^2 \{ \underset{|i-j|=n}{\sum_{i=1}^{N-g}\sum_{j=1}^{N-g}} p(i,j) \}</math> | ||
# Correlation: | # Correlation: <math>f_3 = \frac{\sum_i \sum_j (ij)p(i,j) - \mu_x \mu_y}{\sigma_x \sigma_y}</math> | ||
# Sum of squares variance: | # Sum of squares variance: <math>f_4 = \sum_i \sum_j (i-\mu)^2 p(i,j)</math> | ||
# Inverse difference moment: | # Inverse difference moment: <math>f_5 = \sum_i \sum_j \frac{1}{1+(i-j)^2} p(i,j)</math> | ||
# Sum Average: | # Sum Average: <math>f_6 = \sum_{i=2}^{2N_g} ip_{x+y}(i)</math> | ||
# Sum Entropy: | # Sum Entropy: <math>f_7 = \sum_{i=2}^{2N_g} (i-f_6)^2 p_{x+y}(i)</math> | ||
# Entropy: | #* Note that the original paper has a typo. | ||
# Difference Variance: | # Entropy: <math>f_9 = - \sum_i \sum_j p(i,j) \log(p(i,j))</math> | ||
# Difference Entropy: | # Difference Variance: <math>f_{10}= var(p_{x-y})</math> | ||
# Difference Entropy: <math>f_{11} = -\sum_{i=0}^{N_{g}-1} p_{x-y}(i) \log p_{x-y}(i)</math> | |||
# Information Measures of Correlation 1: | # Information Measures of Correlation 1: | ||
# Information Measures of Correlation 2: | # Information Measures of Correlation 2: | ||
# Maximal Correlation Coefficient: | # Maximal Correlation Coefficient: <math>f_{14} = (second largest eigenvalue of Q)^{1/2}</math> where <math>Q(i,j) = \sum_k \frac{p(i,k)p(j,k)}{p_x(i)p_y(k)}</math> | ||
Notation: | |||
* <math>p(i,j)</math> = i,j value in the noramlized co-occurance matrix | |||
* <math>p_x(i)</math> = marginal probability (<math>\sum_j p(i,j)</math>) | |||
* <math>N_g</math> number of gray tones | |||
==Resources== | ==Resources== | ||